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