1 | /* $Id: oslibwin.cpp,v 1.66 2000-02-05 14:08:53 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Window API wrappers for OS/2
|
---|
4 | *
|
---|
5 | *
|
---|
6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
---|
8 | *
|
---|
9 | *
|
---|
10 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
11 | *
|
---|
12 | */
|
---|
13 | #define INCL_WIN
|
---|
14 | #define INCL_PM
|
---|
15 | #include <os2.h>
|
---|
16 | #include <os2wrap.h>
|
---|
17 | #include <stdlib.h>
|
---|
18 | #include <string.h>
|
---|
19 |
|
---|
20 | #include <misc.h>
|
---|
21 | #include "win32type.h"
|
---|
22 | #include <winconst.h>
|
---|
23 | #include "oslibwin.h"
|
---|
24 | #include "oslibutil.h"
|
---|
25 | #include "oslibmsg.h"
|
---|
26 | #include "oslibgdi.h"
|
---|
27 | #include "pmwindow.h"
|
---|
28 |
|
---|
29 | //******************************************************************************
|
---|
30 | //******************************************************************************
|
---|
31 | BOOL OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw)
|
---|
32 | {
|
---|
33 | if(hwndParent == OSLIB_HWND_DESKTOP)
|
---|
34 | {
|
---|
35 | hwndParent = HWND_DESKTOP;
|
---|
36 | }
|
---|
37 | else
|
---|
38 | if(hwndParent == OSLIB_HWND_OBJECT) {
|
---|
39 | hwndParent = HWND_OBJECT;
|
---|
40 | }
|
---|
41 | return (WinSetParent(hwnd, hwndParent, fRedraw) == 0);
|
---|
42 | }
|
---|
43 | //******************************************************************************
|
---|
44 | //******************************************************************************
|
---|
45 | BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
|
---|
46 | {
|
---|
47 | return WinSetOwner(hwnd, hwndOwner);
|
---|
48 | }
|
---|
49 | //******************************************************************************
|
---|
50 | //******************************************************************************
|
---|
51 | HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle,
|
---|
52 | char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
|
---|
53 | ULONG id, BOOL fTaskList,BOOL saveBits)
|
---|
54 | {
|
---|
55 | HWND hwndClient;
|
---|
56 |
|
---|
57 | dprintf(("WinCreateWindow %x %s", hwndParent, pszName));
|
---|
58 |
|
---|
59 | if(pszName && *pszName == 0) {
|
---|
60 | pszName = NULL;
|
---|
61 | }
|
---|
62 | if(hwndParent == OSLIB_HWND_DESKTOP) {
|
---|
63 | hwndParent = HWND_DESKTOP;
|
---|
64 | }
|
---|
65 | if(Owner == OSLIB_HWND_DESKTOP) {
|
---|
66 | Owner = HWND_DESKTOP;
|
---|
67 | }
|
---|
68 | ULONG dwClientStyle = 0;
|
---|
69 | ULONG dwFrameStyle = 0;
|
---|
70 |
|
---|
71 | BOOL TopLevel = hwndParent == HWND_DESKTOP;
|
---|
72 |
|
---|
73 | FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
|
---|
74 |
|
---|
75 | dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS);
|
---|
76 | if (saveBits) dwWinStyle |= WS_SAVEBITS;
|
---|
77 |
|
---|
78 | dwFrameStyle |= FCF_NOBYTEALIGN;
|
---|
79 | if(fTaskList)
|
---|
80 | {
|
---|
81 | dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
|
---|
82 | }
|
---|
83 |
|
---|
84 | dwWinStyle &= ~WS_CLIPCHILDREN;
|
---|
85 | FCData.flCreateFlags = dwFrameStyle;
|
---|
86 |
|
---|
87 | *hwndFrame = WinCreateWindow (hwndParent,
|
---|
88 | TopLevel ? WC_FRAME : WIN32_INNERFRAME,
|
---|
89 | pszName, dwWinStyle, 0, 0, 0, 0,
|
---|
90 | hwndParent, HWND_TOP,
|
---|
91 | id, &FCData, NULL);
|
---|
92 |
|
---|
93 | if (*hwndFrame) {
|
---|
94 | hwndClient = WinCreateWindow (*hwndFrame,saveBits ? WIN32_STDCLASS2:WIN32_STDCLASS,
|
---|
95 | NULL, dwClientStyle, 0, 0, 0, 0,
|
---|
96 | *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
|
---|
97 | return hwndClient;
|
---|
98 | }
|
---|
99 | dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
|
---|
100 | return 0;
|
---|
101 | }
|
---|
102 | //******************************************************************************
|
---|
103 | //******************************************************************************
|
---|
104 | BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle)
|
---|
105 | {
|
---|
106 | *OSWinStyle = 0;
|
---|
107 |
|
---|
108 | /* Window styles */
|
---|
109 | if(dwStyle & WS_MINIMIZE_W)
|
---|
110 | *OSWinStyle |= WS_MINIMIZED;
|
---|
111 | //Done explicitely in CreateWindowExA
|
---|
112 | #if 0
|
---|
113 | if(dwStyle & WS_VISIBLE_W)
|
---|
114 | *OSWinStyle |= WS_VISIBLE;
|
---|
115 | #endif
|
---|
116 | if(dwStyle & WS_DISABLED_W)
|
---|
117 | *OSWinStyle |= WS_DISABLED;
|
---|
118 | if(dwStyle & WS_CLIPSIBLINGS_W)
|
---|
119 | *OSWinStyle |= WS_CLIPSIBLINGS;
|
---|
120 | if(dwStyle & WS_CLIPCHILDREN_W)
|
---|
121 | *OSWinStyle |= WS_CLIPCHILDREN;
|
---|
122 | if(dwStyle & WS_MAXIMIZE_W)
|
---|
123 | *OSWinStyle |= WS_MAXIMIZED;
|
---|
124 | if(dwStyle & WS_GROUP_W)
|
---|
125 | *OSWinStyle |= WS_GROUP;
|
---|
126 | if(dwStyle & WS_TABSTOP_W)
|
---|
127 | *OSWinStyle |= WS_TABSTOP;
|
---|
128 |
|
---|
129 | return TRUE;
|
---|
130 | }
|
---|
131 | //******************************************************************************
|
---|
132 | //******************************************************************************
|
---|
133 | BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
|
---|
134 | {
|
---|
135 | if(offset == OSLIB_QWL_USER)
|
---|
136 | offset = QWL_USER;
|
---|
137 |
|
---|
138 | return WinSetWindowULong(hwnd, offset, value);
|
---|
139 | }
|
---|
140 | //******************************************************************************
|
---|
141 | //******************************************************************************
|
---|
142 | ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
|
---|
143 | {
|
---|
144 | if(offset == OSLIB_QWL_USER)
|
---|
145 | offset = QWL_USER;
|
---|
146 |
|
---|
147 | return WinQueryWindowULong(hwnd, offset);
|
---|
148 | }
|
---|
149 | //******************************************************************************
|
---|
150 | //******************************************************************************
|
---|
151 | BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
|
---|
152 | {
|
---|
153 | return WinAlarm(hwndDeskTop,flStyle);
|
---|
154 | }
|
---|
155 | //******************************************************************************
|
---|
156 | //******************************************************************************
|
---|
157 | APIRET OSLibDosBeep(ULONG freg,ULONG dur)
|
---|
158 | {
|
---|
159 | return DosBeep(freg,dur);
|
---|
160 | }
|
---|
161 | //******************************************************************************
|
---|
162 | //******************************************************************************
|
---|
163 | HWND OSLibWinQueryFocus(HWND hwndDeskTop)
|
---|
164 | {
|
---|
165 | return WinQueryFocus(hwndDeskTop);
|
---|
166 | }
|
---|
167 | //******************************************************************************
|
---|
168 | //******************************************************************************
|
---|
169 | HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
|
---|
170 | {
|
---|
171 | return WinWindowFromID(hwndParent,id);
|
---|
172 | }
|
---|
173 | //******************************************************************************
|
---|
174 | //******************************************************************************
|
---|
175 | BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate)
|
---|
176 | {
|
---|
177 | return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? FC_NOLOSEACTIVE : 0);
|
---|
178 | }
|
---|
179 | //******************************************************************************
|
---|
180 | //******************************************************************************
|
---|
181 | BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf)
|
---|
182 | {
|
---|
183 | return WinIsChild (hwnd, hwndOf);
|
---|
184 | }
|
---|
185 | //******************************************************************************
|
---|
186 | //******************************************************************************
|
---|
187 | ULONG OSLibGetWindowHeight(HWND hwnd)
|
---|
188 | {
|
---|
189 | RECTL rect;
|
---|
190 |
|
---|
191 | return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
|
---|
192 | }
|
---|
193 | //******************************************************************************
|
---|
194 | //******************************************************************************
|
---|
195 | LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
|
---|
196 | {
|
---|
197 | return WinQuerySysValue(hwndDeskTop,iSysValue);
|
---|
198 | }
|
---|
199 | //******************************************************************************
|
---|
200 | //******************************************************************************
|
---|
201 | ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
|
---|
202 | {
|
---|
203 | return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
|
---|
204 | }
|
---|
205 | //******************************************************************************
|
---|
206 | //******************************************************************************
|
---|
207 | BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
|
---|
208 | {
|
---|
209 | return WinSetDlgItemText(hwndDlg,idItem,pszText);
|
---|
210 | }
|
---|
211 | //******************************************************************************
|
---|
212 | //******************************************************************************
|
---|
213 | BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
|
---|
214 | {
|
---|
215 | return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
|
---|
216 | }
|
---|
217 | //******************************************************************************
|
---|
218 | //******************************************************************************
|
---|
219 | HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode)
|
---|
220 | {
|
---|
221 | return WinQueryWindow(hwnd, lCode);
|
---|
222 | }
|
---|
223 | //******************************************************************************
|
---|
224 | //******************************************************************************
|
---|
225 | BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
|
---|
226 | {
|
---|
227 | return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
|
---|
228 | }
|
---|
229 | //******************************************************************************
|
---|
230 | //******************************************************************************
|
---|
231 | BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
|
---|
232 | {
|
---|
233 | BOOL rc = 1;
|
---|
234 |
|
---|
235 | if(fl & SWP_SHOW) {
|
---|
236 | rc = WinShowWindow(hwnd, TRUE);
|
---|
237 | }
|
---|
238 | if(rc == 0)
|
---|
239 | dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
|
---|
240 | rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
|
---|
241 | if(rc == 0)
|
---|
242 | dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
|
---|
243 | return rc;
|
---|
244 | }
|
---|
245 | //******************************************************************************
|
---|
246 | //******************************************************************************
|
---|
247 | BOOL OSLibWinDestroyWindow(HWND hwnd)
|
---|
248 | {
|
---|
249 | return WinDestroyWindow(hwnd);
|
---|
250 | }
|
---|
251 | //******************************************************************************
|
---|
252 | //******************************************************************************
|
---|
253 | BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
|
---|
254 | {
|
---|
255 | BOOL rc;
|
---|
256 | RECTLOS2 rectl;
|
---|
257 |
|
---|
258 | rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
|
---|
259 | if(rc) {
|
---|
260 | if(RelativeTo == RELATIVE_TO_SCREEN) {
|
---|
261 | mapOS2ToWin32Rect(hwnd,OSLIB_HWND_DESKTOP,&rectl,pRect);
|
---|
262 | }
|
---|
263 | else mapOS2ToWin32Rect(hwnd,&rectl,pRect);
|
---|
264 | }
|
---|
265 | else memset(pRect, 0, sizeof(RECT));
|
---|
266 | return rc;
|
---|
267 | }
|
---|
268 | //******************************************************************************
|
---|
269 | //******************************************************************************
|
---|
270 | BOOL OSLibWinIsIconic(HWND hwnd)
|
---|
271 | {
|
---|
272 | SWP swp;
|
---|
273 | BOOL rc;
|
---|
274 |
|
---|
275 | rc = WinQueryWindowPos(hwnd, &swp);
|
---|
276 | if(rc == FALSE) {
|
---|
277 | dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
|
---|
278 | return FALSE;
|
---|
279 | }
|
---|
280 |
|
---|
281 | if(swp.fl & SWP_MINIMIZE)
|
---|
282 | return TRUE;
|
---|
283 | else return FALSE;
|
---|
284 | }
|
---|
285 | //******************************************************************************
|
---|
286 | //******************************************************************************
|
---|
287 | BOOL OSLibWinSetActiveWindow(HWND hwnd)
|
---|
288 | {
|
---|
289 | return WinSetActiveWindow(HWND_DESKTOP, hwnd);
|
---|
290 | }
|
---|
291 | //******************************************************************************
|
---|
292 | //******************************************************************************
|
---|
293 | BOOL OSLibWinSetFocus(HWND hwnd)
|
---|
294 | {
|
---|
295 | return WinSetFocus(HWND_DESKTOP, hwnd);
|
---|
296 | }
|
---|
297 | //******************************************************************************
|
---|
298 | //******************************************************************************
|
---|
299 | BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable)
|
---|
300 | {
|
---|
301 | BOOL rc;
|
---|
302 | HWND hwndClient;
|
---|
303 |
|
---|
304 | rc = WinEnableWindow(hwnd, fEnable);
|
---|
305 | hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
|
---|
306 | if(hwndClient) {
|
---|
307 | WinEnableWindow(hwndClient, fEnable);
|
---|
308 | }
|
---|
309 | return rc;
|
---|
310 | }
|
---|
311 | //******************************************************************************
|
---|
312 | //******************************************************************************
|
---|
313 | BOOL OSLibWinIsWindowEnabled(HWND hwnd)
|
---|
314 | {
|
---|
315 | return WinIsWindowEnabled(hwnd);
|
---|
316 | }
|
---|
317 | //******************************************************************************
|
---|
318 | //******************************************************************************
|
---|
319 | BOOL OSLibWinIsWindowVisible(HWND hwnd)
|
---|
320 | {
|
---|
321 | return WinIsWindowVisible(hwnd);
|
---|
322 | }
|
---|
323 | //******************************************************************************
|
---|
324 | //******************************************************************************
|
---|
325 | BOOL OSLibWinQueryActiveWindow()
|
---|
326 | {
|
---|
327 | return WinQueryActiveWindow(HWND_DESKTOP);
|
---|
328 | }
|
---|
329 | //******************************************************************************
|
---|
330 | //******************************************************************************
|
---|
331 | LONG OSLibWinQueryWindowTextLength(HWND hwnd)
|
---|
332 | {
|
---|
333 | return WinQueryWindowTextLength(hwnd);
|
---|
334 | }
|
---|
335 | //******************************************************************************
|
---|
336 | //******************************************************************************
|
---|
337 | LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz)
|
---|
338 | {
|
---|
339 | return WinQueryWindowText(hwnd, length, lpsz);
|
---|
340 | }
|
---|
341 | //******************************************************************************
|
---|
342 | //******************************************************************************
|
---|
343 | BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz)
|
---|
344 | {
|
---|
345 | return WinSetWindowText(hwnd, lpsz);
|
---|
346 | }
|
---|
347 | //******************************************************************************
|
---|
348 | //******************************************************************************
|
---|
349 | BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash)
|
---|
350 | {
|
---|
351 | return WinFlashWindow(hwnd, fFlash);
|
---|
352 | }
|
---|
353 | //******************************************************************************
|
---|
354 | //******************************************************************************
|
---|
355 | HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint)
|
---|
356 | {
|
---|
357 | return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE);
|
---|
358 | }
|
---|
359 | //******************************************************************************
|
---|
360 | //******************************************************************************
|
---|
361 | BOOL OSLibWinMinimizeWindow(HWND hwnd)
|
---|
362 | {
|
---|
363 | return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE);
|
---|
364 | }
|
---|
365 | //******************************************************************************
|
---|
366 | //******************************************************************************
|
---|
367 | BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
|
---|
368 | {
|
---|
369 | pointl->x = 0;
|
---|
370 | pointl->y = 0;
|
---|
371 | return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
|
---|
372 | }
|
---|
373 | //******************************************************************************
|
---|
374 | //******************************************************************************
|
---|
375 | BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon)
|
---|
376 | {
|
---|
377 | return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
|
---|
378 | }
|
---|
379 | //******************************************************************************
|
---|
380 | //******************************************************************************
|
---|
381 | BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
|
---|
382 | {
|
---|
383 | return WinQueryWindowPos(hwnd, pswp);
|
---|
384 | }
|
---|
385 | //******************************************************************************
|
---|
386 | //******************************************************************************
|
---|
387 | void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
|
---|
388 | {
|
---|
389 | HWND hWindow = pswp->hwnd;
|
---|
390 | HWND hWndInsertAfter = pswp->hwndInsertBehind;
|
---|
391 | long x = pswp->x;
|
---|
392 | long y = pswp->y;
|
---|
393 | long cx = pswp->cx;
|
---|
394 | long cy = pswp->cy;
|
---|
395 | UINT fuFlags = (UINT)pswp->fl;
|
---|
396 | ULONG parentHeight;
|
---|
397 |
|
---|
398 | HWND hWinAfter;
|
---|
399 | ULONG flags = 0;
|
---|
400 | SWP swpFrame, swpClient;
|
---|
401 | POINTL point;
|
---|
402 |
|
---|
403 | HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
|
---|
404 |
|
---|
405 | if (hWndInsertAfter == HWND_TOP)
|
---|
406 | hWinAfter = HWND_TOP_W;
|
---|
407 | else if (hWndInsertAfter == HWND_BOTTOM)
|
---|
408 | hWinAfter = HWND_BOTTOM_W;
|
---|
409 | else
|
---|
410 | hWinAfter = (HWND) hWndInsertAfter;
|
---|
411 |
|
---|
412 | //***********************************
|
---|
413 | // convert PM flags to Windows flags
|
---|
414 | //***********************************
|
---|
415 | if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
|
---|
416 | if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
|
---|
417 | if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
|
---|
418 | if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
|
---|
419 | if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
|
---|
420 | if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
|
---|
421 | if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
|
---|
422 | if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
|
---|
423 |
|
---|
424 | WinQueryWindowPos(hFrame, &swpFrame);
|
---|
425 |
|
---|
426 | if(fuFlags & (SWP_MOVE | SWP_SIZE))
|
---|
427 | {
|
---|
428 | point.x = swpFrame.x;
|
---|
429 | point.y = swpFrame.y;
|
---|
430 |
|
---|
431 | if (hParent)
|
---|
432 | {
|
---|
433 | RECTL parentRect;
|
---|
434 |
|
---|
435 | WinQueryWindowRect(hParent,&parentRect);
|
---|
436 | parentHeight = parentRect.yTop;
|
---|
437 | } else
|
---|
438 | {
|
---|
439 | parentHeight = ScreenHeight;
|
---|
440 | }
|
---|
441 |
|
---|
442 | point.y = parentHeight-point.y-swpFrame.cy;
|
---|
443 |
|
---|
444 | cy = swpFrame.cy;
|
---|
445 | cx = swpFrame.cx;
|
---|
446 | x = point.x;
|
---|
447 | y = point.y;
|
---|
448 |
|
---|
449 | if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
|
---|
450 | flags |= SWP_NOMOVE_W;
|
---|
451 |
|
---|
452 | if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
|
---|
453 | flags |= SWP_NOSIZE_W;
|
---|
454 |
|
---|
455 | if (fuFlags & SWP_SIZE)
|
---|
456 | {
|
---|
457 | if (pswp->cy != pswpOld->cy)
|
---|
458 | {
|
---|
459 | flags &= ~SWP_NOMOVE_W;
|
---|
460 | }
|
---|
461 | }
|
---|
462 | }
|
---|
463 |
|
---|
464 | pswpOld->x = pswp->x;
|
---|
465 | pswpOld->y = swpFrame.cy-pswp->y-pswp->cy;
|
---|
466 | pswpOld->cx = pswp->cx;
|
---|
467 | pswpOld->cy = pswp->cy;
|
---|
468 |
|
---|
469 | dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
|
---|
470 | x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
|
---|
471 |
|
---|
472 | pwpos->flags = (UINT)flags;
|
---|
473 | pwpos->cy = cy;
|
---|
474 | pwpos->cx = cx;
|
---|
475 | pwpos->x = x;
|
---|
476 | pwpos->y = y;
|
---|
477 | pwpos->hwndInsertAfter = hWinAfter;
|
---|
478 | pwpos->hwnd = hWindow;
|
---|
479 | }
|
---|
480 | //******************************************************************************
|
---|
481 | //******************************************************************************
|
---|
482 | void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
|
---|
483 | {
|
---|
484 | HWND hWindow = pswp->hwnd;
|
---|
485 | HWND hWndInsertAfter = pswp->hwndInsertBehind;
|
---|
486 | long x = pswp->x;
|
---|
487 | long y = pswp->y;
|
---|
488 | long cx = pswp->cx;
|
---|
489 | long cy = pswp->cy;
|
---|
490 | UINT fuFlags = (UINT)pswp->fl;
|
---|
491 | ULONG parentHeight;
|
---|
492 |
|
---|
493 | HWND hWinAfter;
|
---|
494 | ULONG flags = 0;
|
---|
495 | SWP swpClient;
|
---|
496 | POINTL point;
|
---|
497 |
|
---|
498 | HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
|
---|
499 |
|
---|
500 | if (hWndInsertAfter == HWND_TOP)
|
---|
501 | hWinAfter = HWND_TOP_W;
|
---|
502 | else if (hWndInsertAfter == HWND_BOTTOM)
|
---|
503 | hWinAfter = HWND_BOTTOM_W;
|
---|
504 | else
|
---|
505 | hWinAfter = (HWND) hWndInsertAfter;
|
---|
506 |
|
---|
507 | //***********************************
|
---|
508 | // convert PM flags to Windows flags
|
---|
509 | //***********************************
|
---|
510 | if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
|
---|
511 | if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
|
---|
512 | if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
|
---|
513 | if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
|
---|
514 | if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
|
---|
515 | if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
|
---|
516 | if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
|
---|
517 | if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
|
---|
518 |
|
---|
519 | WinQueryWindowPos(WinWindowFromID(hFrame, FID_CLIENT), &swpClient);
|
---|
520 |
|
---|
521 | if(fuFlags & (SWP_MOVE | SWP_SIZE))
|
---|
522 | {
|
---|
523 | if (hParent)
|
---|
524 | {
|
---|
525 | RECTL parentRect;
|
---|
526 |
|
---|
527 | WinQueryWindowRect(hParent,&parentRect);
|
---|
528 | parentHeight = parentRect.yTop;
|
---|
529 | } else
|
---|
530 | {
|
---|
531 | parentHeight = ScreenHeight;
|
---|
532 | }
|
---|
533 |
|
---|
534 | point.x = x;
|
---|
535 | point.y = parentHeight-y-cy;
|
---|
536 |
|
---|
537 | x = point.x;
|
---|
538 | y = point.y;
|
---|
539 |
|
---|
540 | if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
|
---|
541 | flags |= SWP_NOMOVE_W;
|
---|
542 |
|
---|
543 | if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
|
---|
544 | flags |= SWP_NOSIZE_W;
|
---|
545 |
|
---|
546 | if (fuFlags & SWP_SIZE)
|
---|
547 | {
|
---|
548 | if (pswp->cy != pswpOld->cy)
|
---|
549 | {
|
---|
550 | flags &= ~SWP_NOMOVE_W;
|
---|
551 | }
|
---|
552 | }
|
---|
553 | }
|
---|
554 |
|
---|
555 | pswpOld->x = swpClient.x;
|
---|
556 | pswpOld->y = pswp->cy-swpClient.y-swpClient.cy;
|
---|
557 | pswpOld->cx = swpClient.cx;
|
---|
558 | pswpOld->cy = swpClient.cy;
|
---|
559 |
|
---|
560 | dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
|
---|
561 | x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
|
---|
562 |
|
---|
563 | pwpos->flags = (UINT)flags;
|
---|
564 | pwpos->cy = cy;
|
---|
565 | pwpos->cx = cx;
|
---|
566 | pwpos->x = x;
|
---|
567 | pwpos->y = y;
|
---|
568 | pwpos->hwndInsertAfter = hWinAfter;
|
---|
569 | pwpos->hwnd = hWindow;
|
---|
570 | }
|
---|
571 | //******************************************************************************
|
---|
572 | //******************************************************************************
|
---|
573 | void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
|
---|
574 | {
|
---|
575 | BOOL fCvt = FALSE;
|
---|
576 |
|
---|
577 | HWND hWnd = pwpos->hwnd;
|
---|
578 | HWND hWndInsertAfter = pwpos->hwndInsertAfter;
|
---|
579 | long x = pwpos->x;
|
---|
580 | long y = pwpos->y;
|
---|
581 | long cx = pwpos->cx;
|
---|
582 | long cy = pwpos->cy;
|
---|
583 | UINT fuFlags = pwpos->flags;
|
---|
584 | ULONG parentHeight;
|
---|
585 |
|
---|
586 | HWND hWinAfter;
|
---|
587 | ULONG flags = 0;
|
---|
588 | HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
|
---|
589 |
|
---|
590 | if (hWndInsertAfter == HWND_TOPMOST_W)
|
---|
591 | // hWinAfter = HWND_TOPMOST;
|
---|
592 | hWinAfter = HWND_TOP;
|
---|
593 | else if (hWndInsertAfter == HWND_NOTOPMOST_W)
|
---|
594 | // hWinAfter = HWND_NOTOPMOST;
|
---|
595 | hWinAfter = HWND_TOP;
|
---|
596 | else if (hWndInsertAfter == HWND_TOP_W)
|
---|
597 | hWinAfter = HWND_TOP;
|
---|
598 | else if (hWndInsertAfter == HWND_BOTTOM_W)
|
---|
599 | hWinAfter = HWND_BOTTOM;
|
---|
600 | else
|
---|
601 | hWinAfter = (HWND) hWndInsertAfter;
|
---|
602 |
|
---|
603 | if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
|
---|
604 | if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
|
---|
605 | if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
|
---|
606 | if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
|
---|
607 | if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
|
---|
608 | if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
|
---|
609 | if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
|
---|
610 | if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
|
---|
611 |
|
---|
612 | if (flags & (SWP_MOVE | SWP_SIZE))
|
---|
613 | {
|
---|
614 | if (hParent == NULLHANDLE)
|
---|
615 | parentHeight = ScreenHeight;
|
---|
616 | else
|
---|
617 | parentHeight = OSLibGetWindowHeight(hParent);
|
---|
618 |
|
---|
619 | if ((flags & SWP_MOVE) == 0)
|
---|
620 | {
|
---|
621 | x = pswpOld->x;
|
---|
622 | y = pswpOld->y;
|
---|
623 |
|
---|
624 | y = parentHeight-y-pswpOld->cy;
|
---|
625 | }
|
---|
626 |
|
---|
627 | if (flags & SWP_SIZE)
|
---|
628 | {
|
---|
629 | if (cy != pswpOld->cy)
|
---|
630 | flags |= SWP_MOVE;
|
---|
631 | }
|
---|
632 | else
|
---|
633 | {
|
---|
634 | cx = pswpOld->cx;
|
---|
635 | cy = pswpOld->cy;
|
---|
636 | }
|
---|
637 | y = parentHeight-y-cy;
|
---|
638 |
|
---|
639 | if ((pswpOld->x == x) && (pswpOld->y == y))
|
---|
640 | flags &= ~SWP_MOVE;
|
---|
641 |
|
---|
642 | if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
|
---|
643 | flags &= ~SWP_SIZE;
|
---|
644 | }
|
---|
645 |
|
---|
646 | pswp->fl = flags;
|
---|
647 | pswp->cy = cy;
|
---|
648 | pswp->cx = cx;
|
---|
649 | pswp->x = x;
|
---|
650 | pswp->y = y;
|
---|
651 | pswp->hwndInsertBehind = hWinAfter;
|
---|
652 | pswp->hwnd = hWindow;
|
---|
653 | pswp->ulReserved1 = 0;
|
---|
654 | pswp->ulReserved2 = 0;
|
---|
655 | }
|
---|
656 | //******************************************************************************
|
---|
657 | //Position in screen coordinates
|
---|
658 | //******************************************************************************
|
---|
659 | void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
|
---|
660 | {
|
---|
661 | BOOL fCvt = FALSE;
|
---|
662 |
|
---|
663 | HWND hWnd = pwpos->hwnd;
|
---|
664 | HWND hWndInsertAfter = pwpos->hwndInsertAfter;
|
---|
665 | long x = pwpos->x;
|
---|
666 | long y = pwpos->y;
|
---|
667 | long cx = pwpos->cx;
|
---|
668 | long cy = pwpos->cy;
|
---|
669 | UINT fuFlags = pwpos->flags;
|
---|
670 | ULONG parentHeight;
|
---|
671 |
|
---|
672 | HWND hWinAfter;
|
---|
673 | ULONG flags = 0;
|
---|
674 | HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
|
---|
675 |
|
---|
676 | if (hWndInsertAfter == HWND_TOPMOST_W)
|
---|
677 | // hWinAfter = HWND_TOPMOST;
|
---|
678 | hWinAfter = HWND_TOP;
|
---|
679 | else if (hWndInsertAfter == HWND_NOTOPMOST_W)
|
---|
680 | // hWinAfter = HWND_NOTOPMOST;
|
---|
681 | hWinAfter = HWND_TOP;
|
---|
682 | else if (hWndInsertAfter == HWND_TOP_W)
|
---|
683 | hWinAfter = HWND_TOP;
|
---|
684 | else if (hWndInsertAfter == HWND_BOTTOM_W)
|
---|
685 | hWinAfter = HWND_BOTTOM;
|
---|
686 | else
|
---|
687 | hWinAfter = (HWND) hWndInsertAfter;
|
---|
688 |
|
---|
689 | if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
|
---|
690 | if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
|
---|
691 | if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
|
---|
692 | if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
|
---|
693 | if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
|
---|
694 | if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
|
---|
695 | if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
|
---|
696 | if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
|
---|
697 |
|
---|
698 | if (flags & (SWP_MOVE | SWP_SIZE))
|
---|
699 | {
|
---|
700 | if (hParent)
|
---|
701 | {
|
---|
702 | RECTL parentRect;
|
---|
703 |
|
---|
704 | WinQueryWindowRect(hParent,&parentRect);
|
---|
705 | parentHeight = parentRect.yTop;
|
---|
706 | } else
|
---|
707 | {
|
---|
708 | parentHeight = ScreenHeight;
|
---|
709 | }
|
---|
710 |
|
---|
711 | if (flags & SWP_SIZE)
|
---|
712 | {
|
---|
713 | if (cy != pswpOld->cy)
|
---|
714 | flags |= SWP_MOVE;
|
---|
715 | }
|
---|
716 | else
|
---|
717 | {
|
---|
718 | cx = pswpOld->cx;
|
---|
719 | cy = pswpOld->cy;
|
---|
720 | }
|
---|
721 | y = parentHeight-y-cy;
|
---|
722 |
|
---|
723 | if ((pswpOld->x == x) && (pswpOld->y == y))
|
---|
724 | flags &= ~SWP_MOVE;
|
---|
725 |
|
---|
726 | if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
|
---|
727 | flags &= ~SWP_SIZE;
|
---|
728 | }
|
---|
729 |
|
---|
730 | pswp->fl = flags;
|
---|
731 | pswp->cy = cy;
|
---|
732 | pswp->cx = cx;
|
---|
733 | pswp->x = x;
|
---|
734 | pswp->y = y;
|
---|
735 | pswp->hwndInsertBehind = hWinAfter;
|
---|
736 | pswp->hwnd = hWindow;
|
---|
737 | pswp->ulReserved1 = 0;
|
---|
738 | pswp->ulReserved2 = 0;
|
---|
739 | }
|
---|
740 | //******************************************************************************
|
---|
741 | //******************************************************************************
|
---|
742 | BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient)
|
---|
743 | {
|
---|
744 | BOOL rc;
|
---|
745 |
|
---|
746 | WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
|
---|
747 |
|
---|
748 | rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient);
|
---|
749 | WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2);
|
---|
750 |
|
---|
751 | return rc;
|
---|
752 | }
|
---|
753 | //******************************************************************************
|
---|
754 | //******************************************************************************
|
---|
755 | BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax)
|
---|
756 | {
|
---|
757 | TRACKINFO tinfo;
|
---|
758 |
|
---|
759 | memset(&tinfo, 0, sizeof(TRACKINFO));
|
---|
760 | WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo);
|
---|
761 |
|
---|
762 | pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x;
|
---|
763 | pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y;
|
---|
764 | pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x;
|
---|
765 | pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y;
|
---|
766 | return TRUE;
|
---|
767 | }
|
---|
768 | //******************************************************************************
|
---|
769 | //******************************************************************************
|
---|
770 | HWND OSLibWinBeginEnumWindows(HWND hwnd)
|
---|
771 | {
|
---|
772 | if(hwnd == OSLIB_HWND_DESKTOP) hwnd = HWND_DESKTOP;
|
---|
773 | else
|
---|
774 | if(hwnd == OSLIB_HWND_OBJECT) hwnd = HWND_OBJECT;
|
---|
775 |
|
---|
776 | return WinBeginEnumWindows(hwnd);
|
---|
777 | }
|
---|
778 | //******************************************************************************
|
---|
779 | //******************************************************************************
|
---|
780 | HWND OSLibWinGetNextWindow(HWND hwndEnum)
|
---|
781 | {
|
---|
782 | return WinGetNextWindow(hwndEnum);
|
---|
783 | }
|
---|
784 | //******************************************************************************
|
---|
785 | //******************************************************************************
|
---|
786 | HWND OSLibWinQueryClientWindow(HWND hwndFrame)
|
---|
787 | {
|
---|
788 | HWND hwndClient = 0;
|
---|
789 |
|
---|
790 | if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
|
---|
791 | hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
|
---|
792 |
|
---|
793 | return hwndClient;
|
---|
794 | }
|
---|
795 | //******************************************************************************
|
---|
796 | //******************************************************************************
|
---|
797 | BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
|
---|
798 | {
|
---|
799 | return WinEndEnumWindows(hwndEnum);
|
---|
800 | }
|
---|
801 | //******************************************************************************
|
---|
802 | //******************************************************************************
|
---|
803 | BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid)
|
---|
804 | {
|
---|
805 | return WinQueryWindowProcess(hwnd, pid, tid);
|
---|
806 | }
|
---|
807 | //******************************************************************************
|
---|
808 | //******************************************************************************
|
---|
809 | BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num)
|
---|
810 | {
|
---|
811 | return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num);
|
---|
812 | }
|
---|
813 | //******************************************************************************
|
---|
814 | //******************************************************************************
|
---|
815 | HWND OSLibWinQueryObjectWindow(VOID)
|
---|
816 | {
|
---|
817 | return WinQueryObjectWindow(HWND_DESKTOP);
|
---|
818 | }
|
---|
819 | //******************************************************************************
|
---|
820 | //******************************************************************************
|
---|
821 | HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID)
|
---|
822 | {
|
---|
823 | HWND hwndNext, hwndFound=0;
|
---|
824 | HENUM henum;
|
---|
825 |
|
---|
826 | henum = WinBeginEnumWindows(HWND_OBJECT);
|
---|
827 | while ((hwndNext = WinGetNextWindow(henum)) != 0)
|
---|
828 | {
|
---|
829 | if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner &&
|
---|
830 | WinQueryWindowUShort(hwndNext, QWS_ID) == ID)
|
---|
831 | {
|
---|
832 | hwndFound = hwndNext;
|
---|
833 | break;
|
---|
834 | }
|
---|
835 | }
|
---|
836 | WinEndEnumWindows(henum);
|
---|
837 | return hwndFound;
|
---|
838 | }
|
---|
839 | //******************************************************************************
|
---|
840 | //******************************************************************************
|
---|
841 | BOOL OSLibSetWindowID(HWND hwnd, ULONG value)
|
---|
842 | {
|
---|
843 | dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value));
|
---|
844 | return WinSetWindowULong(hwnd, QWS_ID, value);
|
---|
845 | }
|
---|
846 | //******************************************************************************
|
---|
847 | //******************************************************************************
|
---|
848 | PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
|
---|
849 | {
|
---|
850 | return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
|
---|
851 | }
|
---|
852 | //******************************************************************************
|
---|
853 | //******************************************************************************
|
---|
854 | BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
|
---|
855 | {
|
---|
856 | ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
|
---|
857 |
|
---|
858 | WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT)pRect->left );
|
---|
859 | WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT)(yHeight - pRect->top -
|
---|
860 | (pRect->bottom - pRect->top)));
|
---|
861 | WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
|
---|
862 | WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
|
---|
863 | return TRUE;
|
---|
864 | }
|
---|
865 | //******************************************************************************
|
---|
866 | //******************************************************************************
|
---|
867 | BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
|
---|
868 | {
|
---|
869 | ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
|
---|
870 |
|
---|
871 | WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
|
---|
872 | WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
|
---|
873 | ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
|
---|
874 | WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
|
---|
875 | return TRUE;
|
---|
876 | }
|
---|
877 | //******************************************************************************
|
---|
878 | //******************************************************************************
|
---|
879 | BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
|
---|
880 | {
|
---|
881 | return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, FALSE );
|
---|
882 | }
|
---|
883 | //******************************************************************************
|
---|
884 | //******************************************************************************
|
---|
885 | BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
|
---|
886 | {
|
---|
887 | return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, TRUE );
|
---|
888 | }
|
---|
889 | //******************************************************************************
|
---|
890 | //******************************************************************************
|
---|
891 | BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable)
|
---|
892 | {
|
---|
893 | return WinEnableWindowUpdate(hwnd,fEnable);
|
---|
894 | }
|
---|
895 | //******************************************************************************
|
---|
896 | //******************************************************************************
|
---|
897 | ULONG OSLibWinGetLastError()
|
---|
898 | {
|
---|
899 | return WinGetLastError(GetThreadHAB()) & 0xFFFF;
|
---|
900 | }
|
---|
901 | //******************************************************************************
|
---|
902 | //******************************************************************************
|
---|
903 | void OSLibWinShowTaskList(HWND hwndFrame)
|
---|
904 | {
|
---|
905 | //CB: don't know if this works on all machines
|
---|
906 | WinSetActiveWindow(HWND_DESKTOP,0x8000000E);
|
---|
907 | }
|
---|
908 | //******************************************************************************
|
---|
909 | //******************************************************************************
|
---|
910 | void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, ULONG dwExStyle, BOOL saveBits)
|
---|
911 | {
|
---|
912 | ULONG dwWinStyle;
|
---|
913 |
|
---|
914 | OSLibWinConvertStyle(dwStyle, &dwExStyle, &dwWinStyle);
|
---|
915 |
|
---|
916 | dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN);
|
---|
917 | if(saveBits) dwWinStyle |= WS_SAVEBITS;
|
---|
918 | if(dwStyle & WS_VISIBLE_W)
|
---|
919 | dwWinStyle |= WS_VISIBLE;
|
---|
920 |
|
---|
921 | WinSetWindowULong(hwnd, QWL_STYLE,
|
---|
922 | (WinQueryWindowULong(hwnd, QWL_STYLE) & ~0xffff0000) |
|
---|
923 | dwWinStyle);
|
---|
924 | }
|
---|
925 | //******************************************************************************
|
---|
926 | //******************************************************************************
|
---|