| 1 | /* $Id: window.cpp,v 1.5 1999-07-18 10:39:52 sandervl Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Win32 window apis for OS/2
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 1999 Sander van Leeuwen
|
|---|
| 6 | *
|
|---|
| 7 | * Parts based on Wine Windows code (windows\win.c)
|
|---|
| 8 | *
|
|---|
| 9 | * Copyright 1993, 1994 Alexandre Julliard
|
|---|
| 10 | *
|
|---|
| 11 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 12 | *
|
|---|
| 13 | *
|
|---|
| 14 | * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
|
|---|
| 15 | *
|
|---|
| 16 | */
|
|---|
| 17 |
|
|---|
| 18 | #include <os2win.h>
|
|---|
| 19 | #include <misc.h>
|
|---|
| 20 | #include <win32wnd.h>
|
|---|
| 21 |
|
|---|
| 22 | //******************************************************************************
|
|---|
| 23 | //******************************************************************************
|
|---|
| 24 | HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
|
|---|
| 25 | LPCSTR windowName, DWORD style, INT x,
|
|---|
| 26 | INT y, INT width, INT height,
|
|---|
| 27 | HWND parent, HMENU menu,
|
|---|
| 28 | HINSTANCE instance, LPVOID data )
|
|---|
| 29 | {
|
|---|
| 30 | Win32Window *window;
|
|---|
| 31 | ATOM classAtom;
|
|---|
| 32 | CREATESTRUCTA cs;
|
|---|
| 33 |
|
|---|
| 34 | if(exStyle & WS_EX_MDICHILD)
|
|---|
| 35 | return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
|---|
| 36 |
|
|---|
| 37 | /* Find the class atom */
|
|---|
| 38 | if (!(classAtom = GlobalFindAtomA(className)))
|
|---|
| 39 | {
|
|---|
| 40 | dprintf(("CreateWindowEx32A: bad class name "));
|
|---|
| 41 | if (!HIWORD(className)) {
|
|---|
| 42 | dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
|
|---|
| 43 | }
|
|---|
| 44 | else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
|
|---|
| 45 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 46 | return 0;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | /* Create the window */
|
|---|
| 50 | cs.lpCreateParams = data;
|
|---|
| 51 | cs.hInstance = instance;
|
|---|
| 52 | cs.hMenu = menu;
|
|---|
| 53 | cs.hwndParent = parent;
|
|---|
| 54 | cs.x = x;
|
|---|
| 55 | cs.y = y;
|
|---|
| 56 | cs.cx = width;
|
|---|
| 57 | cs.cy = height;
|
|---|
| 58 | cs.style = style;
|
|---|
| 59 | cs.lpszName = windowName;
|
|---|
| 60 | cs.lpszClass = className;
|
|---|
| 61 | cs.dwExStyle = exStyle;
|
|---|
| 62 | window = new Win32Window( &cs, classAtom, FALSE );
|
|---|
| 63 | if(window == NULL)
|
|---|
| 64 | {
|
|---|
| 65 | dprintf(("Win32Window creation failed!!"));
|
|---|
| 66 | return 0;
|
|---|
| 67 | }
|
|---|
| 68 | if(GetLastError() != 0)
|
|---|
| 69 | {
|
|---|
| 70 | dprintf(("Win32Window error found!!"));
|
|---|
| 71 | delete window;
|
|---|
| 72 | return 0;
|
|---|
| 73 | }
|
|---|
| 74 | return window->getWindowHandle();
|
|---|
| 75 | }
|
|---|
| 76 | //******************************************************************************
|
|---|
| 77 | //******************************************************************************
|
|---|
| 78 | HWND WIN32API CreateMDIWindowA(LPCSTR arg1, LPCSTR arg2, DWORD arg3,
|
|---|
| 79 | int arg4, int arg5, int arg6, int arg7,
|
|---|
| 80 | HWND arg8, HINSTANCE arg9, LPARAM arg10)
|
|---|
| 81 | {
|
|---|
| 82 | HWND hwnd;
|
|---|
| 83 |
|
|---|
| 84 | dprintf(("USER32: CreateMDIWindowA\n"));
|
|---|
| 85 |
|
|---|
| 86 | hwnd = O32_CreateMDIWindow((LPSTR)arg1, (LPSTR)arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
|---|
| 87 |
|
|---|
| 88 | dprintf(("USER32: CreateMDIWindowA returned %X\n", hwnd));
|
|---|
| 89 | return hwnd;
|
|---|
| 90 | }
|
|---|
| 91 | //******************************************************************************
|
|---|
| 92 | //******************************************************************************
|
|---|
| 93 | HWND WIN32API CreateMDIWindowW(LPCWSTR arg1, LPCWSTR arg2, DWORD arg3, int arg4,
|
|---|
| 94 | int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9,
|
|---|
| 95 | LPARAM arg10)
|
|---|
| 96 | {
|
|---|
| 97 | HWND hwnd;
|
|---|
| 98 | char *astring1 = NULL, *astring2 = NULL;
|
|---|
| 99 |
|
|---|
| 100 | if((int)arg1 >> 16 != 0) {
|
|---|
| 101 | astring1 = UnicodeToAsciiString((LPWSTR)arg1);
|
|---|
| 102 | }
|
|---|
| 103 | else astring1 = (char *)arg2;
|
|---|
| 104 |
|
|---|
| 105 | astring2 = UnicodeToAsciiString((LPWSTR)arg2);
|
|---|
| 106 |
|
|---|
| 107 | hwnd = O32_CreateMDIWindow(astring1, astring2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
|---|
| 108 |
|
|---|
| 109 | if(astring1) FreeAsciiString(astring1);
|
|---|
| 110 | FreeAsciiString(astring2);
|
|---|
| 111 | dprintf(("USER32: CreateMDIWindowW hwnd = %X\n", hwnd));
|
|---|
| 112 | return(hwnd);
|
|---|
| 113 | }
|
|---|
| 114 | //******************************************************************************
|
|---|
| 115 | //******************************************************************************
|
|---|
| 116 | HWND WIN32API CreateWindowExW(DWORD arg1,
|
|---|
| 117 | LPCWSTR arg2,
|
|---|
| 118 | LPCWSTR arg3,
|
|---|
| 119 | DWORD dwStyle,
|
|---|
| 120 | int arg5,
|
|---|
| 121 | int arg6,
|
|---|
| 122 | int arg7,
|
|---|
| 123 | int arg8,
|
|---|
| 124 | HWND arg9,
|
|---|
| 125 | HMENU arg10,
|
|---|
| 126 | HINSTANCE arg11,
|
|---|
| 127 | PVOID arg12)
|
|---|
| 128 | {
|
|---|
| 129 | HWND hwnd;
|
|---|
| 130 | char *astring1 = NULL,
|
|---|
| 131 | *astring2 = NULL;
|
|---|
| 132 |
|
|---|
| 133 | /* @@@PH 98/06/21 changed to call OS2CreateWindowExA */
|
|---|
| 134 | if(HIWORD(arg2) != 0)
|
|---|
| 135 | astring1 = UnicodeToAsciiString((LPWSTR)arg2);
|
|---|
| 136 | else
|
|---|
| 137 | astring1 = (char *)arg2;
|
|---|
| 138 |
|
|---|
| 139 | astring2 = UnicodeToAsciiString((LPWSTR)arg3);
|
|---|
| 140 |
|
|---|
| 141 | #ifdef DEBUG
|
|---|
| 142 | WriteLog("USER32: CreateWindowExW: dwExStyle = %X\n", arg1);
|
|---|
| 143 | if((int)arg2 >> 16 != 0)
|
|---|
| 144 | WriteLog("USER32: CreateWindow: classname = %s\n", astring1);
|
|---|
| 145 | else WriteLog("USER32: CreateWindow: classname = %X\n", arg2);
|
|---|
| 146 | WriteLog("USER32: CreateWindow: windowname= %s\n", astring2);
|
|---|
| 147 | WriteLog("USER32: CreateWindow: dwStyle = %X\n", dwStyle);
|
|---|
| 148 | WriteLog("USER32: CreateWindow: x = %d\n", arg5);
|
|---|
| 149 | WriteLog("USER32: CreateWindow: y = %d\n", arg6);
|
|---|
| 150 | WriteLog("USER32: CreateWindow: nWidth = %d\n", arg7);
|
|---|
| 151 | WriteLog("USER32: CreateWindow: nHeight = %d\n", arg8);
|
|---|
| 152 | WriteLog("USER32: CreateWindow: parent = %X\n", arg9);
|
|---|
| 153 | WriteLog("USER32: CreateWindow: hwmenu = %X\n", arg10);
|
|---|
| 154 | WriteLog("USER32: CreateWindow: hinstance = %X\n", arg11);
|
|---|
| 155 | WriteLog("USER32: CreateWindow: param = %X\n", arg12);
|
|---|
| 156 | #endif
|
|---|
| 157 |
|
|---|
| 158 | hwnd = CreateWindowExA(arg1,
|
|---|
| 159 | astring1,
|
|---|
| 160 | astring2,
|
|---|
| 161 | dwStyle,
|
|---|
| 162 | arg5,
|
|---|
| 163 | arg6,
|
|---|
| 164 | arg7,
|
|---|
| 165 | arg8,
|
|---|
| 166 | arg9,
|
|---|
| 167 | arg10,
|
|---|
| 168 | arg11,
|
|---|
| 169 | arg12);
|
|---|
| 170 |
|
|---|
| 171 | if(HIWORD(arg1) != 0)
|
|---|
| 172 | FreeAsciiString(astring1);
|
|---|
| 173 |
|
|---|
| 174 | FreeAsciiString(astring2);
|
|---|
| 175 |
|
|---|
| 176 | #ifdef DEBUG
|
|---|
| 177 | WriteLog("USER32: ************CreateWindowExW hwnd = %X (%X)\n", hwnd, GetLastError());
|
|---|
| 178 | #endif
|
|---|
| 179 | return(hwnd);
|
|---|
| 180 | }
|
|---|
| 181 | //******************************************************************************
|
|---|
| 182 | //******************************************************************************
|
|---|
| 183 | BOOL WIN32API DestroyWindow(HWND hwnd)
|
|---|
| 184 | {
|
|---|
| 185 | Win32Window *window;
|
|---|
| 186 |
|
|---|
| 187 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 188 | if(!window) {
|
|---|
| 189 | dprintf(("DestroyWindow, window %x not found", hwnd));
|
|---|
| 190 | return 0;
|
|---|
| 191 | }
|
|---|
| 192 | dprintf(("DestroyWindow %x", hwnd));
|
|---|
| 193 | return window->DestroyWindow();
|
|---|
| 194 | }
|
|---|
| 195 | //******************************************************************************
|
|---|
| 196 | //******************************************************************************
|
|---|
| 197 | HWND WIN32API SetActiveWindow( HWND hwnd)
|
|---|
| 198 | {
|
|---|
| 199 | Win32Window *window;
|
|---|
| 200 |
|
|---|
| 201 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 202 | if(!window) {
|
|---|
| 203 | dprintf(("SetActiveWindow, window %x not found", hwnd));
|
|---|
| 204 | return 0;
|
|---|
| 205 | }
|
|---|
| 206 | dprintf(("SetActiveWindow %x", hwnd));
|
|---|
| 207 | return window->SetActiveWindow();
|
|---|
| 208 | }
|
|---|
| 209 | //******************************************************************************
|
|---|
| 210 | //******************************************************************************
|
|---|
| 211 | HWND WIN32API GetParent( HWND hwnd)
|
|---|
| 212 | {
|
|---|
| 213 | Win32Window *window;
|
|---|
| 214 |
|
|---|
| 215 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 216 | if(!window) {
|
|---|
| 217 | dprintf(("GetParent, window %x not found", hwnd));
|
|---|
| 218 | return 0;
|
|---|
| 219 | }
|
|---|
| 220 | dprintf(("GetParent %x", hwnd));
|
|---|
| 221 | return window->GetParent();
|
|---|
| 222 | }
|
|---|
| 223 | //******************************************************************************
|
|---|
| 224 | //******************************************************************************
|
|---|
| 225 | HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
|
|---|
| 226 | {
|
|---|
| 227 | Win32Window *window;
|
|---|
| 228 |
|
|---|
| 229 | window = Win32Window::GetWindowFromHandle(hwndChild);
|
|---|
| 230 | if(!window) {
|
|---|
| 231 | dprintf(("SetParent, window %x not found", hwndChild));
|
|---|
| 232 | return 0;
|
|---|
| 233 | }
|
|---|
| 234 | dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
|
|---|
| 235 | return window->SetParent(hwndNewParent);
|
|---|
| 236 | }
|
|---|
| 237 | //******************************************************************************
|
|---|
| 238 | //******************************************************************************
|
|---|
| 239 | BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
|
|---|
| 240 | {
|
|---|
| 241 | Win32Window *window;
|
|---|
| 242 |
|
|---|
| 243 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 244 | if(!window) {
|
|---|
| 245 | dprintf(("IsChild, window %x not found", hwnd));
|
|---|
| 246 | return 0;
|
|---|
| 247 | }
|
|---|
| 248 | dprintf(("IsChild %x %x", hwndParent, hwnd));
|
|---|
| 249 | return window->IsChild(hwndParent);
|
|---|
| 250 | }
|
|---|
| 251 | //******************************************************************************
|
|---|
| 252 | //******************************************************************************
|
|---|
| 253 | HWND WIN32API GetTopWindow( HWND hwnd)
|
|---|
| 254 | {
|
|---|
| 255 | Win32Window *window;
|
|---|
| 256 |
|
|---|
| 257 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 258 | if(!window) {
|
|---|
| 259 | dprintf(("GetTopWindow, window %x not found", hwnd));
|
|---|
| 260 | return 0;
|
|---|
| 261 | }
|
|---|
| 262 | dprintf(("GetTopWindow %x", hwnd));
|
|---|
| 263 | return window->GetTopWindow();
|
|---|
| 264 | }
|
|---|
| 265 | //******************************************************************************
|
|---|
| 266 | //******************************************************************************
|
|---|
| 267 | BOOL WIN32API UpdateWindow(HWND hwnd)
|
|---|
| 268 | {
|
|---|
| 269 | Win32Window *window;
|
|---|
| 270 |
|
|---|
| 271 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 272 | if(!window) {
|
|---|
| 273 | dprintf(("UpdateWindow, window %x not found", hwnd));
|
|---|
| 274 | return 0;
|
|---|
| 275 | }
|
|---|
| 276 | dprintf(("UpdateWindow %x", hwnd));
|
|---|
| 277 | return window->UpdateWindow();
|
|---|
| 278 | }
|
|---|
| 279 | //******************************************************************************
|
|---|
| 280 | //******************************************************************************
|
|---|
| 281 | BOOL WIN32API IsIconic( HWND hwnd)
|
|---|
| 282 | {
|
|---|
| 283 | Win32Window *window;
|
|---|
| 284 |
|
|---|
| 285 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 286 | if(!window) {
|
|---|
| 287 | dprintf(("IsIconic, window %x not found", hwnd));
|
|---|
| 288 | return 0;
|
|---|
| 289 | }
|
|---|
| 290 | dprintf(("IsIconic %x", hwnd));
|
|---|
| 291 | return window->IsIconic();
|
|---|
| 292 | }
|
|---|
| 293 | //******************************************************************************
|
|---|
| 294 | //******************************************************************************
|
|---|
| 295 | HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
|
|---|
| 296 | {
|
|---|
| 297 | Win32Window *window;
|
|---|
| 298 |
|
|---|
| 299 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 300 | if(!window) {
|
|---|
| 301 | dprintf(("GetWindow, window %x not found", hwnd));
|
|---|
| 302 | return 0;
|
|---|
| 303 | }
|
|---|
| 304 | dprintf(("GetWindow %x %d", hwnd, uCmd));
|
|---|
| 305 | return window->GetWindow(uCmd);
|
|---|
| 306 | }
|
|---|
| 307 | //******************************************************************************
|
|---|
| 308 | //******************************************************************************
|
|---|
| 309 | HDC WIN32API GetWindowDC(HWND arg1)
|
|---|
| 310 | {
|
|---|
| 311 | #ifdef DEBUG
|
|---|
| 312 | WriteLog("USER32: GetWindowDC\n");
|
|---|
| 313 | #endif
|
|---|
| 314 | return O32_GetWindowDC(arg1);
|
|---|
| 315 | }
|
|---|
| 316 | //******************************************************************************
|
|---|
| 317 | //******************************************************************************
|
|---|
| 318 | BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
|
|---|
| 319 | {
|
|---|
| 320 | Win32Window *window;
|
|---|
| 321 |
|
|---|
| 322 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 323 | if(!window) {
|
|---|
| 324 | dprintf(("EnableWindow, window %x not found", hwnd));
|
|---|
| 325 | return 0;
|
|---|
| 326 | }
|
|---|
| 327 | dprintf(("EnableWindow %x %d", hwnd, fEnable));
|
|---|
| 328 | return window->EnableWindow(fEnable);
|
|---|
| 329 | }
|
|---|
| 330 | //******************************************************************************
|
|---|
| 331 | //******************************************************************************
|
|---|
| 332 | BOOL WIN32API BringWindowToTop(HWND hwnd)
|
|---|
| 333 | {
|
|---|
| 334 | Win32Window *window;
|
|---|
| 335 |
|
|---|
| 336 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 337 | if(!window) {
|
|---|
| 338 | dprintf(("BringWindowToTop, window %x not found", hwnd));
|
|---|
| 339 | return 0;
|
|---|
| 340 | }
|
|---|
| 341 | dprintf(("BringWindowToTop %x", hwnd));
|
|---|
| 342 | return window->BringWindowToTop();
|
|---|
| 343 | }
|
|---|
| 344 | //******************************************************************************
|
|---|
| 345 | //******************************************************************************
|
|---|
| 346 | HWND WIN32API GetActiveWindow()
|
|---|
| 347 | {
|
|---|
| 348 | return Win32Window::GetActiveWindow();
|
|---|
| 349 | }
|
|---|
| 350 | //******************************************************************************
|
|---|
| 351 | //******************************************************************************
|
|---|
| 352 | BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
|
|---|
| 353 | {
|
|---|
| 354 | Win32Window *window;
|
|---|
| 355 |
|
|---|
| 356 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 357 | if(!window) {
|
|---|
| 358 | dprintf(("ShowWindow, window %x not found", hwnd));
|
|---|
| 359 | return 0;
|
|---|
| 360 | }
|
|---|
| 361 | dprintf(("ShowWindow %x", hwnd));
|
|---|
| 362 | return window->ShowWindow(nCmdShow);
|
|---|
| 363 | }
|
|---|
| 364 | //******************************************************************************
|
|---|
| 365 | //******************************************************************************
|
|---|
| 366 | BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
|
|---|
| 367 | {
|
|---|
| 368 | Win32Window *window;
|
|---|
| 369 |
|
|---|
| 370 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 371 | if(!window) {
|
|---|
| 372 | dprintf(("SetWindowPos, window %x not found", hwnd));
|
|---|
| 373 | return 0;
|
|---|
| 374 | }
|
|---|
| 375 | dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
|
|---|
| 376 | return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
|
|---|
| 377 | }
|
|---|
| 378 | //******************************************************************************
|
|---|
| 379 | //******************************************************************************
|
|---|
| 380 | BOOL WIN32API IsWindow( HWND hwnd)
|
|---|
| 381 | {
|
|---|
| 382 | Win32Window *window;
|
|---|
| 383 |
|
|---|
| 384 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 385 | if(!window) {
|
|---|
| 386 | dprintf(("IsWindow, window %x not found", hwnd));
|
|---|
| 387 | return FALSE;
|
|---|
| 388 | }
|
|---|
| 389 | dprintf(("IsWindow %x", hwnd));
|
|---|
| 390 | return window->IsWindow();
|
|---|
| 391 | }
|
|---|
| 392 | //******************************************************************************
|
|---|
| 393 | //******************************************************************************
|
|---|
| 394 | BOOL WIN32API IsWindowEnabled( HWND hwnd)
|
|---|
| 395 | {
|
|---|
| 396 | Win32Window *window;
|
|---|
| 397 |
|
|---|
| 398 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 399 | if(!window) {
|
|---|
| 400 | dprintf(("IsWindowEnabled, window %x not found", hwnd));
|
|---|
| 401 | return 0;
|
|---|
| 402 | }
|
|---|
| 403 | dprintf(("IsWindowEnabled %x", hwnd));
|
|---|
| 404 | return window->IsWindowEnabled();
|
|---|
| 405 | }
|
|---|
| 406 | //******************************************************************************
|
|---|
| 407 | //******************************************************************************
|
|---|
| 408 | BOOL WIN32API IsWindowVisible( HWND hwnd)
|
|---|
| 409 | {
|
|---|
| 410 | Win32Window *window;
|
|---|
| 411 |
|
|---|
| 412 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 413 | if(!window) {
|
|---|
| 414 | dprintf(("IsWindowVisible, window %x not found", hwnd));
|
|---|
| 415 | return 0;
|
|---|
| 416 | }
|
|---|
| 417 | dprintf(("IsWindowVisible %x", hwnd));
|
|---|
| 418 | return window->IsWindowVisible();
|
|---|
| 419 | }
|
|---|
| 420 | /***********************************************************************
|
|---|
| 421 | * GetInternalWindowPos (USER32.245)
|
|---|
| 422 | */
|
|---|
| 423 | UINT WIN32API GetInternalWindowPos(HWND hwnd,
|
|---|
| 424 | LPRECT rectWnd,
|
|---|
| 425 | LPPOINT ptIcon )
|
|---|
| 426 | {
|
|---|
| 427 | WINDOWPLACEMENT wndpl;
|
|---|
| 428 |
|
|---|
| 429 | dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
|
|---|
| 430 | hwnd,
|
|---|
| 431 | rectWnd,
|
|---|
| 432 | ptIcon));
|
|---|
| 433 |
|
|---|
| 434 | if (O32_GetWindowPlacement( hwnd, &wndpl ))
|
|---|
| 435 | {
|
|---|
| 436 | if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
|
|---|
| 437 | if (ptIcon) *ptIcon = wndpl.ptMinPosition;
|
|---|
| 438 | return wndpl.showCmd;
|
|---|
| 439 | }
|
|---|
| 440 | return 0;
|
|---|
| 441 | }
|
|---|
| 442 | //******************************************************************************
|
|---|
| 443 | //******************************************************************************
|
|---|
| 444 | BOOL WIN32API IsZoomed( HWND arg1)
|
|---|
| 445 | {
|
|---|
| 446 | #ifdef DEBUG
|
|---|
| 447 | WriteLog("USER32: IsZoomed\n");
|
|---|
| 448 | #endif
|
|---|
| 449 | return O32_IsZoomed(arg1);
|
|---|
| 450 | }
|
|---|
| 451 | //******************************************************************************
|
|---|
| 452 | //******************************************************************************
|
|---|
| 453 | BOOL WIN32API LockWindowUpdate( HWND arg1)
|
|---|
| 454 | {
|
|---|
| 455 | #ifdef DEBUG
|
|---|
| 456 | WriteLog("USER32: LockWindowUpdate\n");
|
|---|
| 457 | #endif
|
|---|
| 458 | return O32_LockWindowUpdate(arg1);
|
|---|
| 459 | }
|
|---|
| 460 | //******************************************************************************
|
|---|
| 461 | //******************************************************************************
|
|---|
| 462 | BOOL WIN32API RedrawWindow( HWND arg1, const RECT * arg2, HRGN arg3, UINT arg4)
|
|---|
| 463 | {
|
|---|
| 464 | BOOL rc;
|
|---|
| 465 |
|
|---|
| 466 | rc = O32_RedrawWindow(arg1, arg2, arg3, arg4);
|
|---|
| 467 | #ifdef DEBUG
|
|---|
| 468 | WriteLog("USER32: RedrawWindow %X , %X, %X, %X returned %d\n", arg1, arg2, arg3, arg4, rc);
|
|---|
| 469 | #endif
|
|---|
| 470 | InvalidateRect(arg1, arg2, TRUE);
|
|---|
| 471 | UpdateWindow(arg1);
|
|---|
| 472 | SendMessageA(arg1, WM_PAINT, 0, 0);
|
|---|
| 473 | return(rc);
|
|---|
| 474 | }
|
|---|
| 475 | //******************************************************************************
|
|---|
| 476 | //******************************************************************************
|
|---|
| 477 | BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
|
|---|
| 478 | {
|
|---|
| 479 | Win32Window *window;
|
|---|
| 480 |
|
|---|
| 481 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 482 | if(!window) {
|
|---|
| 483 | dprintf(("GetWindowRect, window %x not found", hwnd));
|
|---|
| 484 | return 0;
|
|---|
| 485 | }
|
|---|
| 486 | dprintf(("GetWindowRect %x", hwnd));
|
|---|
| 487 | return window->GetWindowRect(pRect);
|
|---|
| 488 | }
|
|---|
| 489 | //******************************************************************************
|
|---|
| 490 | //******************************************************************************
|
|---|
| 491 | int WIN32API GetWindowTextLengthA( HWND hwnd)
|
|---|
| 492 | {
|
|---|
| 493 | Win32Window *window;
|
|---|
| 494 |
|
|---|
| 495 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 496 | if(!window) {
|
|---|
| 497 | dprintf(("GetWindowTextLength, window %x not found", hwnd));
|
|---|
| 498 | return 0;
|
|---|
| 499 | }
|
|---|
| 500 | dprintf(("GetWindowTextLength %x", hwnd));
|
|---|
| 501 | return window->GetWindowTextLengthA();
|
|---|
| 502 | }
|
|---|
| 503 | //******************************************************************************
|
|---|
| 504 | //******************************************************************************
|
|---|
| 505 | int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
|
|---|
| 506 | {
|
|---|
| 507 | Win32Window *window;
|
|---|
| 508 |
|
|---|
| 509 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 510 | if(!window) {
|
|---|
| 511 | dprintf(("GetWindowTextA, window %x not found", hwnd));
|
|---|
| 512 | return 0;
|
|---|
| 513 | }
|
|---|
| 514 | dprintf(("GetWindowTextA %x", hwnd));
|
|---|
| 515 | return window->GetWindowTextA(lpsz, cch);
|
|---|
| 516 | }
|
|---|
| 517 | //******************************************************************************
|
|---|
| 518 | //******************************************************************************
|
|---|
| 519 | BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
|
|---|
| 520 | {
|
|---|
| 521 | Win32Window *window;
|
|---|
| 522 |
|
|---|
| 523 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 524 | if(!window) {
|
|---|
| 525 | dprintf(("SetWindowTextA, window %x not found", hwnd));
|
|---|
| 526 | return 0;
|
|---|
| 527 | }
|
|---|
| 528 | dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
|
|---|
| 529 | return window->SetWindowTextA(lpsz);
|
|---|
| 530 | }
|
|---|
| 531 | //******************************************************************************
|
|---|
| 532 | //******************************************************************************
|
|---|
| 533 | BOOL WIN32API SetWindowTextW( HWND arg1, LPCWSTR arg2)
|
|---|
| 534 | {
|
|---|
| 535 | char *astring = UnicodeToAsciiString((LPWSTR)arg2);
|
|---|
| 536 | BOOL rc;
|
|---|
| 537 |
|
|---|
| 538 | rc = SetWindowTextA(arg1, (LPCSTR)astring);
|
|---|
| 539 | dprintf(("USER32: SetWindowTextW %X %s returned %d\n", arg1, astring, rc));
|
|---|
| 540 | FreeAsciiString(astring);
|
|---|
| 541 | return(rc);
|
|---|
| 542 | }
|
|---|
| 543 | //******************************************************************************
|
|---|
| 544 | //******************************************************************************
|
|---|
| 545 | BOOL WIN32API SetForegroundWindow(HWND arg1)
|
|---|
| 546 | {
|
|---|
| 547 | #ifdef DEBUG
|
|---|
| 548 | WriteLog("USER32: SetForegroundWindow\n");
|
|---|
| 549 | #endif
|
|---|
| 550 | return O32_SetForegroundWindow(arg1);
|
|---|
| 551 | }
|
|---|
| 552 | //******************************************************************************
|
|---|
| 553 | //******************************************************************************
|
|---|
| 554 | BOOL WIN32API GetClientRect( HWND arg1, PRECT arg2)
|
|---|
| 555 | {
|
|---|
| 556 | #ifdef DEBUG
|
|---|
| 557 | WriteLog("USER32: GetClientRect of %X\n", arg1);
|
|---|
| 558 | #endif
|
|---|
| 559 |
|
|---|
| 560 | return O32_GetClientRect(arg1, arg2);
|
|---|
| 561 | }
|
|---|
| 562 | //******************************************************************************
|
|---|
| 563 | //******************************************************************************
|
|---|
| 564 | HWND WIN32API FindWindowA(LPCSTR arg1, LPCSTR arg2)
|
|---|
| 565 | {
|
|---|
| 566 | #ifdef DEBUG
|
|---|
| 567 | WriteLog("USER32: FindWindow\n");
|
|---|
| 568 | #endif
|
|---|
| 569 | return O32_FindWindow(arg1, arg2);
|
|---|
| 570 | }
|
|---|
| 571 | //******************************************************************************
|
|---|
| 572 | //******************************************************************************
|
|---|
| 573 | HWND WIN32API FindWindowExA(HWND arg1, HWND arg2, LPCSTR arg3, LPCSTR arg4)
|
|---|
| 574 | {
|
|---|
| 575 | #ifdef DEBUG
|
|---|
| 576 | WriteLog("USER32: FindWindowExA, not completely implemented\n");
|
|---|
| 577 | #endif
|
|---|
| 578 | return O32_FindWindow(arg3, arg4);
|
|---|
| 579 | }
|
|---|
| 580 | //******************************************************************************
|
|---|
| 581 | //******************************************************************************
|
|---|
| 582 | BOOL WIN32API FlashWindow( HWND arg1, BOOL arg2)
|
|---|
| 583 | {
|
|---|
| 584 | #ifdef DEBUG
|
|---|
| 585 | WriteLog("USER32: FlashWindow\n");
|
|---|
| 586 | #endif
|
|---|
| 587 | return O32_FlashWindow(arg1, arg2);
|
|---|
| 588 | }
|
|---|
| 589 | //******************************************************************************
|
|---|
| 590 | //******************************************************************************
|
|---|
| 591 | BOOL WIN32API MoveWindow(HWND arg1, int arg2, int arg3, int arg4, int arg5, BOOL arg6)
|
|---|
| 592 | {
|
|---|
| 593 | BOOL rc;
|
|---|
| 594 |
|
|---|
| 595 | rc = O32_MoveWindow(arg1, arg2, arg3, arg4, arg5, arg6);
|
|---|
| 596 | dprintf(("USER32: MoveWindow %X to (%d,%d) size (%d,%d), repaint = %d returned %d\n", arg1, arg2, arg3, arg4, arg5, arg6, rc));
|
|---|
| 597 | return(rc);
|
|---|
| 598 | }
|
|---|
| 599 | //******************************************************************************
|
|---|
| 600 | //******************************************************************************
|
|---|
| 601 | BOOL WIN32API AdjustWindowRect( PRECT arg1, DWORD arg2, BOOL arg3)
|
|---|
| 602 | {
|
|---|
| 603 | #ifdef DEBUG
|
|---|
| 604 | WriteLog("USER32: AdjustWindowRect\n");
|
|---|
| 605 | #endif
|
|---|
| 606 | return O32_AdjustWindowRect(arg1, arg2, arg3);
|
|---|
| 607 | }
|
|---|
| 608 | //******************************************************************************
|
|---|
| 609 | //******************************************************************************
|
|---|
| 610 | BOOL WIN32API AdjustWindowRectEx( PRECT arg1, DWORD arg2, BOOL arg3, DWORD arg4)
|
|---|
| 611 | {
|
|---|
| 612 | #ifdef DEBUG
|
|---|
| 613 | WriteLog("USER32: AdjustWindowRectEx\n");
|
|---|
| 614 | #endif
|
|---|
| 615 | return O32_AdjustWindowRectEx(arg1, arg2, arg3, arg4);
|
|---|
| 616 | }
|
|---|
| 617 | //******************************************************************************
|
|---|
| 618 | //******************************************************************************
|
|---|
| 619 | BOOL WIN32API ClientToScreen( HWND arg1, PPOINT arg2)
|
|---|
| 620 | {
|
|---|
| 621 | #ifdef DEBUG
|
|---|
| 622 | //// WriteLog("USER32: ClientToScreen\n");
|
|---|
| 623 | #endif
|
|---|
| 624 | return O32_ClientToScreen(arg1, arg2);
|
|---|
| 625 | }
|
|---|
| 626 | //******************************************************************************
|
|---|
| 627 | //******************************************************************************
|
|---|
| 628 | HDWP WIN32API BeginDeferWindowPos( int arg1)
|
|---|
| 629 | {
|
|---|
| 630 | #ifdef DEBUG
|
|---|
| 631 | WriteLog("USER32: BeginDeferWindowPos\n");
|
|---|
| 632 | #endif
|
|---|
| 633 | return O32_BeginDeferWindowPos(arg1);
|
|---|
| 634 | }
|
|---|
| 635 | //******************************************************************************
|
|---|
| 636 | //******************************************************************************
|
|---|
| 637 | HDWP WIN32API DeferWindowPos( HDWP arg1, HWND arg2, HWND arg3, int arg4, int arg5, int arg6, int arg7, UINT arg8)
|
|---|
| 638 | {
|
|---|
| 639 | #ifdef DEBUG
|
|---|
| 640 | WriteLog("USER32: DeferWindowPos\n");
|
|---|
| 641 | #endif
|
|---|
| 642 | return O32_DeferWindowPos(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
|---|
| 643 | }
|
|---|
| 644 | //******************************************************************************
|
|---|
| 645 | //******************************************************************************
|
|---|
| 646 | HWND WIN32API ChildWindowFromPoint( HWND arg1, POINT arg2)
|
|---|
| 647 | {
|
|---|
| 648 | #ifdef DEBUG
|
|---|
| 649 | WriteLog("USER32: ChildWindowFromPoint\n");
|
|---|
| 650 | #endif
|
|---|
| 651 | return O32_ChildWindowFromPoint(arg1, arg2);
|
|---|
| 652 | }
|
|---|
| 653 | //******************************************************************************
|
|---|
| 654 | //******************************************************************************
|
|---|
| 655 | HWND WIN32API ChildWindowFromPointEx(HWND arg1, POINT arg2, UINT uFlags)
|
|---|
| 656 | {
|
|---|
| 657 | #ifdef DEBUG
|
|---|
| 658 | WriteLog("USER32: ChildWindowFromPointEx, not completely supported!\n");
|
|---|
| 659 | #endif
|
|---|
| 660 | return O32_ChildWindowFromPoint(arg1, arg2);
|
|---|
| 661 | }
|
|---|
| 662 | //******************************************************************************
|
|---|
| 663 | //******************************************************************************
|
|---|
| 664 | BOOL WIN32API CloseWindow( HWND arg1)
|
|---|
| 665 | {
|
|---|
| 666 | #ifdef DEBUG
|
|---|
| 667 | WriteLog("USER32: CloseWindow\n");
|
|---|
| 668 | #endif
|
|---|
| 669 | return O32_CloseWindow(arg1);
|
|---|
| 670 | }
|
|---|
| 671 | //******************************************************************************
|
|---|
| 672 | //******************************************************************************
|
|---|
| 673 | HWND WIN32API WindowFromDC( HDC arg1)
|
|---|
| 674 | {
|
|---|
| 675 | #ifdef DEBUG
|
|---|
| 676 | WriteLog("USER32: WindowFromDC\n");
|
|---|
| 677 | #endif
|
|---|
| 678 | return O32_WindowFromDC(arg1);
|
|---|
| 679 | }
|
|---|
| 680 | //******************************************************************************
|
|---|
| 681 | //******************************************************************************
|
|---|
| 682 | HWND WIN32API WindowFromPoint( POINT arg1)
|
|---|
| 683 | {
|
|---|
| 684 | #ifdef DEBUG
|
|---|
| 685 | WriteLog("USER32: WindowFromPoint\n");
|
|---|
| 686 | #endif
|
|---|
| 687 | return O32_WindowFromPoint(arg1);
|
|---|
| 688 | }
|
|---|
| 689 | //******************************************************************************
|
|---|
| 690 | //******************************************************************************
|
|---|
| 691 | BOOL WIN32API IsWindowUnicode(HWND hwnd)
|
|---|
| 692 | {
|
|---|
| 693 | #ifdef DEBUG
|
|---|
| 694 | WriteLog("USER32: IsWindowUnicode, not implemented\n");
|
|---|
| 695 | #endif
|
|---|
| 696 | return(FALSE);
|
|---|
| 697 | }
|
|---|
| 698 | /*****************************************************************************
|
|---|
| 699 | * Name : WORD WIN32API CascadeWindows
|
|---|
| 700 | * Purpose : The CascadeWindows function cascades the specified windows or
|
|---|
| 701 | * the child windows of the specified parent window.
|
|---|
| 702 | * Parameters: HWND hwndParent handle of parent window
|
|---|
| 703 | * UINT wHow types of windows not to arrange
|
|---|
| 704 | * CONST RECT * lpRect rectangle to arrange windows in
|
|---|
| 705 | * UINT cKids number of windows to arrange
|
|---|
| 706 | * const HWND FAR * lpKids array of window handles
|
|---|
| 707 | * Variables :
|
|---|
| 708 | * Result : If the function succeeds, the return value is the number of windows arranged.
|
|---|
| 709 | * If the function fails, the return value is zero.
|
|---|
| 710 | * Remark :
|
|---|
| 711 | * Status : UNTESTED STUB
|
|---|
| 712 | *
|
|---|
| 713 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 714 | *****************************************************************************/
|
|---|
| 715 |
|
|---|
| 716 | WORD WIN32API CascadeWindows(HWND hwndParent,
|
|---|
| 717 | UINT wHow,
|
|---|
| 718 | CONST LPRECT lpRect,
|
|---|
| 719 | UINT cKids,
|
|---|
| 720 | const HWND *lpKids)
|
|---|
| 721 | {
|
|---|
| 722 | dprintf(("USER32:CascadeWindows(%08xh,%u,%08xh,%u,%08x) not implemented.\n",
|
|---|
| 723 | hwndParent,
|
|---|
| 724 | wHow,
|
|---|
| 725 | lpRect,
|
|---|
| 726 | cKids,
|
|---|
| 727 | lpKids));
|
|---|
| 728 |
|
|---|
| 729 | return (0);
|
|---|
| 730 | }
|
|---|
| 731 | /*****************************************************************************
|
|---|
| 732 | * Name : HWND WIN32API FindWindowExW
|
|---|
| 733 | * Purpose : The FindWindowEx function retrieves the handle of a window whose
|
|---|
| 734 | * class name and window name match the specified strings. The
|
|---|
| 735 | * function searches child windows, beginning with the one following
|
|---|
| 736 | * the given child window.
|
|---|
| 737 | * Parameters: HWND hwndParent handle of parent window
|
|---|
| 738 | * HWND hwndChildAfter handle of a child window
|
|---|
| 739 | * LPCTSTR lpszClass address of class name
|
|---|
| 740 | * LPCTSTR lpszWindow address of window name
|
|---|
| 741 | * Variables :
|
|---|
| 742 | * Result : If the function succeeds, the return value is the handle of the
|
|---|
| 743 | * window that has the specified class and window names.
|
|---|
| 744 | * If the function fails, the return value is NULL. To get extended
|
|---|
| 745 | * error information, call GetLastError.
|
|---|
| 746 | * Remark :
|
|---|
| 747 | * Status : UNTESTED STUB
|
|---|
| 748 | *
|
|---|
| 749 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 750 | *****************************************************************************/
|
|---|
| 751 |
|
|---|
| 752 | HWND WIN32API FindWindowExW(HWND hwndParent,
|
|---|
| 753 | HWND hwndChildAfter,
|
|---|
| 754 | LPCWSTR lpszClass,
|
|---|
| 755 | LPCWSTR lpszWindow)
|
|---|
| 756 | {
|
|---|
| 757 | dprintf(("USER32:FindWindowExW (%08xh,%08xh,%s,%s) not implemented.\n",
|
|---|
| 758 | hwndParent,
|
|---|
| 759 | hwndChildAfter,
|
|---|
| 760 | lpszClass,
|
|---|
| 761 | lpszWindow));
|
|---|
| 762 |
|
|---|
| 763 | return (NULL);
|
|---|
| 764 | }
|
|---|
| 765 | /*****************************************************************************
|
|---|
| 766 | * Name : BOOL WIN32API SwitchToThisWindow
|
|---|
| 767 | * Purpose : Unknown
|
|---|
| 768 | * Parameters: Unknown
|
|---|
| 769 | * Variables :
|
|---|
| 770 | * Result :
|
|---|
| 771 | * Remark :
|
|---|
| 772 | * Status : UNTESTED UNKNOWN STUB
|
|---|
| 773 | *
|
|---|
| 774 | * Author : Patrick Haller [Wed, 1998/06/16 11:55]
|
|---|
| 775 | *****************************************************************************/
|
|---|
| 776 |
|
|---|
| 777 | BOOL WIN32API SwitchToThisWindow(HWND hwnd,
|
|---|
| 778 | BOOL x2)
|
|---|
| 779 | {
|
|---|
| 780 | dprintf(("USER32: SwitchToThisWindow(%08xh,%08xh) not implemented.\n",
|
|---|
| 781 | hwnd,
|
|---|
| 782 | x2));
|
|---|
| 783 |
|
|---|
| 784 | return (FALSE); /* default */
|
|---|
| 785 | }
|
|---|
| 786 | //******************************************************************************
|
|---|
| 787 | //******************************************************************************
|
|---|