1 | /* $Id: window.cpp,v 1.44 1999-12-24 18:39:13 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 window apis for OS/2
|
---|
4 | *
|
---|
5 | * Copyright 1999 Sander van Leeuwen
|
---|
6 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
---|
7 | *
|
---|
8 | * Parts based on Wine Windows code (windows\win.c)
|
---|
9 | *
|
---|
10 | * Copyright 1993, 1994 Alexandre Julliard
|
---|
11 | *
|
---|
12 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
13 | *
|
---|
14 | *
|
---|
15 | * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
|
---|
16 | *
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include <os2win.h>
|
---|
20 | #include <misc.h>
|
---|
21 | #include <string.h>
|
---|
22 | #include <stdio.h>
|
---|
23 | #include <win32wbase.h>
|
---|
24 | #include <win32wmdiclient.h>
|
---|
25 | #include <win32wdesktop.h>
|
---|
26 | #include "win32dlg.h"
|
---|
27 | #include <oslibwin.h>
|
---|
28 | #include <oslibgdi.h>
|
---|
29 | #include "user32.h"
|
---|
30 | #include "winicon.h"
|
---|
31 | #include <win\winpos.h>
|
---|
32 |
|
---|
33 | //******************************************************************************
|
---|
34 | //******************************************************************************
|
---|
35 | HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
|
---|
36 | LPCSTR windowName, DWORD style, INT x,
|
---|
37 | INT y, INT width, INT height,
|
---|
38 | HWND parent, HMENU menu,
|
---|
39 | HINSTANCE instance, LPVOID data )
|
---|
40 | {
|
---|
41 | Win32BaseWindow *window;
|
---|
42 | ATOM classAtom;
|
---|
43 | CREATESTRUCTA cs;
|
---|
44 | char tmpClass[20];
|
---|
45 |
|
---|
46 | if(exStyle & WS_EX_MDICHILD)
|
---|
47 | return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
---|
48 |
|
---|
49 | #if 1
|
---|
50 | /* Find the class atom */
|
---|
51 | if (!(classAtom = GlobalFindAtomA(className)))
|
---|
52 | {
|
---|
53 | if (!HIWORD(className))
|
---|
54 | dprintf(("CreateWindowEx32A: bad class name %04x\n",LOWORD(className)));
|
---|
55 | else
|
---|
56 | dprintf(("CreateWindowEx32A: bad class name '%s'\n", className));
|
---|
57 |
|
---|
58 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
59 | return 0;
|
---|
60 | }
|
---|
61 |
|
---|
62 | if (!HIWORD(className))
|
---|
63 | {
|
---|
64 | sprintf(tmpClass,"#%d", (int) className);
|
---|
65 | className = tmpClass;
|
---|
66 | }
|
---|
67 | #else
|
---|
68 | /* Find the class atom */
|
---|
69 | if (!HIWORD(className) || !(classAtom = GlobalFindAtomA(className)))
|
---|
70 | {
|
---|
71 | if (!HIWORD(className))
|
---|
72 | {
|
---|
73 | sprintf(tmpClass,"#%d", (int) className);
|
---|
74 | classAtom = GlobalFindAtomA(tmpClass);
|
---|
75 | className = tmpClass;
|
---|
76 | }
|
---|
77 | if (!classAtom)
|
---|
78 | {
|
---|
79 | if (!HIWORD(className)) {
|
---|
80 | dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
|
---|
81 | }
|
---|
82 | else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
|
---|
83 |
|
---|
84 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
85 | return 0;
|
---|
86 | }
|
---|
87 | }
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | /* Create the window */
|
---|
91 | cs.lpCreateParams = data;
|
---|
92 | cs.hInstance = instance;
|
---|
93 | cs.hMenu = menu;
|
---|
94 | cs.hwndParent = parent;
|
---|
95 | cs.x = x;
|
---|
96 | cs.y = y;
|
---|
97 | cs.cx = width;
|
---|
98 | cs.cy = height;
|
---|
99 | cs.style = style;
|
---|
100 | cs.lpszName = windowName;
|
---|
101 | cs.lpszClass = className;
|
---|
102 | cs.dwExStyle = exStyle;
|
---|
103 | if(HIWORD(className)) {
|
---|
104 | dprintf(("CreateWindowExA: class %s parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
|
---|
105 | }
|
---|
106 | else dprintf(("CreateWindowExA: class %d parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
|
---|
107 |
|
---|
108 | if(!strcmpi(className, MDICLIENTCLASSNAMEA)) {
|
---|
109 | window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, FALSE);
|
---|
110 | }
|
---|
111 | else
|
---|
112 | if(!strcmpi((char *) className, DIALOG_CLASS_NAMEA))
|
---|
113 | {
|
---|
114 | DLG_TEMPLATE dlgTemplate = {0};
|
---|
115 | dlgTemplate.style = cs.style;
|
---|
116 | dlgTemplate.exStyle = cs.dwExStyle;
|
---|
117 | dlgTemplate.x = cs.x;
|
---|
118 | dlgTemplate.y = cs.y;
|
---|
119 | dlgTemplate.cx = cs.cx;
|
---|
120 | dlgTemplate.cy = cs.cy;
|
---|
121 | dlgTemplate.className = cs.lpszClass;
|
---|
122 | dlgTemplate.caption = cs.lpszName;
|
---|
123 | window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
|
---|
124 | (LPCSTR) &dlgTemplate,
|
---|
125 | cs.hwndParent,
|
---|
126 | NULL,
|
---|
127 | (LPARAM) data,
|
---|
128 | FALSE);
|
---|
129 | }
|
---|
130 | else {
|
---|
131 | window = new Win32BaseWindow( &cs, classAtom, FALSE );
|
---|
132 | }
|
---|
133 | if(window == NULL)
|
---|
134 | {
|
---|
135 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
136 | return 0;
|
---|
137 | }
|
---|
138 | if(GetLastError() != 0)
|
---|
139 | {
|
---|
140 | dprintf(("Win32BaseWindow error found!!"));
|
---|
141 | delete window;
|
---|
142 | return 0;
|
---|
143 | }
|
---|
144 | return window->getWindowHandle();
|
---|
145 | }
|
---|
146 | //******************************************************************************
|
---|
147 | //******************************************************************************
|
---|
148 | HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
|
---|
149 | LPCWSTR windowName, DWORD style, INT x,
|
---|
150 | INT y, INT width, INT height,
|
---|
151 | HWND parent, HMENU menu,
|
---|
152 | HINSTANCE instance, LPVOID data )
|
---|
153 | {
|
---|
154 | Win32BaseWindow *window;
|
---|
155 | ATOM classAtom;
|
---|
156 | CREATESTRUCTA cs;
|
---|
157 | char tmpClassA[20];
|
---|
158 | WCHAR tmpClassW[20];
|
---|
159 |
|
---|
160 | if(exStyle & WS_EX_MDICHILD)
|
---|
161 | return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
---|
162 |
|
---|
163 | /* Find the class atom */
|
---|
164 | if (!HIWORD(className) || !(classAtom = GlobalFindAtomW(className)))
|
---|
165 | {
|
---|
166 | if (!HIWORD(className))
|
---|
167 | {
|
---|
168 | sprintf(tmpClassA,"#%d", (int) className);
|
---|
169 | AsciiToUnicode(tmpClassA, tmpClassW);
|
---|
170 | classAtom = GlobalFindAtomW(tmpClassW);
|
---|
171 | className = (LPCWSTR)tmpClassW;
|
---|
172 | }
|
---|
173 | if (!classAtom)
|
---|
174 | {
|
---|
175 | if (!HIWORD(className)) {
|
---|
176 | dprintf(("CreateWindowEx32W: bad class name %04x\n", LOWORD(className)));
|
---|
177 | }
|
---|
178 | else dprintf(("CreateWindowEx32W: bad class name "));
|
---|
179 |
|
---|
180 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
181 | return 0;
|
---|
182 | }
|
---|
183 | }
|
---|
184 | if(HIWORD(className)) {
|
---|
185 | dprintf(("CreateWindowExW: class %s parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
|
---|
186 | }
|
---|
187 | else dprintf(("CreateWindowExW: class %d parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
|
---|
188 |
|
---|
189 | /* Create the window */
|
---|
190 | cs.lpCreateParams = data;
|
---|
191 | cs.hInstance = instance;
|
---|
192 | cs.hMenu = menu;
|
---|
193 | cs.hwndParent = parent;
|
---|
194 | cs.x = x;
|
---|
195 | cs.y = y;
|
---|
196 | cs.cx = width;
|
---|
197 | cs.cy = height;
|
---|
198 | cs.style = style;
|
---|
199 | cs.lpszName = (LPSTR)windowName;
|
---|
200 | cs.lpszClass = (LPSTR)className;
|
---|
201 | cs.dwExStyle = exStyle;
|
---|
202 |
|
---|
203 | if(!lstrcmpiW(className, (LPWSTR)MDICLIENTCLASSNAMEW)) {
|
---|
204 | window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, TRUE);
|
---|
205 | }
|
---|
206 | else
|
---|
207 | if(!lstrcmpiW(className, (LPWSTR)DIALOG_CLASS_NAMEW))
|
---|
208 | {
|
---|
209 | DLG_TEMPLATE dlgTemplate = {0};
|
---|
210 | dlgTemplate.style = cs.style;
|
---|
211 | dlgTemplate.exStyle = cs.dwExStyle;
|
---|
212 | dlgTemplate.x = cs.x;
|
---|
213 | dlgTemplate.y = cs.y;
|
---|
214 | dlgTemplate.cx = cs.cx;
|
---|
215 | dlgTemplate.cy = cs.cy;
|
---|
216 | dlgTemplate.className = cs.lpszClass;
|
---|
217 | dlgTemplate.caption = cs.lpszName;
|
---|
218 | window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
|
---|
219 | (LPCSTR) &dlgTemplate,
|
---|
220 | cs.hwndParent,
|
---|
221 | NULL,
|
---|
222 | (LPARAM) data,
|
---|
223 | TRUE);
|
---|
224 | }
|
---|
225 | else {
|
---|
226 | window = new Win32BaseWindow( &cs, classAtom, TRUE );
|
---|
227 | }
|
---|
228 | if(window == NULL)
|
---|
229 | {
|
---|
230 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
231 | return 0;
|
---|
232 | }
|
---|
233 | if(GetLastError() != 0)
|
---|
234 | {
|
---|
235 | dprintf(("Win32BaseWindow error found!!"));
|
---|
236 | delete window;
|
---|
237 | return 0;
|
---|
238 | }
|
---|
239 | return window->getWindowHandle();
|
---|
240 | }
|
---|
241 | //******************************************************************************
|
---|
242 | //******************************************************************************
|
---|
243 | HWND WIN32API CreateMDIWindowA(LPCSTR lpszClassName, LPCSTR lpszWindowName,
|
---|
244 | DWORD dwStyle, int x, int y, int nWidth,
|
---|
245 | int nHeight, HWND hwndParent,
|
---|
246 | HINSTANCE hInstance, LPARAM lParam )
|
---|
247 | {
|
---|
248 | HWND hwnd;
|
---|
249 | MDICREATESTRUCTA cs;
|
---|
250 | Win32BaseWindow *window;
|
---|
251 |
|
---|
252 | window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
|
---|
253 | if(!window) {
|
---|
254 | dprintf(("CreateMDIWindowA, window %x not found", hwndParent));
|
---|
255 | return 0;
|
---|
256 | }
|
---|
257 |
|
---|
258 | dprintf(("USER32: CreateMDIWindowA\n"));
|
---|
259 | cs.szClass = lpszClassName;
|
---|
260 | cs.szTitle = lpszWindowName;
|
---|
261 | cs.hOwner = hInstance;
|
---|
262 | cs.x = x;
|
---|
263 | cs.y = y;
|
---|
264 | cs.cx = nHeight;
|
---|
265 | cs.cy = nWidth;
|
---|
266 | cs.style = dwStyle;
|
---|
267 | cs.lParam = lParam;
|
---|
268 |
|
---|
269 | return window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs);
|
---|
270 | }
|
---|
271 | //******************************************************************************
|
---|
272 | //******************************************************************************
|
---|
273 | HWND WIN32API CreateMDIWindowW(LPCWSTR lpszClassName, LPCWSTR lpszWindowName,
|
---|
274 | DWORD dwStyle, int x, int y, int nWidth,
|
---|
275 | int nHeight, HWND hwndParent,
|
---|
276 | HINSTANCE hInstance, LPARAM lParam )
|
---|
277 | {
|
---|
278 | HWND hwnd;
|
---|
279 | MDICREATESTRUCTW cs;
|
---|
280 | Win32BaseWindow *window;
|
---|
281 |
|
---|
282 | window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
|
---|
283 | if(!window) {
|
---|
284 | dprintf(("CreateMDIWindowW, window %x not found", hwndParent));
|
---|
285 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
286 | return 0;
|
---|
287 | }
|
---|
288 |
|
---|
289 | dprintf(("USER32: CreateMDIWindowW\n"));
|
---|
290 | cs.szClass = lpszClassName;
|
---|
291 | cs.szTitle = lpszWindowName;
|
---|
292 | cs.hOwner = hInstance;
|
---|
293 | cs.x = x;
|
---|
294 | cs.y = y;
|
---|
295 | cs.cx = nHeight;
|
---|
296 | cs.cy = nWidth;
|
---|
297 | cs.style = dwStyle;
|
---|
298 | cs.lParam = lParam;
|
---|
299 |
|
---|
300 | return window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs);
|
---|
301 | }
|
---|
302 | //******************************************************************************
|
---|
303 | //******************************************************************************
|
---|
304 | BOOL WIN32API DestroyWindow(HWND hwnd)
|
---|
305 | {
|
---|
306 | Win32BaseWindow *window;
|
---|
307 |
|
---|
308 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
309 | if(!window) {
|
---|
310 | dprintf(("DestroyWindow, window %x not found", hwnd));
|
---|
311 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
312 | return 0;
|
---|
313 | }
|
---|
314 | dprintf(("DestroyWindow %x", hwnd));
|
---|
315 | return window->DestroyWindow();
|
---|
316 | }
|
---|
317 | //******************************************************************************
|
---|
318 | //******************************************************************************
|
---|
319 | HWND WIN32API SetActiveWindow( HWND hwnd)
|
---|
320 | {
|
---|
321 | Win32BaseWindow *window;
|
---|
322 |
|
---|
323 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
324 | if(!window) {
|
---|
325 | dprintf(("SetActiveWindow, window %x not found", hwnd));
|
---|
326 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
327 | return 0;
|
---|
328 | }
|
---|
329 | dprintf(("SetActiveWindow %x", hwnd));
|
---|
330 | return window->SetActiveWindow();
|
---|
331 | }
|
---|
332 | //******************************************************************************
|
---|
333 | //******************************************************************************
|
---|
334 | HWND WIN32API GetParent( HWND hwnd)
|
---|
335 | {
|
---|
336 | Win32BaseWindow *window;
|
---|
337 |
|
---|
338 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
339 | if(!window) {
|
---|
340 | dprintf(("GetParent, window %x not found", hwnd));
|
---|
341 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
342 | return 0;
|
---|
343 | }
|
---|
344 | // dprintf(("GetParent %x", hwnd));
|
---|
345 | return window->GetParent();
|
---|
346 | }
|
---|
347 | //******************************************************************************
|
---|
348 | //******************************************************************************
|
---|
349 | HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
|
---|
350 | {
|
---|
351 | Win32BaseWindow *window;
|
---|
352 |
|
---|
353 | window = Win32BaseWindow::GetWindowFromHandle(hwndChild);
|
---|
354 | if(!window) {
|
---|
355 | dprintf(("SetParent, window %x not found", hwndChild));
|
---|
356 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
357 | return 0;
|
---|
358 | }
|
---|
359 | dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
|
---|
360 | return window->SetParent(hwndNewParent);
|
---|
361 | }
|
---|
362 | //******************************************************************************
|
---|
363 | //******************************************************************************
|
---|
364 | BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
|
---|
365 | {
|
---|
366 | Win32BaseWindow *window;
|
---|
367 |
|
---|
368 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
369 | if(!window) {
|
---|
370 | dprintf(("IsChild, window %x not found", hwnd));
|
---|
371 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
372 | return 0;
|
---|
373 | }
|
---|
374 | dprintf(("IsChild %x %x", hwndParent, hwnd));
|
---|
375 | return window->IsChild(hwndParent);
|
---|
376 | }
|
---|
377 | //******************************************************************************
|
---|
378 | //******************************************************************************
|
---|
379 | HWND WIN32API GetTopWindow( HWND hwnd)
|
---|
380 | {
|
---|
381 | Win32BaseWindow *window;
|
---|
382 |
|
---|
383 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
384 | if(!window) {
|
---|
385 | dprintf(("GetTopWindow, window %x not found", hwnd));
|
---|
386 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
387 | return 0;
|
---|
388 | }
|
---|
389 | return window->GetTopWindow();
|
---|
390 | }
|
---|
391 | //******************************************************************************
|
---|
392 | //******************************************************************************
|
---|
393 | BOOL WIN32API IsIconic( HWND hwnd)
|
---|
394 | {
|
---|
395 | Win32BaseWindow *window;
|
---|
396 | BOOL rc;
|
---|
397 |
|
---|
398 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
399 | if(!window) {
|
---|
400 | dprintf(("IsIconic, window %x not found", hwnd));
|
---|
401 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
402 | return 0;
|
---|
403 | }
|
---|
404 | rc = window->IsIconic();
|
---|
405 | dprintf(("IsIconic %x returned %d", hwnd, rc));
|
---|
406 | return rc;
|
---|
407 | }
|
---|
408 | //******************************************************************************
|
---|
409 | //******************************************************************************
|
---|
410 | HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
|
---|
411 | {
|
---|
412 | Win32BaseWindow *window;
|
---|
413 | HWND rc;
|
---|
414 |
|
---|
415 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
416 | if(!window) {
|
---|
417 | dprintf(("GetWindow, window %x not found", hwnd));
|
---|
418 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
419 | return 0;
|
---|
420 | }
|
---|
421 | rc = window->GetWindow(uCmd);
|
---|
422 | return rc;
|
---|
423 | }
|
---|
424 | //******************************************************************************
|
---|
425 | //******************************************************************************
|
---|
426 | BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
|
---|
427 | {
|
---|
428 | Win32BaseWindow *window;
|
---|
429 |
|
---|
430 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
431 | if(!window) {
|
---|
432 | dprintf(("EnableWindow, window %x not found", hwnd));
|
---|
433 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
434 | return 0;
|
---|
435 | }
|
---|
436 | dprintf(("EnableWindow %x %d", hwnd, fEnable));
|
---|
437 | return window->EnableWindow(fEnable);
|
---|
438 | }
|
---|
439 | //******************************************************************************
|
---|
440 | //******************************************************************************
|
---|
441 | BOOL WIN32API BringWindowToTop(HWND hwnd)
|
---|
442 | {
|
---|
443 | return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
|
---|
444 | }
|
---|
445 | //******************************************************************************
|
---|
446 | //******************************************************************************
|
---|
447 | HWND WIN32API GetActiveWindow()
|
---|
448 | {
|
---|
449 | return Win32BaseWindow::GetActiveWindow();
|
---|
450 | }
|
---|
451 | //******************************************************************************
|
---|
452 | //******************************************************************************
|
---|
453 | BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
|
---|
454 | {
|
---|
455 | Win32BaseWindow *window;
|
---|
456 |
|
---|
457 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
458 | if(!window) {
|
---|
459 | dprintf(("ShowWindow, window %x not found", hwnd));
|
---|
460 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
461 | return 0;
|
---|
462 | }
|
---|
463 | dprintf(("ShowWindow %x", hwnd));
|
---|
464 | return window->ShowWindow(nCmdShow);
|
---|
465 | }
|
---|
466 | /*****************************************************************************
|
---|
467 | * Name : BOOL WIN32API ShowWindowAsync
|
---|
468 | * Purpose : The ShowWindowAsync function sets the show state of a window
|
---|
469 | * created by a different thread.
|
---|
470 | * Parameters: HWND hwnd handle of window
|
---|
471 | * int nCmdShow show state of window
|
---|
472 | * Variables :
|
---|
473 | * Result : If the window was previously visible, the return value is TRUE.
|
---|
474 | * If the window was previously hidden, the return value is FALSE.
|
---|
475 | * Remark :
|
---|
476 | * Status : UNTESTED STUB
|
---|
477 | *
|
---|
478 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
---|
479 | *****************************************************************************/
|
---|
480 | BOOL WIN32API ShowWindowAsync (HWND hwnd,
|
---|
481 | int nCmdShow)
|
---|
482 | {
|
---|
483 | dprintf(("USER32:ShowWindowAsync (%08xh,%08x) not correctly implemented.\n",
|
---|
484 | hwnd,
|
---|
485 | nCmdShow));
|
---|
486 |
|
---|
487 | return ShowWindow(hwnd, nCmdShow);
|
---|
488 | }
|
---|
489 | //******************************************************************************
|
---|
490 | //******************************************************************************
|
---|
491 | BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
|
---|
492 | {
|
---|
493 | Win32BaseWindow *window;
|
---|
494 |
|
---|
495 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
496 | if(!window) {
|
---|
497 | dprintf(("SetWindowPos, window %x not found", hwnd));
|
---|
498 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
499 | return 0;
|
---|
500 | }
|
---|
501 | dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
|
---|
502 | return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
|
---|
503 | }
|
---|
504 | //******************************************************************************
|
---|
505 | //******************************************************************************
|
---|
506 | BOOL WIN32API SetWindowPlacement(HWND hwnd, const WINDOWPLACEMENT *winpos)
|
---|
507 | {
|
---|
508 | Win32BaseWindow *window;
|
---|
509 |
|
---|
510 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
511 | if(!window) {
|
---|
512 | dprintf(("SetWindowPlacement, window %x not found", hwnd));
|
---|
513 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
514 | return 0;
|
---|
515 | }
|
---|
516 | return window->SetWindowPlacement((WINDOWPLACEMENT *)winpos);
|
---|
517 | }
|
---|
518 | //******************************************************************************
|
---|
519 | //******************************************************************************
|
---|
520 | BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT arg2)
|
---|
521 | {
|
---|
522 | dprintf(("USER32: GetWindowPlacement\n"));
|
---|
523 | return O32_GetWindowPlacement(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd), arg2);
|
---|
524 | }
|
---|
525 | //******************************************************************************
|
---|
526 | //******************************************************************************
|
---|
527 | BOOL WIN32API IsWindow( HWND hwnd)
|
---|
528 | {
|
---|
529 | Win32BaseWindow *window;
|
---|
530 |
|
---|
531 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
532 | if(!window) {
|
---|
533 | dprintf(("IsWindow, window %x not found", hwnd));
|
---|
534 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
535 | return FALSE;
|
---|
536 | }
|
---|
537 | dprintf(("IsWindow %x", hwnd));
|
---|
538 | return window->IsWindow();
|
---|
539 | }
|
---|
540 | //******************************************************************************
|
---|
541 | //******************************************************************************
|
---|
542 | BOOL WIN32API IsWindowEnabled( HWND hwnd)
|
---|
543 | {
|
---|
544 | Win32BaseWindow *window;
|
---|
545 |
|
---|
546 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
547 | if(!window) {
|
---|
548 | dprintf(("IsWindowEnabled, window %x not found", hwnd));
|
---|
549 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
550 | return 0;
|
---|
551 | }
|
---|
552 | dprintf(("IsWindowEnabled %x", hwnd));
|
---|
553 | return window->IsWindowEnabled();
|
---|
554 | }
|
---|
555 | //******************************************************************************
|
---|
556 | //******************************************************************************
|
---|
557 | BOOL WIN32API IsWindowVisible( HWND hwnd)
|
---|
558 | {
|
---|
559 | Win32BaseWindow *window;
|
---|
560 | BOOL rc;
|
---|
561 |
|
---|
562 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
563 | if(!window) {
|
---|
564 | dprintf(("IsWindowVisible, window %x not found", hwnd));
|
---|
565 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
566 | return 0;
|
---|
567 | }
|
---|
568 | rc = window->IsWindowVisible();
|
---|
569 | dprintf(("IsWindowVisible %x returned %d", hwnd, rc));
|
---|
570 | return rc;
|
---|
571 | }
|
---|
572 | //******************************************************************************
|
---|
573 | //******************************************************************************
|
---|
574 | HWND WIN32API SetFocus (HWND hwnd)
|
---|
575 | {
|
---|
576 | HWND lastFocus, lastFocus_W, hwnd_O;
|
---|
577 | BOOL activate;
|
---|
578 |
|
---|
579 | hwnd_O = Win32BaseWindow::Win32ToOS2Handle (hwnd);
|
---|
580 | lastFocus = OSLibWinQueryFocus (OSLIB_HWND_DESKTOP);
|
---|
581 | activate = ((hwnd_O == lastFocus) || OSLibWinIsChild (lastFocus, hwnd_O));
|
---|
582 | lastFocus_W = Win32BaseWindow::OS2ToWin32Handle (lastFocus);
|
---|
583 |
|
---|
584 | dprintf(("SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O));
|
---|
585 |
|
---|
586 | return (OSLibWinSetFocus (OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0;
|
---|
587 | }
|
---|
588 | //******************************************************************************
|
---|
589 | //******************************************************************************
|
---|
590 | HWND WIN32API GetFocus(void)
|
---|
591 | {
|
---|
592 | HWND hwnd;
|
---|
593 |
|
---|
594 | hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
|
---|
595 | dprintf(("USER32: GetFocus %x\n", hwnd));
|
---|
596 | hwnd = Win32BaseWindow::OS2ToWin32Handle(hwnd);
|
---|
597 | return hwnd;
|
---|
598 | }
|
---|
599 | //******************************************************************************
|
---|
600 | //******************************************************************************
|
---|
601 | /***********************************************************************
|
---|
602 | * GetInternalWindowPos (USER32.245)
|
---|
603 | */
|
---|
604 | UINT WIN32API GetInternalWindowPos(HWND hwnd,
|
---|
605 | LPRECT rectWnd,
|
---|
606 | LPPOINT ptIcon )
|
---|
607 | {
|
---|
608 | WINDOWPLACEMENT wndpl;
|
---|
609 |
|
---|
610 | dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
|
---|
611 | hwnd,
|
---|
612 | rectWnd,
|
---|
613 | ptIcon));
|
---|
614 |
|
---|
615 | if (GetWindowPlacement( hwnd, &wndpl ))
|
---|
616 | {
|
---|
617 | if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
|
---|
618 | if (ptIcon) *ptIcon = wndpl.ptMinPosition;
|
---|
619 | return wndpl.showCmd;
|
---|
620 | }
|
---|
621 | return 0;
|
---|
622 | }
|
---|
623 | //******************************************************************************
|
---|
624 | //******************************************************************************
|
---|
625 | BOOL WIN32API IsZoomed(HWND hwnd)
|
---|
626 | {
|
---|
627 | dprintf(("USER32: IsZoomed\n"));
|
---|
628 | return O32_IsZoomed(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd));
|
---|
629 | }
|
---|
630 | //******************************************************************************
|
---|
631 | //******************************************************************************
|
---|
632 | BOOL WIN32API LockWindowUpdate(HWND hwnd)
|
---|
633 | {
|
---|
634 | dprintf(("USER32: LockWindowUpdate\n"));
|
---|
635 | return O32_LockWindowUpdate(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd));
|
---|
636 | }
|
---|
637 | //******************************************************************************
|
---|
638 | //******************************************************************************
|
---|
639 | BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
|
---|
640 | {
|
---|
641 | Win32BaseWindow *window;
|
---|
642 | BOOL rc;
|
---|
643 |
|
---|
644 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
645 | if(!window) {
|
---|
646 | dprintf(("GetWindowRect, window %x not found", hwnd));
|
---|
647 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
648 | return 0;
|
---|
649 | }
|
---|
650 | rc = window->GetWindowRect(pRect);
|
---|
651 | dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
|
---|
652 | return rc;
|
---|
653 | }
|
---|
654 | //******************************************************************************
|
---|
655 | //******************************************************************************
|
---|
656 | int WIN32API GetWindowTextLengthA( HWND hwnd)
|
---|
657 | {
|
---|
658 | Win32BaseWindow *window;
|
---|
659 |
|
---|
660 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
661 | if(!window) {
|
---|
662 | dprintf(("GetWindowTextLength, window %x not found", hwnd));
|
---|
663 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
664 | return 0;
|
---|
665 | }
|
---|
666 | dprintf(("GetWindowTextLength %x", hwnd));
|
---|
667 | return window->GetWindowTextLength();
|
---|
668 | }
|
---|
669 | //******************************************************************************
|
---|
670 | //******************************************************************************
|
---|
671 | int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
|
---|
672 | {
|
---|
673 | Win32BaseWindow *window;
|
---|
674 | int rc;
|
---|
675 |
|
---|
676 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
677 | if(!window) {
|
---|
678 | dprintf(("GetWindowTextA, window %x not found", hwnd));
|
---|
679 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
680 | return 0;
|
---|
681 | }
|
---|
682 | rc = window->GetWindowTextA(lpsz, cch);
|
---|
683 | dprintf(("GetWindowTextA %x %s", hwnd, lpsz));
|
---|
684 | return rc;
|
---|
685 | }
|
---|
686 | //******************************************************************************
|
---|
687 | //******************************************************************************
|
---|
688 | int WIN32API GetWindowTextLengthW( HWND hwnd)
|
---|
689 | {
|
---|
690 | dprintf(("USER32: GetWindowTextLengthW\n"));
|
---|
691 | return GetWindowTextLengthA(hwnd);
|
---|
692 | }
|
---|
693 | //******************************************************************************
|
---|
694 | //******************************************************************************
|
---|
695 | int WIN32API GetWindowTextW(HWND hwnd, LPWSTR lpsz, int cch)
|
---|
696 | {
|
---|
697 | Win32BaseWindow *window;
|
---|
698 |
|
---|
699 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
700 | if(!window) {
|
---|
701 | dprintf(("GetWindowTextW, window %x not found", hwnd));
|
---|
702 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
703 | return 0;
|
---|
704 | }
|
---|
705 | dprintf(("GetWindowTextW %x", hwnd));
|
---|
706 | return window->GetWindowTextW(lpsz, cch);
|
---|
707 | }
|
---|
708 | //******************************************************************************
|
---|
709 | //******************************************************************************
|
---|
710 | BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
|
---|
711 | {
|
---|
712 | Win32BaseWindow *window;
|
---|
713 |
|
---|
714 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
715 | if(!window) {
|
---|
716 | dprintf(("SetWindowTextA, window %x not found", hwnd));
|
---|
717 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
718 | return 0;
|
---|
719 | }
|
---|
720 | dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
|
---|
721 | return window->SetWindowTextA((LPSTR)lpsz);
|
---|
722 | }
|
---|
723 | //******************************************************************************
|
---|
724 | //******************************************************************************
|
---|
725 | BOOL WIN32API SetWindowTextW( HWND hwnd, LPCWSTR lpsz)
|
---|
726 | {
|
---|
727 | Win32BaseWindow *window;
|
---|
728 |
|
---|
729 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
730 | if(!window) {
|
---|
731 | dprintf(("SetWindowTextA, window %x not found", hwnd));
|
---|
732 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
733 | return 0;
|
---|
734 | }
|
---|
735 | dprintf(("SetWindowTextW %x", hwnd));
|
---|
736 | return window->SetWindowTextW((LPWSTR)lpsz);
|
---|
737 | }
|
---|
738 | /*******************************************************************
|
---|
739 | * InternalGetWindowText (USER32.326)
|
---|
740 | */
|
---|
741 | int WIN32API InternalGetWindowText(HWND hwnd,
|
---|
742 | LPWSTR lpString,
|
---|
743 | INT nMaxCount )
|
---|
744 | {
|
---|
745 | dprintf(("USER32: InternalGetWindowText(%08xh,%08xh,%08xh) not properly implemented.\n",
|
---|
746 | hwnd,
|
---|
747 | lpString,
|
---|
748 | nMaxCount));
|
---|
749 |
|
---|
750 | return GetWindowTextW(hwnd,lpString,nMaxCount);
|
---|
751 | }
|
---|
752 | //******************************************************************************
|
---|
753 | //TODO: Correct?
|
---|
754 | //******************************************************************************
|
---|
755 | BOOL WIN32API SetForegroundWindow(HWND hwnd)
|
---|
756 | {
|
---|
757 | dprintf((" SetForegroundWindow %x", hwnd));
|
---|
758 |
|
---|
759 | return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
|
---|
760 | }
|
---|
761 | //******************************************************************************
|
---|
762 | //******************************************************************************
|
---|
763 | BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
|
---|
764 | {
|
---|
765 | BOOL rc;
|
---|
766 | HWND hwndWin32 = hwnd;
|
---|
767 |
|
---|
768 | Win32BaseWindow *window;
|
---|
769 |
|
---|
770 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
771 | if(!window) {
|
---|
772 | dprintf(("GetClientRect, window %x not found", hwnd));
|
---|
773 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
774 | return 0;
|
---|
775 | }
|
---|
776 | *pRect = *window->getClientRect();
|
---|
777 | OffsetRect(pRect, -pRect->left, -pRect->top);
|
---|
778 | dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
|
---|
779 | return TRUE;
|
---|
780 | }
|
---|
781 | //******************************************************************************
|
---|
782 | //******************************************************************************
|
---|
783 | BOOL WIN32API AdjustWindowRect(PRECT rect, DWORD style, BOOL menu)
|
---|
784 | {
|
---|
785 | return AdjustWindowRectEx(rect, style, menu, 0);
|
---|
786 | }
|
---|
787 | //******************************************************************************
|
---|
788 | //******************************************************************************
|
---|
789 | BOOL WIN32API AdjustWindowRectEx( PRECT rect, DWORD style, BOOL menu, DWORD exStyle)
|
---|
790 | {
|
---|
791 | dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom));
|
---|
792 |
|
---|
793 | /* Correct the window style */
|
---|
794 | if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
|
---|
795 | style |= WS_CAPTION;
|
---|
796 |
|
---|
797 | style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD | WS_VSCROLL | WS_HSCROLL);
|
---|
798 | exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE |
|
---|
799 | WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
|
---|
800 | if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
|
---|
801 |
|
---|
802 | Win32BaseWindow::NC_AdjustRectOuter( rect, style, menu, exStyle );
|
---|
803 | Win32BaseWindow::NC_AdjustRectInner( rect, style, exStyle );
|
---|
804 |
|
---|
805 | dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom));
|
---|
806 | return TRUE;
|
---|
807 | }
|
---|
808 | //******************************************************************************
|
---|
809 | /* Coordinate Space and Transformation Functions */
|
---|
810 | //******************************************************************************
|
---|
811 | int WIN32API MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints,
|
---|
812 | UINT cPoints)
|
---|
813 | {
|
---|
814 | Win32BaseWindow *wndfrom, *wndto;
|
---|
815 | int retval = 0;
|
---|
816 | OSLIBPOINT point;
|
---|
817 |
|
---|
818 | if(lpPoints == NULL || cPoints == 0) {
|
---|
819 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
820 | return 0;
|
---|
821 | }
|
---|
822 | if(hwndFrom)
|
---|
823 | {
|
---|
824 | wndfrom = Win32BaseWindow::GetWindowFromHandle(hwndFrom);
|
---|
825 | if(!wndfrom) {
|
---|
826 | dprintf(("MapWindowPoints, window %x not found", hwndFrom));
|
---|
827 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
828 | return 0;
|
---|
829 | }
|
---|
830 | }
|
---|
831 | else wndfrom = windowDesktop;
|
---|
832 |
|
---|
833 | if(hwndTo)
|
---|
834 | {
|
---|
835 | wndto = Win32BaseWindow::GetWindowFromHandle(hwndTo);
|
---|
836 | if(!wndto) {
|
---|
837 | dprintf(("MapWindowPoints, window %x not found", hwndTo));
|
---|
838 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
839 | return 0;
|
---|
840 | }
|
---|
841 | }
|
---|
842 | else wndto = windowDesktop;
|
---|
843 |
|
---|
844 | if(wndto == wndfrom)
|
---|
845 | return 0; //nothing to do
|
---|
846 |
|
---|
847 | dprintf(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints));
|
---|
848 | point.x = lpPoints->x;
|
---|
849 | point.y = wndfrom->getWindowHeight() - lpPoints->y;
|
---|
850 |
|
---|
851 | OSLibWinMapWindowPoints(wndfrom->getOS2WindowHandle(), wndto->getOS2WindowHandle(), &point, 1);
|
---|
852 | point.y = wndto->getWindowHeight() - point.y;
|
---|
853 |
|
---|
854 | short int xinc = point.x - lpPoints->x;
|
---|
855 | short int yinc = point.y - lpPoints->y;
|
---|
856 |
|
---|
857 | for(int i=0;i<cPoints;i++)
|
---|
858 | {
|
---|
859 | lpPoints[i].x += xinc;
|
---|
860 | lpPoints[i].y += yinc;
|
---|
861 | }
|
---|
862 | retval = ((LONG)yinc << 16) | xinc;
|
---|
863 | return retval;
|
---|
864 | }
|
---|
865 | //******************************************************************************
|
---|
866 | //******************************************************************************
|
---|
867 | BOOL WIN32API ScreenToClient (HWND hwnd, LPPOINT pt)
|
---|
868 | {
|
---|
869 | Win32BaseWindow *wnd;
|
---|
870 | PRECT rcl;
|
---|
871 |
|
---|
872 | dprintf(("ScreenToClient %x (%d,%d)\n", hwnd, pt->x, pt->y));
|
---|
873 |
|
---|
874 | if (!hwnd) return (TRUE);
|
---|
875 | wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
|
---|
876 | if (!wnd) return (TRUE);
|
---|
877 |
|
---|
878 | rcl = wnd->getClientRect();
|
---|
879 | pt->y = ScreenHeight - pt->y;
|
---|
880 | OSLibWinMapWindowPoints (OSLIB_HWND_DESKTOP, wnd->getOS2WindowHandle(), (OSLIBPOINT *)pt, 1);
|
---|
881 | pt->y = (rcl->bottom - rcl->top) - pt->y;
|
---|
882 | dprintf(("ScreenToClient %x returned (%d,%d)\n", hwnd, pt->x, pt->y));
|
---|
883 | return (TRUE);
|
---|
884 | }
|
---|
885 | //******************************************************************************
|
---|
886 | //******************************************************************************
|
---|
887 | HWND WIN32API GetDesktopWindow(void)
|
---|
888 | {
|
---|
889 | HWND DesktopWindow = windowDesktop->getWindowHandle();
|
---|
890 | dprintf(("USER32: GetDesktopWindow, return %d\n", DesktopWindow));
|
---|
891 | return DesktopWindow;
|
---|
892 | }
|
---|
893 | //******************************************************************************
|
---|
894 | //******************************************************************************
|
---|
895 | HWND WIN32API FindWindowA(LPCSTR lpszClass, LPCSTR lpszWindow)
|
---|
896 | {
|
---|
897 | if(!lpszClass) {
|
---|
898 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
899 | return 0;
|
---|
900 | }
|
---|
901 | if(HIWORD(lpszClass)) {
|
---|
902 | dprintf(("USER32: FindWindow %s %s\n", lpszClass, lpszWindow));
|
---|
903 | }
|
---|
904 | else dprintf(("USER32: FindWindow %x %s\n", lpszClass, lpszWindow));
|
---|
905 |
|
---|
906 | return Win32BaseWindow::FindWindowEx(OSLIB_HWND_DESKTOP, 0, (LPSTR)lpszClass, (LPSTR)lpszWindow);
|
---|
907 | }
|
---|
908 | //******************************************************************************
|
---|
909 | //******************************************************************************
|
---|
910 | HWND WIN32API FindWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName)
|
---|
911 | {
|
---|
912 | char *astring1 = UnicodeToAsciiString((LPWSTR)lpClassName);
|
---|
913 | char *astring2 = UnicodeToAsciiString((LPWSTR)lpWindowName);
|
---|
914 | HWND rc;
|
---|
915 |
|
---|
916 | rc = FindWindowA(astring1, astring2);
|
---|
917 | FreeAsciiString(astring1);
|
---|
918 | FreeAsciiString(astring2);
|
---|
919 | return rc;
|
---|
920 | }
|
---|
921 | //******************************************************************************
|
---|
922 | //******************************************************************************
|
---|
923 | HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
|
---|
924 | {
|
---|
925 | if(!lpszClass) {
|
---|
926 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
927 | return 0;
|
---|
928 | }
|
---|
929 | if(HIWORD(lpszClass)) {
|
---|
930 | dprintf(("USER32: FindWindowExA (%x,%x) %s %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
|
---|
931 | }
|
---|
932 | else dprintf(("USER32: FindWindowExA (%x,%x)%x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
|
---|
933 |
|
---|
934 | return Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
|
---|
935 | }
|
---|
936 | /*****************************************************************************
|
---|
937 | * Name : HWND WIN32API FindWindowExW
|
---|
938 | * Purpose : The FindWindowEx function retrieves the handle of a window whose
|
---|
939 | * class name and window name match the specified strings. The
|
---|
940 | * function searches child windows, beginning with the one following
|
---|
941 | * the given child window.
|
---|
942 | * Parameters: HWND hwndParent handle of parent window
|
---|
943 | * HWND hwndChildAfter handle of a child window
|
---|
944 | * LPCTSTR lpszClass address of class name
|
---|
945 | * LPCTSTR lpszWindow address of window name
|
---|
946 | * Variables :
|
---|
947 | * Result : If the function succeeds, the return value is the handle of the
|
---|
948 | * window that has the specified class and window names.
|
---|
949 | * If the function fails, the return value is NULL. To get extended
|
---|
950 | * error information, call GetLastError.
|
---|
951 | * Remark :
|
---|
952 | * Status : UNTESTED STUB
|
---|
953 | *
|
---|
954 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
---|
955 | *****************************************************************************/
|
---|
956 |
|
---|
957 | HWND WIN32API FindWindowExW(HWND hwndParent,
|
---|
958 | HWND hwndChildAfter,
|
---|
959 | LPCWSTR lpszClass,
|
---|
960 | LPCWSTR lpszWindow)
|
---|
961 | {
|
---|
962 | if(!lpszClass) {
|
---|
963 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
964 | return 0;
|
---|
965 | }
|
---|
966 | dprintf(("USER32: FindWindowExW (%x,%x) %x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
|
---|
967 |
|
---|
968 | return Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
|
---|
969 | }
|
---|
970 | //******************************************************************************
|
---|
971 | //******************************************************************************
|
---|
972 | BOOL WIN32API FlashWindow(HWND hwnd, BOOL fFlash)
|
---|
973 | {
|
---|
974 | dprintf(("FlashWindow %x %d\n", hwnd, fFlash));
|
---|
975 | return OSLibWinFlashWindow(Win32BaseWindow::Win32ToOS2Handle(hwnd), fFlash);
|
---|
976 | }
|
---|
977 | //******************************************************************************
|
---|
978 | //******************************************************************************
|
---|
979 | BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
|
---|
980 | BOOL repaint )
|
---|
981 | {
|
---|
982 | int flags = SWP_NOZORDER | SWP_NOACTIVATE;
|
---|
983 |
|
---|
984 | if (!repaint) flags |= SWP_NOREDRAW;
|
---|
985 | dprintf(("MoveWindow: %x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
|
---|
986 |
|
---|
987 | return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
|
---|
988 | }
|
---|
989 | //******************************************************************************
|
---|
990 | //******************************************************************************
|
---|
991 | BOOL WIN32API ClientToScreen (HWND hwnd, PPOINT pt)
|
---|
992 | {
|
---|
993 | Win32BaseWindow *wnd;
|
---|
994 | PRECT rcl;
|
---|
995 |
|
---|
996 | dprintf(("ClientToScreen (%d,%d)\n", pt->x, pt->y));
|
---|
997 | if (!hwnd) {
|
---|
998 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
999 | return (FALSE);
|
---|
1000 | }
|
---|
1001 | wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
|
---|
1002 | if (!wnd) {
|
---|
1003 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1004 | return (FALSE);
|
---|
1005 | }
|
---|
1006 |
|
---|
1007 | rcl = wnd->getClientRect();
|
---|
1008 | pt->y = (rcl->bottom - rcl->top) - pt->y;
|
---|
1009 | OSLibWinMapWindowPoints (wnd->getOS2WindowHandle(), OSLIB_HWND_DESKTOP, (OSLIBPOINT *)pt, 1);
|
---|
1010 | pt->y = ScreenHeight - pt->y;
|
---|
1011 | dprintf(("ClientToScreen returned (%d,%d)\n", pt->x, pt->y));
|
---|
1012 | return (TRUE);
|
---|
1013 | }
|
---|
1014 | //******************************************************************************
|
---|
1015 | //******************************************************************************
|
---|
1016 | HDWP WIN32API BeginDeferWindowPos(int count)
|
---|
1017 | {
|
---|
1018 | HDWP handle;
|
---|
1019 | DWP *pDWP;
|
---|
1020 |
|
---|
1021 | dprintf(("USER32: BeginDeferWindowPos\n"));
|
---|
1022 | if (count <= 0)
|
---|
1023 | {
|
---|
1024 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1025 | return 0;
|
---|
1026 | }
|
---|
1027 | handle = (HDWP)HeapAlloc(GetProcessHeap(), 0, sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
|
---|
1028 | if (!handle)
|
---|
1029 | return 0;
|
---|
1030 |
|
---|
1031 | pDWP = (DWP *) handle;
|
---|
1032 | pDWP->actualCount = 0;
|
---|
1033 | pDWP->suggestedCount = count;
|
---|
1034 | pDWP->valid = TRUE;
|
---|
1035 | pDWP->wMagic = DWP_MAGIC;
|
---|
1036 | pDWP->hwndParent = 0;
|
---|
1037 | return handle;
|
---|
1038 | }
|
---|
1039 | /***********************************************************************
|
---|
1040 | * DeferWindowPos (USER32.128)
|
---|
1041 | */
|
---|
1042 | HDWP WIN32API DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
|
---|
1043 | INT x, INT y, INT cx, INT cy,
|
---|
1044 | UINT flags )
|
---|
1045 | {
|
---|
1046 | DWP *pDWP;
|
---|
1047 | int i;
|
---|
1048 | HDWP newhdwp = hdwp,retvalue;
|
---|
1049 | Win32BaseWindow *window;
|
---|
1050 |
|
---|
1051 | pDWP = (DWP *)hdwp;
|
---|
1052 | if (!pDWP) {
|
---|
1053 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1054 | return 0;
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 | if (hwnd == GetDesktopWindow())
|
---|
1058 | return 0;
|
---|
1059 |
|
---|
1060 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1061 | if(!window) {
|
---|
1062 | dprintf(("DeferWindowPos, window %x not found", hwnd));
|
---|
1063 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1064 | HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
|
---|
1065 | return 0;
|
---|
1066 | }
|
---|
1067 |
|
---|
1068 |
|
---|
1069 | /* Numega Bounds Checker Demo dislikes the following code.
|
---|
1070 | In fact, I've not been able to find any "same parent" requirement in any docu
|
---|
1071 | [AM 980509]
|
---|
1072 | */
|
---|
1073 | #if 0
|
---|
1074 | /* All the windows of a DeferWindowPos() must have the same parent */
|
---|
1075 | parent = pWnd->parent->hwndSelf;
|
---|
1076 | if (pDWP->actualCount == 0) pDWP->hwndParent = parent;
|
---|
1077 | else if (parent != pDWP->hwndParent)
|
---|
1078 | {
|
---|
1079 | USER_HEAP_FREE( hdwp );
|
---|
1080 | retvalue = 0;
|
---|
1081 | goto END;
|
---|
1082 | }
|
---|
1083 | #endif
|
---|
1084 |
|
---|
1085 | for (i = 0; i < pDWP->actualCount; i++)
|
---|
1086 | {
|
---|
1087 | if (pDWP->winPos[i].hwnd == hwnd)
|
---|
1088 | {
|
---|
1089 | /* Merge with the other changes */
|
---|
1090 | if (!(flags & SWP_NOZORDER))
|
---|
1091 | {
|
---|
1092 | pDWP->winPos[i].hwndInsertAfter = hwndAfter;
|
---|
1093 | }
|
---|
1094 | if (!(flags & SWP_NOMOVE))
|
---|
1095 | {
|
---|
1096 | pDWP->winPos[i].x = x;
|
---|
1097 | pDWP->winPos[i].y = y;
|
---|
1098 | }
|
---|
1099 | if (!(flags & SWP_NOSIZE))
|
---|
1100 | {
|
---|
1101 | pDWP->winPos[i].cx = cx;
|
---|
1102 | pDWP->winPos[i].cy = cy;
|
---|
1103 | }
|
---|
1104 | pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
|
---|
1105 | SWP_NOZORDER | SWP_NOREDRAW |
|
---|
1106 | SWP_NOACTIVATE | SWP_NOCOPYBITS|
|
---|
1107 | SWP_NOOWNERZORDER);
|
---|
1108 | pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
|
---|
1109 | SWP_FRAMECHANGED);
|
---|
1110 | retvalue = hdwp;
|
---|
1111 | goto END;
|
---|
1112 | }
|
---|
1113 | }
|
---|
1114 | if (pDWP->actualCount >= pDWP->suggestedCount)
|
---|
1115 | {
|
---|
1116 | newhdwp = (HDWP)HeapReAlloc(GetProcessHeap(), 0, (LPVOID)hdwp,
|
---|
1117 | sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS));
|
---|
1118 | if (!newhdwp)
|
---|
1119 | {
|
---|
1120 | retvalue = 0;
|
---|
1121 | goto END;
|
---|
1122 | }
|
---|
1123 | pDWP = (DWP *) newhdwp;
|
---|
1124 | pDWP->suggestedCount++;
|
---|
1125 | }
|
---|
1126 | pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
|
---|
1127 | pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
|
---|
1128 | pDWP->winPos[pDWP->actualCount].x = x;
|
---|
1129 | pDWP->winPos[pDWP->actualCount].y = y;
|
---|
1130 | pDWP->winPos[pDWP->actualCount].cx = cx;
|
---|
1131 | pDWP->winPos[pDWP->actualCount].cy = cy;
|
---|
1132 | pDWP->winPos[pDWP->actualCount].flags = flags;
|
---|
1133 | pDWP->actualCount++;
|
---|
1134 | retvalue = newhdwp;
|
---|
1135 | END:
|
---|
1136 | return retvalue;
|
---|
1137 | }
|
---|
1138 | //******************************************************************************
|
---|
1139 | //******************************************************************************
|
---|
1140 | BOOL WIN32API EndDeferWindowPos( HDWP hdwp)
|
---|
1141 | {
|
---|
1142 | DWP *pDWP;
|
---|
1143 | WINDOWPOS *winpos;
|
---|
1144 | BOOL res = TRUE;
|
---|
1145 | int i;
|
---|
1146 |
|
---|
1147 | pDWP = (DWP *) hdwp;
|
---|
1148 | if (!pDWP) {
|
---|
1149 | dprintf(("**EndDeferWindowPos invalid parameter\n"));
|
---|
1150 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1151 | return FALSE;
|
---|
1152 | }
|
---|
1153 | dprintf(("**EndDeferWindowPos for %d windows", pDWP->actualCount));
|
---|
1154 | for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
|
---|
1155 | {
|
---|
1156 | dprintf(("**EndDeferWindowPos %x (%d,%d) (%d,%d) %x", winpos->hwnd, winpos->x, winpos->y, winpos->x, winpos->cy, winpos->flags));
|
---|
1157 | if (!(res = SetWindowPos(winpos->hwnd, winpos->hwndInsertAfter,
|
---|
1158 | winpos->x, winpos->y, winpos->cx,
|
---|
1159 | winpos->cy, winpos->flags )))
|
---|
1160 | break;
|
---|
1161 | }
|
---|
1162 | dprintf(("**EndDeferWindowPos DONE"));
|
---|
1163 | HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
|
---|
1164 | return res;
|
---|
1165 | }
|
---|
1166 | //******************************************************************************
|
---|
1167 | //******************************************************************************
|
---|
1168 | HWND WIN32API ChildWindowFromPoint( HWND hwnd, POINT pt)
|
---|
1169 | {
|
---|
1170 | dprintf(("USER32: ChildWindowFromPoint\n"));
|
---|
1171 | return ChildWindowFromPointEx(hwnd, pt, 0);
|
---|
1172 | }
|
---|
1173 | /*****************************************************************************
|
---|
1174 | * Name : HWND WIN32API ChildWindowFromPointEx
|
---|
1175 | * Purpose : pt: client coordinates
|
---|
1176 | * Parameters:
|
---|
1177 | * Variables :
|
---|
1178 | * Result : If the function succeeds, the return value is the window handle.
|
---|
1179 | * If the function fails, the return value is zero
|
---|
1180 | * Remark :
|
---|
1181 | * Status : FULLY IMPLEMENTED AND TESTED
|
---|
1182 | *
|
---|
1183 | * Author : Rene Pronk [Sun, 1999/08/08 23:30]
|
---|
1184 | *****************************************************************************/
|
---|
1185 | HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
|
---|
1186 | {
|
---|
1187 | RECT rect;
|
---|
1188 | HWND hWnd;
|
---|
1189 |
|
---|
1190 | dprintf(("ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
|
---|
1191 | hwndParent, pt, uFlags));
|
---|
1192 |
|
---|
1193 | if (GetWindowRect (hwndParent, &rect) == 0) {
|
---|
1194 | // oops, invalid handle
|
---|
1195 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1196 | return NULL;
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 | ClientToScreen(hwndParent, &pt);
|
---|
1200 | if (PtInRect (&rect, pt) == 0) {
|
---|
1201 | // point is outside window
|
---|
1202 | return NULL;
|
---|
1203 | }
|
---|
1204 |
|
---|
1205 |
|
---|
1206 | // get first child
|
---|
1207 | hWnd = GetWindow (hwndParent, GW_CHILD);
|
---|
1208 |
|
---|
1209 | while (hWnd != NULL) {
|
---|
1210 |
|
---|
1211 | // do I need to skip this window?
|
---|
1212 | if (((uFlags & CWP_SKIPINVISIBLE) &&
|
---|
1213 | (IsWindowVisible (hWnd) == FALSE)) ||
|
---|
1214 | ((uFlags & CWP_SKIPDISABLED) &&
|
---|
1215 | (IsWindowEnabled (hWnd) == FALSE)) ||
|
---|
1216 | ((uFlags & CWP_SKIPTRANSPARENT) &&
|
---|
1217 | (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
|
---|
1218 |
|
---|
1219 | {
|
---|
1220 | hWnd = GetWindow (hWnd, GW_HWNDNEXT);
|
---|
1221 | continue;
|
---|
1222 | }
|
---|
1223 |
|
---|
1224 | // is the point in this window's rect?
|
---|
1225 | GetWindowRect (hWnd, &rect);
|
---|
1226 | if (PtInRect (&rect,pt) == FALSE) {
|
---|
1227 | hWnd = GetWindow (hWnd, GW_HWNDNEXT);
|
---|
1228 | continue;
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | dprintf(("ChildWindowFromPointEx returned %x", hWnd));
|
---|
1232 | // found it!
|
---|
1233 | return hWnd;
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | // the point is in the parentwindow but the parentwindow has no child
|
---|
1237 | // at this coordinate
|
---|
1238 | dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
|
---|
1239 | return hwndParent;
|
---|
1240 | }
|
---|
1241 | //******************************************************************************
|
---|
1242 | //******************************************************************************
|
---|
1243 | BOOL WIN32API CloseWindow(HWND hwnd)
|
---|
1244 | {
|
---|
1245 | Win32BaseWindow *window;
|
---|
1246 |
|
---|
1247 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1248 | if(!window) {
|
---|
1249 | dprintf(("CloseWindow, window %x not found", hwnd));
|
---|
1250 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1251 | return 0;
|
---|
1252 | }
|
---|
1253 | dprintf(("CloseWindow %x\n", hwnd));
|
---|
1254 | return window->CloseWindow();
|
---|
1255 | }
|
---|
1256 | //******************************************************************************
|
---|
1257 | //TODO: Does this return handles of hidden or disabled windows?
|
---|
1258 | //******************************************************************************
|
---|
1259 | HWND WIN32API WindowFromPoint( POINT point)
|
---|
1260 | {
|
---|
1261 | HWND hwndOS2, hwnd;
|
---|
1262 | POINT wPoint;
|
---|
1263 |
|
---|
1264 | wPoint.x = point.x;
|
---|
1265 | wPoint.y = windowDesktop->getWindowHeight() - point.y;
|
---|
1266 |
|
---|
1267 | hwndOS2 = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&wPoint);
|
---|
1268 | if(hwndOS2)
|
---|
1269 | {
|
---|
1270 | hwnd = Win32BaseWindow::OS2ToWin32Handle(hwndOS2);
|
---|
1271 | if (!hwnd)
|
---|
1272 | {
|
---|
1273 | //CB: could be a frame control
|
---|
1274 | hwndOS2 = OSLibWinQueryWindow(hwndOS2,QWOS_PARENT);
|
---|
1275 | hwnd = Win32BaseWindow::OS2ToWin32Handle(hwndOS2);
|
---|
1276 | }
|
---|
1277 | if(hwnd) {
|
---|
1278 | dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
|
---|
1279 | return hwnd;
|
---|
1280 | }
|
---|
1281 | }
|
---|
1282 | dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2));
|
---|
1283 | return windowDesktop->getWindowHandle();
|
---|
1284 | }
|
---|
1285 | //******************************************************************************
|
---|
1286 | //******************************************************************************
|
---|
1287 | BOOL WIN32API IsWindowUnicode(HWND hwnd)
|
---|
1288 | {
|
---|
1289 | Win32BaseWindow *window;
|
---|
1290 |
|
---|
1291 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1292 | if(!window) {
|
---|
1293 | dprintf(("IsWindowUnicode, window %x not found", hwnd));
|
---|
1294 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1295 | return 0;
|
---|
1296 | }
|
---|
1297 | return window->IsWindowUnicode();
|
---|
1298 | }
|
---|
1299 | /***********************************************************************
|
---|
1300 | * SwitchToThisWindow (USER32.539)
|
---|
1301 | */
|
---|
1302 | DWORD WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
|
---|
1303 | {
|
---|
1304 | return ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
|
---|
1305 | }
|
---|
1306 | //******************************************************************************
|
---|
1307 | //******************************************************************************
|
---|
1308 | BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
|
---|
1309 | {
|
---|
1310 | return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam);
|
---|
1311 | }
|
---|
1312 | //******************************************************************************
|
---|
1313 | //******************************************************************************
|
---|
1314 | BOOL WIN32API EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LPARAM lParam)
|
---|
1315 | {
|
---|
1316 | Win32BaseWindow *window;
|
---|
1317 | BOOL rc = TRUE;
|
---|
1318 | ULONG henum;
|
---|
1319 | HWND hwndNext;
|
---|
1320 |
|
---|
1321 | if(lpfn == NULL) {
|
---|
1322 | dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam));
|
---|
1323 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1324 | return FALSE;
|
---|
1325 | }
|
---|
1326 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1327 | if(!window) {
|
---|
1328 | dprintf(("EnumChildWindows, window %x not found", hwnd));
|
---|
1329 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1330 | return FALSE;
|
---|
1331 | }
|
---|
1332 | return window->EnumChildWindows(lpfn, lParam);
|
---|
1333 | }
|
---|
1334 | //******************************************************************************
|
---|
1335 | //******************************************************************************
|
---|
1336 | BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
|
---|
1337 | {
|
---|
1338 | return windowDesktop->EnumWindows(lpfn, lParam);
|
---|
1339 | }
|
---|
1340 | //******************************************************************************
|
---|
1341 | //******************************************************************************
|
---|
1342 | UINT WIN32API ArrangeIconicWindows( HWND hwnd)
|
---|
1343 | {
|
---|
1344 | dprintf(("USER32: ArrangeIconicWindows %x", hwnd));
|
---|
1345 | return O32_ArrangeIconicWindows(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd));
|
---|
1346 | }
|
---|
1347 | //******************************************************************************
|
---|
1348 | //restores iconized window to previous size/position
|
---|
1349 | //******************************************************************************
|
---|
1350 | BOOL WIN32API OpenIcon(HWND hwnd)
|
---|
1351 | {
|
---|
1352 | dprintf(("USER32: OpenIcon"));
|
---|
1353 |
|
---|
1354 | if(!IsIconic(hwnd))
|
---|
1355 | return FALSE;
|
---|
1356 | ShowWindow(hwnd, SW_SHOWNORMAL);
|
---|
1357 | return TRUE;
|
---|
1358 | }
|
---|
1359 | //******************************************************************************
|
---|
1360 | //******************************************************************************
|
---|
1361 | BOOL WIN32API ShowOwnedPopups( HWND hwnd, BOOL arg2)
|
---|
1362 | {
|
---|
1363 | dprintf(("USER32: ShowOwnedPopups %x", hwnd));
|
---|
1364 | return O32_ShowOwnedPopups(Win32BaseWindow::Win32ToOS2FrameHandle(hwnd), arg2);
|
---|
1365 | }
|
---|
1366 | //******************************************************************************
|
---|
1367 | //******************************************************************************
|
---|
1368 | HWND WIN32API GetForegroundWindow(void)
|
---|
1369 | {
|
---|
1370 | dprintf(("USER32: GetForegroundWindow"));
|
---|
1371 | return Win32BaseWindow::OS2ToWin32Handle(O32_GetForegroundWindow());
|
---|
1372 | }
|
---|
1373 | //******************************************************************************
|
---|
1374 | //******************************************************************************
|
---|
1375 | HWND WIN32API GetLastActivePopup( HWND hWnd)
|
---|
1376 | {
|
---|
1377 | HWND hwnd;
|
---|
1378 |
|
---|
1379 | hWnd = Win32BaseWindow::Win32ToOS2Handle(hWnd);
|
---|
1380 |
|
---|
1381 | hwnd = Win32BaseWindow::OS2ToWin32Handle(O32_GetLastActivePopup(hWnd));
|
---|
1382 |
|
---|
1383 | dprintf(("GetLastActivePopup %x returned %x", hWnd, hwnd));
|
---|
1384 | return hwnd;
|
---|
1385 | }
|
---|
1386 | //******************************************************************************
|
---|
1387 | //******************************************************************************
|
---|
1388 | DWORD WIN32API GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
|
---|
1389 | {
|
---|
1390 | dprintf2(("USER32: GetWindowThreadProcessId"));
|
---|
1391 | hWnd = Win32BaseWindow::Win32ToOS2Handle(hWnd);
|
---|
1392 |
|
---|
1393 | return O32_GetWindowThreadProcessId(hWnd,lpdwProcessId);
|
---|
1394 | }
|
---|
1395 | //******************************************************************************
|
---|
1396 | //******************************************************************************
|
---|
1397 | DWORD WIN32API GetWindowContextHelpId(HWND hwnd)
|
---|
1398 | {
|
---|
1399 | Win32BaseWindow *window;
|
---|
1400 |
|
---|
1401 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1402 | if(!window) {
|
---|
1403 | dprintf(("GetWindowContextHelpId, window %x not found", hwnd));
|
---|
1404 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1405 | return 0;
|
---|
1406 | }
|
---|
1407 | dprintf(("GetWindowContextHelpId %x", hwnd));
|
---|
1408 | return window->getWindowContextHelpId();
|
---|
1409 | }
|
---|
1410 | //******************************************************************************
|
---|
1411 | //******************************************************************************
|
---|
1412 | BOOL WIN32API SetWindowContextHelpId(HWND hwnd, DWORD dwContextHelpId)
|
---|
1413 | {
|
---|
1414 | Win32BaseWindow *window;
|
---|
1415 |
|
---|
1416 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1417 | if(!window) {
|
---|
1418 | dprintf(("SetWindowContextHelpId, window %x not found", hwnd));
|
---|
1419 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
1420 | return 0;
|
---|
1421 | }
|
---|
1422 | dprintf(("SetWindowContextHelpId %x %d", hwnd, dwContextHelpId));
|
---|
1423 | window->setWindowContextHelpId(dwContextHelpId);
|
---|
1424 | return(TRUE);
|
---|
1425 | }
|
---|
1426 | //******************************************************************************
|
---|
1427 | //******************************************************************************
|
---|