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