source: trunk/src/user32/oslibwin.cpp@ 2246

Last change on this file since 2246 was 2246, checked in by sandervl, 26 years ago

PostThreadMessage fix

File size: 41.3 KB
Line 
1/* $Id: oslibwin.cpp,v 1.55 1999-12-29 12:39:44 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#define HAS_3DFRAME(exStyle) \
30 ((exStyle & WS_EX_CLIENTEDGE_W) || (exStyle & WS_EX_STATICEDGE_W) || (exStyle & WS_EX_WINDOWEDGE_W))
31
32//******************************************************************************
33//******************************************************************************
34BOOL OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw)
35{
36 if(hwndParent == OSLIB_HWND_DESKTOP)
37 {
38 hwndParent = HWND_DESKTOP;
39 }
40 else
41 if(hwndParent == OSLIB_HWND_OBJECT) {
42 hwndParent = HWND_OBJECT;
43 }
44 return (WinSetParent(hwnd, hwndParent, fRedraw) == 0);
45}
46//******************************************************************************
47//******************************************************************************
48BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
49{
50 return WinSetOwner(hwnd, hwndOwner);
51}
52//******************************************************************************
53//******************************************************************************
54HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
56 ULONG id, BOOL fTaskList)
57{
58 HWND hwndClient;
59
60 dprintf(("WinCreateWindow %x %x %x %s", hwndParent, dwWinStyle, dwFrameStyle, pszName));
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;
72#if 1
73
74 BOOL TopLevel = hwndParent == HWND_DESKTOP;
75// if(dwFrameStyle & FCF_TITLEBAR)
76// TopLevel = TRUE;
77
78 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
79
80 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS);
81
82 dwFrameStyle |= FCF_NOBYTEALIGN;
83 if(fTaskList)
84 {
85 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
86 }
87
88 dwWinStyle &= ~WS_CLIPCHILDREN;
89 FCData.flCreateFlags = dwFrameStyle;
90
91 *hwndFrame = WinCreateWindow (hwndParent,
92 TopLevel ? WC_FRAME : WIN32_INNERFRAME,
93 pszName, dwWinStyle, 0, 0, 50, 30,
94 hwndParent, HWND_TOP,
95 id, &FCData, NULL);
96 if (*hwndFrame) {
97 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
98 NULL, dwClientStyle, 0, 0, 0, 0,
99 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
100 if (hwndClient != NULLHANDLE)
101 WinSendMsg (*hwndFrame, WM_UPDATEFRAME, 0, 0);
102
103 return hwndClient;
104 }
105 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
106 return 0;
107#else
108 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
109
110 dwFrameStyle |= FCF_NOBYTEALIGN;
111 if ((hwndParent == HWND_DESKTOP) && (dwFrameStyle & FCF_TITLEBAR))
112 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
113
114 dwWinStyle &= ~WS_CLIPCHILDREN;
115
116 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
117 &dwFrameStyle, WIN32_STDCLASS,
118 "", dwClientStyle, 0, id, &hwndClient);
119 if(*hwndFrame) {
120 if(pszName) {
121 WinSetWindowText(*hwndFrame, pszName);
122 }
123 return hwndClient;
124 }
125 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
126 return 0;
127#endif
128}
129//******************************************************************************
130//******************************************************************************
131BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
132{
133 *OSWinStyle = 0;
134 *OSFrameStyle = 0;
135 *borderWidth = 0;
136 *borderHeight = 0;
137
138 /* Window styles */
139 if(dwStyle & WS_MINIMIZE_W)
140 *OSWinStyle |= WS_MINIMIZED;
141//Done explicitely in CreateWindowExA
142#if 1
143 if(dwStyle & WS_VISIBLE_W)
144 *OSWinStyle |= WS_VISIBLE;
145#endif
146 if(dwStyle & WS_DISABLED_W)
147 *OSWinStyle |= WS_DISABLED;
148 if(dwStyle & WS_CLIPSIBLINGS_W)
149 *OSWinStyle |= WS_CLIPSIBLINGS;
150 if(dwStyle & WS_CLIPCHILDREN_W)
151 *OSWinStyle |= WS_CLIPCHILDREN;
152 if(dwStyle & WS_MAXIMIZE_W)
153 *OSWinStyle |= WS_MAXIMIZED;
154 if(dwStyle & WS_GROUP_W)
155 *OSWinStyle |= WS_GROUP;
156 if(dwStyle & WS_TABSTOP_W)
157 *OSWinStyle |= WS_TABSTOP;
158
159 if(dwStyle & WS_CHILD_W && !((dwStyle & WS_CAPTION_W) == WS_CAPTION_W))
160 {
161//SvL: Causes crash in VPBuddy if enabled -> find bug
162#if 0
163 if (!HAS_3DFRAME(*dwExStyle) && (dwStyle & (WS_DLGFRAME_W | WS_THICKFRAME_W))) *dwExStyle |= WS_EX_DLGMODALFRAME_W;
164#endif
165
166 if (*dwExStyle & WS_EX_CLIENTEDGE_W)
167 {
168 *OSFrameStyle |= FCF_SIZEBORDER;
169 *borderHeight = *borderWidth = 2;
170 }
171 else
172 if (*dwExStyle & WS_EX_DLGMODALFRAME_W)
173 {
174 *OSFrameStyle |= FCF_SIZEBORDER;
175 *borderHeight = *borderWidth = 3;
176 }
177 else
178 if (*dwExStyle & WS_EX_STATICEDGE_W)
179 {
180 *OSFrameStyle |= FCF_SIZEBORDER;
181 *borderHeight = *borderWidth = 2;
182 }
183 else
184 if(dwStyle & WS_BORDER_W)
185 {
186 *OSFrameStyle |= FCF_BORDER;
187 *borderHeight = *borderWidth = 1;
188 }
189 else if (*dwExStyle & WS_EX_WINDOWEDGE_W); //no border
190
191 if(dwStyle & WS_VSCROLL_W)
192 *OSFrameStyle |= FCF_VERTSCROLL;
193 if(dwStyle & WS_HSCROLL_W)
194 *OSFrameStyle |= FCF_HORZSCROLL;
195 }
196 else
197 {
198 if((dwStyle & WS_CAPTION_W) == WS_DLGFRAME_W)
199 *OSFrameStyle |= FCF_DLGBORDER;
200 else
201 {
202 if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W)
203 *OSFrameStyle |= (FCF_TITLEBAR | FCF_BORDER);
204 else
205 if(dwStyle & WS_BORDER_W)
206 *OSFrameStyle |= FCF_BORDER;
207 }
208
209 if(dwStyle & WS_VSCROLL_W)
210 *OSFrameStyle |= FCF_VERTSCROLL;
211 if(dwStyle & WS_HSCROLL_W)
212 *OSFrameStyle |= FCF_HORZSCROLL;
213
214 if(dwStyle & WS_SYSMENU_W)
215 *OSFrameStyle |= FCF_SYSMENU;
216 if(dwStyle & WS_THICKFRAME_W)
217 *OSFrameStyle |= FCF_SIZEBORDER; //??
218 if(dwStyle & WS_MINIMIZEBOX_W)
219 *OSFrameStyle |= FCF_MINBUTTON;
220 if(dwStyle & WS_MAXIMIZEBOX_W)
221 *OSFrameStyle |= FCF_MAXBUTTON;
222
223 if(*dwExStyle & WS_EX_DLGMODALFRAME_W)
224 *OSFrameStyle |= FCF_DLGBORDER;
225 }
226
227 //Clear certain frame bits when the window doesn't have a titlebar
228 if(!(*OSFrameStyle & FCF_TITLEBAR)) {
229 *OSFrameStyle &= ~(FCF_MINBUTTON|FCF_MAXBUTTON|FCF_SYSMENU);
230 }
231 return TRUE;
232}
233//******************************************************************************
234//******************************************************************************
235BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
236{
237 if(offset == OSLIB_QWL_USER)
238 offset = QWL_USER;
239
240 return WinSetWindowULong(hwnd, offset, value);
241}
242//******************************************************************************
243//******************************************************************************
244ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
245{
246 if(offset == OSLIB_QWL_USER)
247 offset = QWL_USER;
248
249 return WinQueryWindowULong(hwnd, offset);
250}
251//******************************************************************************
252//******************************************************************************
253BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
254{
255 return WinAlarm(hwndDeskTop,flStyle);
256}
257//******************************************************************************
258//******************************************************************************
259APIRET OSLibDosBeep(ULONG freg,ULONG dur)
260{
261 return DosBeep(freg,dur);
262}
263//******************************************************************************
264//******************************************************************************
265HWND OSLibWinQueryFocus(HWND hwndDeskTop)
266{
267 return WinQueryFocus(hwndDeskTop);
268}
269//******************************************************************************
270//******************************************************************************
271HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
272{
273 return WinWindowFromID(hwndParent,id);
274}
275//******************************************************************************
276//******************************************************************************
277BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate)
278{
279 return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? FC_NOLOSEACTIVE : 0);
280}
281//******************************************************************************
282//******************************************************************************
283BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf)
284{
285 return WinIsChild (hwnd, hwndOf);
286}
287//******************************************************************************
288//******************************************************************************
289ULONG OSLibGetWindowHeight(HWND hwnd)
290{
291 RECTL rect;
292
293 return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
294}
295//******************************************************************************
296//******************************************************************************
297LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
298{
299 return WinQuerySysValue(hwndDeskTop,iSysValue);
300}
301//******************************************************************************
302//******************************************************************************
303ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
304{
305 return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
306}
307//******************************************************************************
308//******************************************************************************
309BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
310{
311 return WinSetDlgItemText(hwndDlg,idItem,pszText);
312}
313//******************************************************************************
314//******************************************************************************
315BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
316{
317 return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
318}
319//******************************************************************************
320//******************************************************************************
321HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode)
322{
323 return WinQueryWindow(hwnd, lCode);
324}
325//******************************************************************************
326//******************************************************************************
327BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx,
328 LONG cy, ULONG fl)
329{
330 HWND hwndParent = hwndInsertBehind;
331 BOOL rc;
332
333 if(fl & SWP_MOVE) {
334 switch(hwndParent)
335 {
336 case HWNDOS_TOP:
337 case HWNDOS_BOTTOM:
338 hwndParent = HWND_DESKTOP;
339 break;
340 }
341 y = MapOS2ToWin32Y(hwndParent, cy, y);
342 }
343 rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
344 dprintf(("WinSetWindowPos %x %x %d %d %d %d %x returned %d (%x)", hwnd, hwndInsertBehind, x, y, cx, cy, fl, rc, WinGetLastError(GetThreadHAB())));
345 return rc;
346}
347//******************************************************************************
348//******************************************************************************
349BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
350{
351 return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
352}
353//******************************************************************************
354//******************************************************************************
355BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
356{
357 BOOL rc = 1;
358
359 if(fl & SWP_SHOW) {
360 rc = WinShowWindow(hwnd, TRUE);
361 }
362 if(rc == 0)
363 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
364 rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
365 if(rc == 0)
366 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
367 return rc;
368}
369//******************************************************************************
370//******************************************************************************
371BOOL OSLibWinDestroyWindow(HWND hwnd)
372{
373 return WinDestroyWindow(hwnd);
374}
375//******************************************************************************
376//******************************************************************************
377BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
378{
379 BOOL rc;
380 RECTLOS2 rectl;
381
382 rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
383 if(rc) {
384 if(RelativeTo == RELATIVE_TO_SCREEN) {
385 MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
386 }
387 else MapOS2ToWin32WindowRect(&rectl, pRect);
388 }
389 else memset(pRect, 0, sizeof(RECT));
390 return rc;
391}
392//******************************************************************************
393//******************************************************************************
394BOOL OSLibWinIsIconic(HWND hwnd)
395{
396 SWP swp;
397 BOOL rc;
398
399 rc = WinQueryWindowPos(hwnd, &swp);
400 if(rc == FALSE) {
401 dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
402 return FALSE;
403 }
404
405 if(swp.fl & SWP_MINIMIZE)
406 return TRUE;
407 else return FALSE;
408}
409//******************************************************************************
410//******************************************************************************
411BOOL OSLibWinSetActiveWindow(HWND hwnd)
412{
413 return WinSetActiveWindow(HWND_DESKTOP, hwnd);
414}
415//******************************************************************************
416//******************************************************************************
417BOOL OSLibWinSetFocus(HWND hwnd)
418{
419 return WinSetFocus(HWND_DESKTOP, hwnd);
420}
421//******************************************************************************
422//******************************************************************************
423BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable)
424{
425 BOOL rc;
426 HWND hwndClient;
427
428 rc = WinEnableWindow(hwnd, fEnable);
429 hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
430 if(hwndClient) {
431 WinEnableWindow(hwndClient, fEnable);
432 }
433 return rc;
434}
435//******************************************************************************
436//******************************************************************************
437BOOL OSLibWinIsWindowEnabled(HWND hwnd)
438{
439 return WinIsWindowEnabled(hwnd);
440}
441//******************************************************************************
442//******************************************************************************
443BOOL OSLibWinIsWindowVisible(HWND hwnd)
444{
445 return WinIsWindowVisible(hwnd);
446}
447//******************************************************************************
448//******************************************************************************
449BOOL OSLibWinQueryActiveWindow()
450{
451 return WinQueryActiveWindow(HWND_DESKTOP);
452}
453//******************************************************************************
454//******************************************************************************
455LONG OSLibWinQueryWindowTextLength(HWND hwnd)
456{
457 return WinQueryWindowTextLength(hwnd);
458}
459//******************************************************************************
460//******************************************************************************
461LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz)
462{
463 return WinQueryWindowText(hwnd, length, lpsz);
464}
465//******************************************************************************
466//******************************************************************************
467BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz)
468{
469 return WinSetWindowText(hwnd, lpsz);
470}
471//******************************************************************************
472//******************************************************************************
473BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash)
474{
475 return WinFlashWindow(hwnd, fFlash);
476}
477//******************************************************************************
478//******************************************************************************
479HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint)
480{
481 return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE);
482}
483//******************************************************************************
484//******************************************************************************
485BOOL OSLibWinMinimizeWindow(HWND hwnd)
486{
487 return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE);
488}
489//******************************************************************************
490//******************************************************************************
491BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
492{
493 pointl->x = 0;
494 pointl->y = 0;
495 return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
496}
497//******************************************************************************
498//******************************************************************************
499BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon)
500{
501 return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
502}
503//******************************************************************************
504//******************************************************************************
505BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
506{
507 return WinQueryWindowPos(hwnd, pswp);
508}
509//******************************************************************************
510//******************************************************************************
511void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
512{
513 HWND hWindow = pswp->hwnd;
514 HWND hWndInsertAfter = pswp->hwndInsertBehind;
515 long x = pswp->x;
516 long y = pswp->y;
517 long cx = pswp->cx;
518 long cy = pswp->cy;
519 UINT fuFlags = (UINT)pswp->fl;
520 ULONG parentHeight;
521
522 HWND hWinAfter;
523 ULONG flags = 0;
524 SWP swpFrame, swpClient;
525 POINTL point;
526
527 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
528
529 if (hWndInsertAfter == HWND_TOP)
530 hWinAfter = HWND_TOP_W;
531 else if (hWndInsertAfter == HWND_BOTTOM)
532 hWinAfter = HWND_BOTTOM_W;
533 else
534 hWinAfter = (HWND) hWndInsertAfter;
535
536 //***********************************
537 // convert PM flags to Windows flags
538 //***********************************
539 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
540 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
541 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
542 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
543 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
544 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
545 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
546 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
547
548 WinQueryWindowPos(hFrame, &swpFrame);
549
550 if(fuFlags & (SWP_MOVE | SWP_SIZE))
551 {
552 point.x = swpFrame.x;
553 point.y = swpFrame.y;
554 if(hParent)
555 {
556 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
557 }
558 point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
559
560 cy = swpFrame.cy;
561 cx = swpFrame.cx;
562 x = point.x;
563 y = point.y;
564
565 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
566 flags |= SWP_NOMOVE_W;
567
568 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
569 flags |= SWP_NOSIZE_W;
570
571 if (fuFlags & SWP_SIZE)
572 {
573 if (pswp->cy != pswpOld->cy)
574 {
575 flags &= ~SWP_NOMOVE_W;
576 }
577 }
578 }
579
580 pswpOld->x = pswp->x;
581 pswpOld->y = swpFrame.cy - pswp->y - pswp->cy;
582 pswpOld->cx = pswp->cx;
583 pswpOld->cy = pswp->cy;
584
585 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
586 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
587
588 pwpos->flags = (UINT)flags;
589 pwpos->cy = cy;
590 pwpos->cx = cx;
591 pwpos->x = x;
592 pwpos->y = y;
593 pwpos->hwndInsertAfter = hWinAfter;
594 pwpos->hwnd = hWindow;
595}
596//******************************************************************************
597//******************************************************************************
598void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
599{
600 HWND hWindow = pswp->hwnd;
601 HWND hWndInsertAfter = pswp->hwndInsertBehind;
602 long x = pswp->x;
603 long y = pswp->y;
604 long cx = pswp->cx;
605 long cy = pswp->cy;
606 UINT fuFlags = (UINT)pswp->fl;
607 ULONG parentHeight;
608
609 HWND hWinAfter;
610 ULONG flags = 0;
611 SWP swpClient;
612 POINTL point;
613
614 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
615
616 if (hWndInsertAfter == HWND_TOP)
617 hWinAfter = HWND_TOP_W;
618 else if (hWndInsertAfter == HWND_BOTTOM)
619 hWinAfter = HWND_BOTTOM_W;
620 else
621 hWinAfter = (HWND) hWndInsertAfter;
622
623 //***********************************
624 // convert PM flags to Windows flags
625 //***********************************
626 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
627 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
628 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
629 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
630 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
631 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
632 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
633 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
634
635 WinQueryWindowPos(WinWindowFromID(hFrame, FID_CLIENT), &swpClient);
636
637 if(fuFlags & (SWP_MOVE | SWP_SIZE))
638 {
639 point.x = x;
640 point.y = y;
641 if(hParent)
642 {
643 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
644 }
645 point.y = OSLibQueryScreenHeight() - point.y - cy;
646
647 x = point.x;
648 y = point.y;
649
650 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
651 flags |= SWP_NOMOVE_W;
652
653 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
654 flags |= SWP_NOSIZE_W;
655
656 if (fuFlags & SWP_SIZE)
657 {
658 if (pswp->cy != pswpOld->cy)
659 {
660 flags &= ~SWP_NOMOVE_W;
661 }
662 }
663 }
664
665 pswpOld->x = swpClient.x;
666 pswpOld->y = pswp->cy - swpClient.y - swpClient.cy;
667 pswpOld->cx = swpClient.cx;
668 pswpOld->cy = swpClient.cy;
669
670 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
671 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
672
673 pwpos->flags = (UINT)flags;
674 pwpos->cy = cy;
675 pwpos->cx = cx;
676 pwpos->x = x;
677 pwpos->y = y;
678 pwpos->hwndInsertAfter = hWinAfter;
679 pwpos->hwnd = hWindow;
680}
681//******************************************************************************
682//******************************************************************************
683void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
684{
685 BOOL fCvt = FALSE;
686
687 HWND hWnd = pwpos->hwnd;
688 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
689 long x = pwpos->x;
690 long y = pwpos->y;
691 long cx = pwpos->cx;
692 long cy = pwpos->cy;
693 UINT fuFlags = pwpos->flags;
694 ULONG parentHeight;
695
696 HWND hWinAfter;
697 ULONG flags = 0;
698 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
699
700 if (hWndInsertAfter == HWND_TOPMOST_W)
701// hWinAfter = HWND_TOPMOST;
702 hWinAfter = HWND_TOP;
703 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
704// hWinAfter = HWND_NOTOPMOST;
705 hWinAfter = HWND_TOP;
706 else if (hWndInsertAfter == HWND_TOP_W)
707 hWinAfter = HWND_TOP;
708 else if (hWndInsertAfter == HWND_BOTTOM_W)
709 hWinAfter = HWND_BOTTOM;
710 else
711 hWinAfter = (HWND) hWndInsertAfter;
712
713 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
714 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
715 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
716 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
717 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
718 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
719 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
720 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
721
722 if (flags & (SWP_MOVE | SWP_SIZE))
723 {
724 if (hParent == NULLHANDLE)
725 parentHeight = ScreenHeight;
726 else
727 parentHeight = OSLibGetWindowHeight(hParent);
728
729 if ((flags & SWP_MOVE) == 0)
730 {
731 x = pswpOld->x;
732 y = pswpOld->y;
733
734 if (!((y == 0) && (pswpOld->cy == 0)))
735 {
736 y = parentHeight - y - pswpOld->cy;
737 }
738 }
739
740 if (flags & SWP_SIZE)
741 {
742 if (cy != pswpOld->cy)
743 flags |= SWP_MOVE;
744 }
745 else
746 {
747 cx = pswpOld->cx;
748 cy = pswpOld->cy;
749 }
750 y = parentHeight - y - cy;
751
752
753 if ((pswpOld->x == x) && (pswpOld->y == y))
754 flags &= ~SWP_MOVE;
755
756 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
757 flags &= ~SWP_SIZE;
758 }
759
760 pswp->fl = flags;
761 pswp->cy = cy;
762 pswp->cx = cx;
763 pswp->x = x;
764 pswp->y = y;
765 pswp->hwndInsertBehind = hWinAfter;
766 pswp->hwnd = hWindow;
767 pswp->ulReserved1 = 0;
768 pswp->ulReserved2 = 0;
769}
770//******************************************************************************
771//Position in screen coordinates
772//******************************************************************************
773void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
774{
775 BOOL fCvt = FALSE;
776
777 HWND hWnd = pwpos->hwnd;
778 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
779 long x = pwpos->x;
780 long y = pwpos->y;
781 long cx = pwpos->cx;
782 long cy = pwpos->cy;
783 UINT fuFlags = pwpos->flags;
784 ULONG parentHeight;
785 POINTL point;
786
787 HWND hWinAfter;
788 ULONG flags = 0;
789 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
790
791 if (hWndInsertAfter == HWND_TOPMOST_W)
792// hWinAfter = HWND_TOPMOST;
793 hWinAfter = HWND_TOP;
794 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
795// hWinAfter = HWND_NOTOPMOST;
796 hWinAfter = HWND_TOP;
797 else if (hWndInsertAfter == HWND_TOP_W)
798 hWinAfter = HWND_TOP;
799 else if (hWndInsertAfter == HWND_BOTTOM_W)
800 hWinAfter = HWND_BOTTOM;
801 else
802 hWinAfter = (HWND) hWndInsertAfter;
803
804 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
805 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
806 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
807 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
808 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
809 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
810 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
811 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
812
813 if (flags & (SWP_MOVE | SWP_SIZE))
814 {
815 point.x = x;
816 point.y = y;
817
818 if(hParent) {
819 parentHeight = OSLibGetWindowHeight(hParent);
820
821 point.y = ScreenHeight - point.y - cy;
822 WinMapWindowPoints(HWND_DESKTOP, hParent, &point, 1);
823 point.y = parentHeight - point.y - cy;
824 }
825 else parentHeight = ScreenHeight;
826
827 x = point.x;
828 y = point.y;
829
830 if (flags & SWP_SIZE)
831 {
832 if (cy != pswpOld->cy)
833 flags |= SWP_MOVE;
834 }
835 else
836 {
837 cx = pswpOld->cx;
838 cy = pswpOld->cy;
839 }
840 y = parentHeight - y - cy;
841
842
843 if ((pswpOld->x == x) && (pswpOld->y == y))
844 flags &= ~SWP_MOVE;
845
846 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
847 flags &= ~SWP_SIZE;
848 }
849
850 pswp->fl = flags;
851 pswp->cy = cy;
852 pswp->cx = cx;
853 pswp->x = x;
854 pswp->y = y;
855 pswp->hwndInsertBehind = hWinAfter;
856 pswp->hwnd = hWindow;
857 pswp->ulReserved1 = 0;
858 pswp->ulReserved2 = 0;
859}
860//******************************************************************************
861//******************************************************************************
862BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient)
863{
864 BOOL rc;
865
866 WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
867
868 rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient);
869 WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2);
870
871 return rc;
872}
873//******************************************************************************
874//******************************************************************************
875BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax)
876{
877 TRACKINFO tinfo;
878
879 memset(&tinfo, 0, sizeof(TRACKINFO));
880 WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo);
881
882 pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x;
883 pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y;
884 pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x;
885 pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y;
886 return TRUE;
887}
888//******************************************************************************
889//******************************************************************************
890HWND OSLibWinBeginEnumWindows(HWND hwnd)
891{
892 if(hwnd == OSLIB_HWND_DESKTOP) hwnd = HWND_DESKTOP;
893 else
894 if(hwnd == OSLIB_HWND_OBJECT) hwnd = HWND_OBJECT;
895
896 return WinBeginEnumWindows(hwnd);
897}
898//******************************************************************************
899//******************************************************************************
900HWND OSLibWinGetNextWindow(HWND hwndEnum)
901{
902 return WinGetNextWindow(hwndEnum);
903}
904//******************************************************************************
905//******************************************************************************
906HWND OSLibWinQueryClientWindow(HWND hwndFrame)
907{
908 HWND hwndClient = 0;
909
910 if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
911 hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
912
913 return hwndClient;
914}
915//******************************************************************************
916//******************************************************************************
917BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
918{
919 return WinEndEnumWindows(hwndEnum);
920}
921//******************************************************************************
922//******************************************************************************
923BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid)
924{
925 return WinQueryWindowProcess(hwnd, pid, tid);
926}
927//******************************************************************************
928//******************************************************************************
929BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num)
930{
931 return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num);
932}
933//******************************************************************************
934//******************************************************************************
935BOOL OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable)
936{
937 HWND hwndScroll;
938
939 if(scrollBar == OSLIB_VSCROLL) {
940 hwndScroll = WinWindowFromID(hwndParent, FID_VERTSCROLL);
941 }
942 else hwndScroll = WinWindowFromID(hwndParent, FID_HORZSCROLL);
943
944 if(hwndScroll == NULL)
945 return FALSE;
946
947 return WinEnableWindow(hwndScroll, fEnable);
948}
949//******************************************************************************
950//******************************************************************************
951HWND OSLibWinQueryObjectWindow(VOID)
952{
953 return WinQueryObjectWindow(HWND_DESKTOP);
954}
955//******************************************************************************
956//******************************************************************************
957ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll)
958{
959 if(hwndScroll == NULL)
960 return 0;
961
962 return (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
963}
964//******************************************************************************
965//******************************************************************************
966ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw)
967{
968 ULONG oldPos;
969
970 if(hwndScroll == NULL)
971 return 0;
972
973 oldPos = (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
974
975 if(WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMSHORT(pos), MPFROMLONG(fRedraw)) == FALSE)
976 return 0;
977
978 return oldPos;
979}
980//******************************************************************************
981//******************************************************************************
982BOOL OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
983 int maxpos, int fRedraw)
984{
985 if(hwndScroll == NULL)
986 return 0;
987
988 return (BOOL)WinSendMsg( hwndScroll, SBM_SETSCROLLBAR,
989 MPFROMLONG(WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0)),
990 MPFROM2SHORT( minpos ,maxpos ) );
991}
992//******************************************************************************
993//******************************************************************************
994BOOL OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
995 int totalsize, int fRedraw)
996{
997 if(hwndScroll == NULL)
998 return 0;
999
1000 return (BOOL)WinSendMsg( hwndScroll, SBM_SETTHUMBSIZE,
1001 MPFROM2SHORT(pagesize, totalsize),
1002 0);
1003}
1004//******************************************************************************
1005//******************************************************************************
1006void OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd)
1007{
1008 switch(*scrollcmd)
1009 {
1010 case SB_LINEUP:
1011 *scrollcmd = SB_LINEUP_W;
1012 break;
1013 case SB_LINEDOWN:
1014 *scrollcmd = SB_LINEDOWN_W;
1015 break;
1016 case SB_PAGEUP:
1017 *scrollcmd = SB_PAGEUP_W;
1018 break;
1019 case SB_PAGEDOWN:
1020 *scrollcmd = SB_PAGEDOWN_W;
1021 break;
1022 case SB_SLIDERTRACK:
1023 *scrollcmd = SB_THUMBTRACK_W;
1024 break;
1025 case SB_SLIDERPOSITION:
1026 *scrollcmd = SB_THUMBPOSITION_W;
1027 break;
1028 case SB_ENDSCROLL:
1029 *scrollcmd = SB_ENDSCROLL_W;
1030 break;
1031 }
1032 *msg = (*msg == WM_HSCROLL) ? WM_HSCROLL_W : WM_VSCROLL_W;
1033 return;
1034}
1035//******************************************************************************
1036//******************************************************************************
1037void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, BOOL fTaskList)
1038{
1039 ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight,dwExStyle;
1040
1041 OSLibWinConvertStyle(dwStyle, &dwExStyle, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
1042
1043 if(fTaskList)
1044 {
1045 OSFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
1046 }
1047
1048// OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
1049 OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN);
1050
1051 WinSetWindowULong(hwnd, QWL_STYLE,
1052 (WinQueryWindowULong(hwnd, QWL_STYLE) & ~0xffff0000) |
1053 OSWinStyle);
1054
1055 if(OSFrameStyle & FCF_TITLEBAR)
1056 {
1057 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_TITLEBAR), hwnd, FALSE);
1058 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MENU), hwnd, FALSE);
1059 }
1060 else
1061 {
1062 WinSetParent(WinWindowFromID(hwnd, FID_TITLEBAR), HWND_OBJECT, FALSE);
1063 WinSetParent(WinWindowFromID(hwnd, FID_MENU), HWND_OBJECT, FALSE);
1064 }
1065 if(OSFrameStyle & FCF_SYSMENU)
1066 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_SYSMENU), hwnd, FALSE);
1067 else
1068 WinSetParent(WinWindowFromID(hwnd, FID_SYSMENU), HWND_OBJECT, FALSE);
1069
1070 if((OSFrameStyle & FCF_MINBUTTON) || (OSFrameStyle & FCF_MAXBUTTON))
1071 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MINMAX), hwnd, FALSE);
1072 else
1073 WinSetParent(WinWindowFromID(hwnd, FID_MINMAX), HWND_OBJECT, FALSE);
1074
1075 if(OSFrameStyle & FCF_VERTSCROLL)
1076 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_VERTSCROLL), hwnd, FALSE);
1077 else
1078 WinSetParent(WinWindowFromID(hwnd, FID_VERTSCROLL), HWND_OBJECT, FALSE);
1079
1080 if(OSFrameStyle & FCF_HORZSCROLL)
1081 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_HORZSCROLL), hwnd, FALSE);
1082 else
1083 WinSetParent(WinWindowFromID(hwnd, FID_HORZSCROLL), HWND_OBJECT, FALSE);
1084
1085#if 0
1086 WNDPARAMS wndparam = {0};
1087 FRAMECDATA framecdata = {0};
1088
1089 framecdata.cb = sizeof(FRAMECDATA);
1090
1091 wndparam.fsStatus = WPM_CTLDATA;
1092 wndparam.cbCtlData = framecdata.cb;
1093 wndparam.pCtlData = (PVOID)&framecdata;
1094 WinSendMsg(hwnd, WM_QUERYWINDOWPARAMS, &wndparam, 0);
1095
1096 wndparam.fsStatus = WPM_CTLDATA;
1097 wndparam.pCtlData = (PVOID)&framecdata;
1098 framecdata.flCreateFlags = OSFrameStyle;
1099 WinSendMsg(hwnd, WM_SETWINDOWPARAMS, &wndparam, 0);
1100#endif
1101
1102 WinSendMsg(hwnd, WM_UPDATEFRAME,
1103 MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX |
1104 FCF_MENU | FCF_VERTSCROLL | FCF_HORZSCROLL),
1105 MPVOID);
1106}
1107//******************************************************************************
1108//******************************************************************************
1109HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID)
1110{
1111 HWND hwndNext, hwndFound=0;
1112 HENUM henum;
1113
1114 henum = WinBeginEnumWindows(HWND_OBJECT);
1115 while ((hwndNext = WinGetNextWindow(henum)) != 0)
1116 {
1117 if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner &&
1118 WinQueryWindowUShort(hwndNext, QWS_ID) == ID)
1119 {
1120 hwndFound = hwndNext;
1121 break;
1122 }
1123 }
1124 WinEndEnumWindows(henum);
1125 return hwndFound;
1126}
1127//******************************************************************************
1128//******************************************************************************
1129BOOL OSLibSetWindowID(HWND hwnd, ULONG value)
1130{
1131 dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value));
1132 return WinSetWindowULong(hwnd, QWS_ID, value);
1133}
1134//******************************************************************************
1135//******************************************************************************
1136PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
1137{
1138 return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
1139}
1140//******************************************************************************
1141//******************************************************************************
1142BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
1143{
1144 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
1145
1146 WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT)pRect->left );
1147 WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT)(yHeight - pRect->top -
1148 (pRect->bottom - pRect->top)));
1149 WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
1150 WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
1151 return TRUE;
1152}
1153//******************************************************************************
1154//******************************************************************************
1155BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
1156{
1157 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
1158
1159 WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
1160 WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
1161 ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
1162 WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
1163 return TRUE;
1164}
1165//******************************************************************************
1166//******************************************************************************
1167BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
1168{
1169 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, FALSE );
1170}
1171//******************************************************************************
1172//******************************************************************************
1173BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
1174{
1175 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, TRUE );
1176}
1177//******************************************************************************
1178//******************************************************************************
1179BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable)
1180{
1181 return WinEnableWindowUpdate(hwnd,fEnable);
1182}
1183//******************************************************************************
1184//******************************************************************************
1185ULONG OSLibWinGetLastError()
1186{
1187 return WinGetLastError(GetThreadHAB()) & 0xFFFF;
1188}
Note: See TracBrowser for help on using the repository browser.