| 1 | /* $Id: windowword.cpp,v 1.11 2001-06-09 14:50:26 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Win32 Get/SetWindowLong/Word user32 API functions for OS/2 | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1998-1999 Sander van Leeuwen | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #include <os2win.h> | 
|---|
| 13 | #include <misc.h> | 
|---|
| 14 |  | 
|---|
| 15 | #include <win32wbase.h> | 
|---|
| 16 |  | 
|---|
| 17 | #define DBG_LOCALLOG    DBG_windowword | 
|---|
| 18 | #include "dbglocal.h" | 
|---|
| 19 |  | 
|---|
| 20 | //****************************************************************************** | 
|---|
| 21 | //****************************************************************************** | 
|---|
| 22 | LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG  lNewLong) | 
|---|
| 23 | { | 
|---|
| 24 | Win32BaseWindow *window; | 
|---|
| 25 | LONG ret; | 
|---|
| 26 |  | 
|---|
| 27 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 28 | if(window) | 
|---|
| 29 | { | 
|---|
| 30 | ret = window->SetWindowLongA(nIndex,lNewLong); | 
|---|
| 31 | RELEASE_WNDOBJ(window); | 
|---|
| 32 | return ret; | 
|---|
| 33 | } | 
|---|
| 34 | else { | 
|---|
| 35 | dprintf(("SetWindowLongA %d %x; window %x not found!", nIndex, lNewLong, hwnd)); | 
|---|
| 36 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6 | 
|---|
| 37 | return 0; | 
|---|
| 38 | } | 
|---|
| 39 | } | 
|---|
| 40 | //****************************************************************************** | 
|---|
| 41 | //****************************************************************************** | 
|---|
| 42 | LONG WIN32API SetWindowLongW(HWND hwnd, int nIndex, LONG  lNewLong) | 
|---|
| 43 | { | 
|---|
| 44 | Win32BaseWindow *window; | 
|---|
| 45 | LONG ret; | 
|---|
| 46 |  | 
|---|
| 47 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 48 | if(window) | 
|---|
| 49 | { | 
|---|
| 50 | ret = window->SetWindowLongA(nIndex,lNewLong, TRUE); | 
|---|
| 51 | RELEASE_WNDOBJ(window); | 
|---|
| 52 | return ret; | 
|---|
| 53 | } | 
|---|
| 54 | else { | 
|---|
| 55 | dprintf(("SetWindowLongW; window %x not found!", hwnd)); | 
|---|
| 56 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6 | 
|---|
| 57 | return 0; | 
|---|
| 58 | } | 
|---|
| 59 | } | 
|---|
| 60 | //****************************************************************************** | 
|---|
| 61 | //****************************************************************************** | 
|---|
| 62 | WORD WIN32API GetWindowWord(HWND hwnd, int nIndex) | 
|---|
| 63 | { | 
|---|
| 64 | Win32BaseWindow *window; | 
|---|
| 65 | LONG ret; | 
|---|
| 66 |  | 
|---|
| 67 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 68 | if(window) | 
|---|
| 69 | { | 
|---|
| 70 | ret = window->GetWindowWord(nIndex); | 
|---|
| 71 | RELEASE_WNDOBJ(window); | 
|---|
| 72 | return ret; | 
|---|
| 73 | } | 
|---|
| 74 | else | 
|---|
| 75 | { | 
|---|
| 76 | dprintf(("GetWindowWord; window %x not found!", hwnd)); | 
|---|
| 77 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6 | 
|---|
| 78 | return 0; | 
|---|
| 79 | } | 
|---|
| 80 | } | 
|---|
| 81 | //****************************************************************************** | 
|---|
| 82 | //****************************************************************************** | 
|---|
| 83 | WORD WIN32API SetWindowWord(HWND hwnd, int nIndex, WORD arg3) | 
|---|
| 84 | { | 
|---|
| 85 | Win32BaseWindow *window; | 
|---|
| 86 | LONG ret; | 
|---|
| 87 |  | 
|---|
| 88 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 89 | if(window) | 
|---|
| 90 | { | 
|---|
| 91 | ret = window->SetWindowWord(nIndex, arg3); | 
|---|
| 92 | RELEASE_WNDOBJ(window); | 
|---|
| 93 | return ret; | 
|---|
| 94 | } | 
|---|
| 95 | else | 
|---|
| 96 | { | 
|---|
| 97 | dprintf(("SetWindowWord; window %x not found!", hwnd)); | 
|---|
| 98 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6 | 
|---|
| 99 | return 0; | 
|---|
| 100 | } | 
|---|
| 101 | } | 
|---|
| 102 | //****************************************************************************** | 
|---|
| 103 | //****************************************************************************** | 
|---|
| 104 | LONG WIN32API GetWindowLongA(HWND hwnd, int nIndex) | 
|---|
| 105 | { | 
|---|
| 106 | Win32BaseWindow *window; | 
|---|
| 107 | LONG ret; | 
|---|
| 108 |  | 
|---|
| 109 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 110 | if(window) | 
|---|
| 111 | { | 
|---|
| 112 | ret = window->GetWindowLongA(nIndex); | 
|---|
| 113 | RELEASE_WNDOBJ(window); | 
|---|
| 114 | return ret; | 
|---|
| 115 | } | 
|---|
| 116 | else | 
|---|
| 117 | { | 
|---|
| 118 | dprintf(("GetWindowLongA; window %x (%d) not found!", hwnd, nIndex)); | 
|---|
| 119 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6 | 
|---|
| 120 | return 0; | 
|---|
| 121 | } | 
|---|
| 122 | } | 
|---|
| 123 | //****************************************************************************** | 
|---|
| 124 | //****************************************************************************** | 
|---|
| 125 | LONG WIN32API GetWindowLongW(HWND hwnd, int nIndex) | 
|---|
| 126 | { | 
|---|
| 127 | Win32BaseWindow *window; | 
|---|
| 128 | LONG ret; | 
|---|
| 129 |  | 
|---|
| 130 | window = Win32BaseWindow::GetWindowFromHandle(hwnd); | 
|---|
| 131 | if(window) | 
|---|
| 132 | { | 
|---|
| 133 | ret = window->GetWindowLongA(nIndex, TRUE); | 
|---|
| 134 | RELEASE_WNDOBJ(window); | 
|---|
| 135 | return ret; | 
|---|
| 136 | } | 
|---|
| 137 | else | 
|---|
| 138 | { | 
|---|
| 139 | dprintf(("GetWindowLongW; window %x not found!", hwnd)); | 
|---|
| 140 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6 | 
|---|
| 141 | return 0; | 
|---|
| 142 | } | 
|---|
| 143 | } | 
|---|
| 144 | //****************************************************************************** | 
|---|
| 145 | //****************************************************************************** | 
|---|