[10119] | 1 | /* $Id: windowword.cpp,v 1.13 2003-05-27 09:46:30 sandervl Exp $ */
|
---|
[2469] | 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>
|
---|
[10119] | 13 | #include <dbglog.h>
|
---|
[21916] | 14 | #include "ctrlconf.h"
|
---|
[2469] | 15 |
|
---|
[21916] | 16 | #include "win32wbase.h"
|
---|
[2469] | 17 |
|
---|
[5060] | 18 | #define DBG_LOCALLOG DBG_windowword
|
---|
[2803] | 19 | #include "dbglocal.h"
|
---|
| 20 |
|
---|
[2469] | 21 | //******************************************************************************
|
---|
[10119] | 22 | //Update the window style without sending WM_STYLECHANGING/ED
|
---|
[2469] | 23 | //******************************************************************************
|
---|
[10119] | 24 | void WIN_SetStyle(HWND hwnd, DWORD dwStyle)
|
---|
| 25 | {
|
---|
| 26 | Win32BaseWindow *window;
|
---|
| 27 |
|
---|
| 28 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 29 | if(window)
|
---|
| 30 | {
|
---|
| 31 | window->setStyle(dwStyle);
|
---|
| 32 | RELEASE_WNDOBJ(window);
|
---|
| 33 | return;
|
---|
| 34 | }
|
---|
| 35 | else {
|
---|
| 36 | dprintf(("WIN_SetStyle window %x not found!", hwnd));
|
---|
| 37 | return;
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | //******************************************************************************
|
---|
| 41 | //******************************************************************************
|
---|
[2469] | 42 | LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG lNewLong)
|
---|
| 43 | {
|
---|
| 44 | Win32BaseWindow *window;
|
---|
[5935] | 45 | LONG ret;
|
---|
[2469] | 46 |
|
---|
| 47 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 48 | if(window)
|
---|
| 49 | {
|
---|
[7241] | 50 | ret = window->SetWindowLong(nIndex,lNewLong, TYPE_ASCII);
|
---|
[5935] | 51 | RELEASE_WNDOBJ(window);
|
---|
| 52 | return ret;
|
---|
[2469] | 53 | }
|
---|
| 54 | else {
|
---|
[5060] | 55 | dprintf(("SetWindowLongA %d %x; window %x not found!", nIndex, lNewLong, hwnd));
|
---|
| 56 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6
|
---|
| 57 | return 0;
|
---|
[2469] | 58 | }
|
---|
| 59 | }
|
---|
| 60 | //******************************************************************************
|
---|
| 61 | //******************************************************************************
|
---|
| 62 | LONG WIN32API SetWindowLongW(HWND hwnd, int nIndex, LONG lNewLong)
|
---|
| 63 | {
|
---|
| 64 | Win32BaseWindow *window;
|
---|
[5935] | 65 | LONG ret;
|
---|
[2469] | 66 |
|
---|
| 67 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 68 | if(window)
|
---|
| 69 | {
|
---|
[7241] | 70 | ret = window->SetWindowLong(nIndex,lNewLong, TYPE_UNICODE);
|
---|
[5935] | 71 | RELEASE_WNDOBJ(window);
|
---|
| 72 | return ret;
|
---|
[2469] | 73 | }
|
---|
| 74 | else {
|
---|
[5060] | 75 | dprintf(("SetWindowLongW; window %x not found!", hwnd));
|
---|
| 76 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6
|
---|
| 77 | return 0;
|
---|
[2469] | 78 | }
|
---|
| 79 | }
|
---|
| 80 | //******************************************************************************
|
---|
| 81 | //******************************************************************************
|
---|
| 82 | WORD WIN32API GetWindowWord(HWND hwnd, int nIndex)
|
---|
| 83 | {
|
---|
| 84 | Win32BaseWindow *window;
|
---|
[5935] | 85 | LONG ret;
|
---|
[2469] | 86 |
|
---|
| 87 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 88 | if(window)
|
---|
| 89 | {
|
---|
[5935] | 90 | ret = window->GetWindowWord(nIndex);
|
---|
| 91 | RELEASE_WNDOBJ(window);
|
---|
| 92 | return ret;
|
---|
[2469] | 93 | }
|
---|
| 94 | else
|
---|
| 95 | {
|
---|
| 96 | dprintf(("GetWindowWord; window %x not found!", hwnd));
|
---|
[5060] | 97 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6
|
---|
| 98 | return 0;
|
---|
[2469] | 99 | }
|
---|
| 100 | }
|
---|
| 101 | //******************************************************************************
|
---|
| 102 | //******************************************************************************
|
---|
| 103 | WORD WIN32API SetWindowWord(HWND hwnd, int nIndex, WORD arg3)
|
---|
| 104 | {
|
---|
| 105 | Win32BaseWindow *window;
|
---|
[5935] | 106 | LONG ret;
|
---|
[2469] | 107 |
|
---|
| 108 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 109 | if(window)
|
---|
| 110 | {
|
---|
[5935] | 111 | ret = window->SetWindowWord(nIndex, arg3);
|
---|
| 112 | RELEASE_WNDOBJ(window);
|
---|
| 113 | return ret;
|
---|
[2469] | 114 | }
|
---|
| 115 | else
|
---|
| 116 | {
|
---|
| 117 | dprintf(("SetWindowWord; window %x not found!", hwnd));
|
---|
[5060] | 118 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6
|
---|
| 119 | return 0;
|
---|
[2469] | 120 | }
|
---|
| 121 | }
|
---|
| 122 | //******************************************************************************
|
---|
| 123 | //******************************************************************************
|
---|
| 124 | LONG WIN32API GetWindowLongA(HWND hwnd, int nIndex)
|
---|
| 125 | {
|
---|
| 126 | Win32BaseWindow *window;
|
---|
[5935] | 127 | LONG ret;
|
---|
[2469] | 128 |
|
---|
| 129 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 130 | if(window)
|
---|
| 131 | {
|
---|
[7241] | 132 | ret = window->GetWindowLong(nIndex, TYPE_ASCII);
|
---|
[5935] | 133 | RELEASE_WNDOBJ(window);
|
---|
| 134 | return ret;
|
---|
[2469] | 135 | }
|
---|
| 136 | else
|
---|
| 137 | {
|
---|
| 138 | dprintf(("GetWindowLongA; window %x (%d) not found!", hwnd, nIndex));
|
---|
[5060] | 139 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6
|
---|
| 140 | return 0;
|
---|
[2469] | 141 | }
|
---|
| 142 | }
|
---|
| 143 | //******************************************************************************
|
---|
| 144 | //******************************************************************************
|
---|
| 145 | LONG WIN32API GetWindowLongW(HWND hwnd, int nIndex)
|
---|
| 146 | {
|
---|
| 147 | Win32BaseWindow *window;
|
---|
[5935] | 148 | LONG ret;
|
---|
[2469] | 149 |
|
---|
| 150 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
| 151 | if(window)
|
---|
| 152 | {
|
---|
[7241] | 153 | ret = window->GetWindowLong(nIndex, TYPE_UNICODE);
|
---|
[5935] | 154 | RELEASE_WNDOBJ(window);
|
---|
| 155 | return ret;
|
---|
[2469] | 156 | }
|
---|
| 157 | else
|
---|
| 158 | {
|
---|
| 159 | dprintf(("GetWindowLongW; window %x not found!", hwnd));
|
---|
[5060] | 160 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); //verified in NT4, SP6
|
---|
| 161 | return 0;
|
---|
[2469] | 162 | }
|
---|
| 163 | }
|
---|
| 164 | //******************************************************************************
|
---|
| 165 | //******************************************************************************
|
---|