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