| 1 | /* $Id: windowmsg.cpp,v 1.6 1999-07-17 11:52:24 sandervl Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Win32 window message APIs for OS/2
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 1999 Sander van Leeuwen
|
|---|
| 6 | *
|
|---|
| 7 | * Parts based on Wine Windows code (windows\message.c)
|
|---|
| 8 | *
|
|---|
| 9 | * Copyright 1993, 1994 Alexandre Julliard
|
|---|
| 10 | *
|
|---|
| 11 | *
|
|---|
| 12 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 13 | *
|
|---|
| 14 | */
|
|---|
| 15 | #include <os2win.h>
|
|---|
| 16 | #include <misc.h>
|
|---|
| 17 | #include <win32wnd.h>
|
|---|
| 18 | #include <win.h>
|
|---|
| 19 | #include <hooks.h>
|
|---|
| 20 | #include "oslibwin.h"
|
|---|
| 21 |
|
|---|
| 22 | //******************************************************************************
|
|---|
| 23 | //******************************************************************************
|
|---|
| 24 | VOID WIN32API PostQuitMessage( int nExitCode)
|
|---|
| 25 | {
|
|---|
| 26 | dprintf(("USER32: PostQuitMessage\n"));
|
|---|
| 27 | OSLibWinPostQuitMessage(nExitCode);
|
|---|
| 28 | }
|
|---|
| 29 | //******************************************************************************
|
|---|
| 30 | //******************************************************************************
|
|---|
| 31 | LONG WIN32API DispatchMessageA(const MSG * msg)
|
|---|
| 32 | {
|
|---|
| 33 | return OSLibWinDispatchMsg((MSG *)msg);
|
|---|
| 34 | }
|
|---|
| 35 | //******************************************************************************
|
|---|
| 36 | //******************************************************************************
|
|---|
| 37 | LONG WIN32API DispatchMessageW( const MSG * msg)
|
|---|
| 38 | {
|
|---|
| 39 | return OSLibWinDispatchMsg((MSG *)msg, TRUE);
|
|---|
| 40 | }
|
|---|
| 41 | //******************************************************************************
|
|---|
| 42 | //******************************************************************************
|
|---|
| 43 | BOOL WIN32API TranslateMessage( const MSG * arg1)
|
|---|
| 44 | {
|
|---|
| 45 | // return O32_TranslateMessage(arg1);
|
|---|
| 46 | return TRUE;
|
|---|
| 47 | }
|
|---|
| 48 | //******************************************************************************
|
|---|
| 49 | //******************************************************************************
|
|---|
| 50 | BOOL WIN32API GetMessageA( LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax)
|
|---|
| 51 | {
|
|---|
| 52 | return OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax);
|
|---|
| 53 | }
|
|---|
| 54 | //******************************************************************************
|
|---|
| 55 | //******************************************************************************
|
|---|
| 56 | BOOL WIN32API GetMessageW( LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax)
|
|---|
| 57 | {
|
|---|
| 58 | return OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, TRUE);
|
|---|
| 59 | }
|
|---|
| 60 | //******************************************************************************
|
|---|
| 61 | //******************************************************************************
|
|---|
| 62 | LONG WIN32API GetMessageExtraInfo(void)
|
|---|
| 63 | {
|
|---|
| 64 | dprintf(("USER32: GetMessageExtraInfo\n"));
|
|---|
| 65 | return O32_GetMessageExtraInfo();
|
|---|
| 66 | }
|
|---|
| 67 | //******************************************************************************
|
|---|
| 68 | //******************************************************************************
|
|---|
| 69 | DWORD WIN32API GetMessagePos(void)
|
|---|
| 70 | {
|
|---|
| 71 | dprintf(("USER32: GetMessagePos\n"));
|
|---|
| 72 | return O32_GetMessagePos();
|
|---|
| 73 | }
|
|---|
| 74 | //******************************************************************************
|
|---|
| 75 | //******************************************************************************
|
|---|
| 76 | LONG WIN32API GetMessageTime(void)
|
|---|
| 77 | {
|
|---|
| 78 | dprintf(("USER32: GetMessageTime\n"));
|
|---|
| 79 | return O32_GetMessageTime();
|
|---|
| 80 | }
|
|---|
| 81 | //******************************************************************************
|
|---|
| 82 | //TODO: hwnd == HWND_BROADCAST
|
|---|
| 83 | //******************************************************************************
|
|---|
| 84 | LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 85 | {
|
|---|
| 86 | Win32Window *window;
|
|---|
| 87 |
|
|---|
| 88 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 89 | if(!window) {
|
|---|
| 90 | dprintf(("SendMessageA, window %x not found", hwnd));
|
|---|
| 91 | return 0;
|
|---|
| 92 | }
|
|---|
| 93 | return window->SendMessageA(msg, wParam, lParam);
|
|---|
| 94 | }
|
|---|
| 95 | //******************************************************************************
|
|---|
| 96 | //TODO: hwnd == HWND_BROADCAST
|
|---|
| 97 | //******************************************************************************
|
|---|
| 98 | LRESULT WIN32API SendMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 99 | {
|
|---|
| 100 | Win32Window *window;
|
|---|
| 101 |
|
|---|
| 102 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 103 | if(!window) {
|
|---|
| 104 | dprintf(("SendMessageW, window %x not found", hwnd));
|
|---|
| 105 | return 0;
|
|---|
| 106 | }
|
|---|
| 107 | return window->SendMessageW(msg, wParam, lParam);
|
|---|
| 108 | }
|
|---|
| 109 | //******************************************************************************
|
|---|
| 110 | //TODO: hwnd == HWND_BROADCAST
|
|---|
| 111 | //******************************************************************************
|
|---|
| 112 | BOOL WIN32API PostMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 113 | {
|
|---|
| 114 | Win32Window *window;
|
|---|
| 115 |
|
|---|
| 116 | if(hwnd == NULL)
|
|---|
| 117 | return PostThreadMessageA(GetCurrentThreadId(), msg, wParam, lParam);
|
|---|
| 118 |
|
|---|
| 119 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 120 | if(!window) {
|
|---|
| 121 | dprintf(("PostMessageA, window %x not found", hwnd));
|
|---|
| 122 | return 0;
|
|---|
| 123 | }
|
|---|
| 124 | return window->PostMessageA(msg, wParam, lParam);
|
|---|
| 125 | }
|
|---|
| 126 | //******************************************************************************
|
|---|
| 127 | //TODO: hwnd == HWND_BROADCAST
|
|---|
| 128 | //******************************************************************************
|
|---|
| 129 | BOOL WIN32API PostMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 130 | {
|
|---|
| 131 | Win32Window *window;
|
|---|
| 132 |
|
|---|
| 133 | if(hwnd == NULL)
|
|---|
| 134 | return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam);
|
|---|
| 135 |
|
|---|
| 136 | window = Win32Window::GetWindowFromHandle(hwnd);
|
|---|
| 137 | if(!window) {
|
|---|
| 138 | dprintf(("PostMessageW, window %x not found", hwnd));
|
|---|
| 139 | return 0;
|
|---|
| 140 | }
|
|---|
| 141 | return window->PostMessageW(msg, wParam, lParam);
|
|---|
| 142 | }
|
|---|
| 143 | //******************************************************************************
|
|---|
| 144 | //******************************************************************************
|
|---|
| 145 | BOOL WIN32API WaitMessage(void)
|
|---|
| 146 | {
|
|---|
| 147 | #ifdef DEBUG
|
|---|
| 148 | WriteLog("USER32: WaitMessage\n");
|
|---|
| 149 | #endif
|
|---|
| 150 | return O32_WaitMessage();
|
|---|
| 151 | }
|
|---|
| 152 | //******************************************************************************
|
|---|
| 153 | //******************************************************************************
|
|---|
| 154 | BOOL WIN32API PeekMessageA(LPMSG arg1, HWND arg2, UINT arg3, UINT arg4, UINT arg5)
|
|---|
| 155 | {
|
|---|
| 156 | #ifdef DEBUG
|
|---|
| 157 | // WriteLog("USER32: PeekMessage\n");
|
|---|
| 158 | #endif
|
|---|
| 159 | return O32_PeekMessage(arg1, arg2, arg3, arg4, arg5);
|
|---|
| 160 | }
|
|---|
| 161 | //******************************************************************************
|
|---|
| 162 | //******************************************************************************
|
|---|
| 163 | BOOL WIN32API PeekMessageW( LPMSG arg1, HWND arg2, UINT arg3, UINT arg4, UINT arg5)
|
|---|
| 164 | {
|
|---|
| 165 | #ifdef DEBUG
|
|---|
| 166 | WriteLog("USER32: PeekMessageW\n");
|
|---|
| 167 | #endif
|
|---|
| 168 | // NOTE: This will not work as is (needs UNICODE support)
|
|---|
| 169 | return O32_PeekMessage(arg1, arg2, arg3, arg4, arg5);
|
|---|
| 170 | }
|
|---|
| 171 | //******************************************************************************
|
|---|
| 172 | //******************************************************************************
|
|---|
| 173 | BOOL WIN32API InSendMessage(void)
|
|---|
| 174 | {
|
|---|
| 175 | #ifdef DEBUG
|
|---|
| 176 | WriteLog("USER32: InSendMessage\n");
|
|---|
| 177 | #endif
|
|---|
| 178 | return O32_InSendMessage();
|
|---|
| 179 | }
|
|---|
| 180 | //******************************************************************************
|
|---|
| 181 | //******************************************************************************
|
|---|
| 182 | //******************************************************************************
|
|---|
| 183 | BOOL WIN32API ReplyMessage( LRESULT arg1)
|
|---|
| 184 | {
|
|---|
| 185 | #ifdef DEBUG
|
|---|
| 186 | WriteLog("USER32: ReplyMessage\n");
|
|---|
| 187 | #endif
|
|---|
| 188 | return O32_ReplyMessage(arg1);
|
|---|
| 189 | }
|
|---|
| 190 | //******************************************************************************
|
|---|
| 191 | //******************************************************************************
|
|---|
| 192 | BOOL WIN32API PostThreadMessageA( DWORD arg1, UINT arg2, WPARAM arg3, LPARAM arg4)
|
|---|
| 193 | {
|
|---|
| 194 | #ifdef DEBUG
|
|---|
| 195 | WriteLog("USER32: PostThreadMessageA\n");
|
|---|
| 196 | #endif
|
|---|
| 197 | return O32_PostThreadMessage(arg1, arg2, arg3, arg4);
|
|---|
| 198 | }
|
|---|
| 199 | //******************************************************************************
|
|---|
| 200 | //******************************************************************************
|
|---|
| 201 | BOOL WIN32API PostThreadMessageW( DWORD arg1, UINT arg2, WPARAM arg3, LPARAM arg4)
|
|---|
| 202 | {
|
|---|
| 203 | #ifdef DEBUG
|
|---|
| 204 | WriteLog("USER32: PostThreadMessageW\n");
|
|---|
| 205 | #endif
|
|---|
| 206 | // NOTE: This will not work as is (needs UNICODE support)
|
|---|
| 207 | return O32_PostThreadMessage(arg1, arg2, arg3, arg4);
|
|---|
| 208 | }
|
|---|
| 209 | //******************************************************************************
|
|---|
| 210 | //SvL: 24-6-'97 - Added
|
|---|
| 211 | //******************************************************************************
|
|---|
| 212 | UINT WIN32API RegisterWindowMessageA(LPCSTR arg1)
|
|---|
| 213 | {
|
|---|
| 214 | UINT rc;
|
|---|
| 215 |
|
|---|
| 216 | rc = O32_RegisterWindowMessage(arg1);
|
|---|
| 217 | #ifdef DEBUG
|
|---|
| 218 | WriteLog("USER32: RegisterWindowMessageA %s returned %X\n", arg1, rc);
|
|---|
| 219 | #endif
|
|---|
| 220 | return(rc);
|
|---|
| 221 | }
|
|---|
| 222 | //******************************************************************************
|
|---|
| 223 | //******************************************************************************
|
|---|
| 224 | UINT WIN32API RegisterWindowMessageW( LPCWSTR arg1)
|
|---|
| 225 | {
|
|---|
| 226 | char *astring = UnicodeToAsciiString((LPWSTR)arg1);
|
|---|
| 227 | UINT rc;
|
|---|
| 228 |
|
|---|
| 229 | #ifdef DEBUG
|
|---|
| 230 | WriteLog("USER32: RegisterWindowMessageW\n");
|
|---|
| 231 | #endif
|
|---|
| 232 | rc = O32_RegisterWindowMessage(astring);
|
|---|
| 233 | FreeAsciiString(astring);
|
|---|
| 234 | return rc;
|
|---|
| 235 | }
|
|---|
| 236 | //******************************************************************************
|
|---|
| 237 | //******************************************************************************
|
|---|
| 238 | LRESULT WIN32API CallWindowProcA(WNDPROC wndprcPrev,
|
|---|
| 239 | HWND arg2,
|
|---|
| 240 | UINT arg3,
|
|---|
| 241 | WPARAM arg4,
|
|---|
| 242 | LPARAM arg5)
|
|---|
| 243 | {
|
|---|
| 244 | #ifdef DEBUG
|
|---|
| 245 | //// WriteLog("USER32: CallWindowProcA %X hwnd=%X, msg = %X\n", wndprcPrev, arg2, arg3);
|
|---|
| 246 | #endif
|
|---|
| 247 |
|
|---|
| 248 | return wndprcPrev(arg2, arg3, arg4, arg5); //win32 callback (__stdcall)
|
|---|
| 249 | }
|
|---|
| 250 | //******************************************************************************
|
|---|
| 251 | //******************************************************************************
|
|---|
| 252 | LRESULT WIN32API CallWindowProcW(WNDPROC arg1,
|
|---|
| 253 | HWND arg2,
|
|---|
| 254 | UINT arg3,
|
|---|
| 255 | WPARAM arg4,
|
|---|
| 256 | LPARAM arg5)
|
|---|
| 257 | {
|
|---|
| 258 | dprintf(("USER32: CallWindowProcW(%08xh,%08xh,%08xh,%08xh,%08xh) not properly implemented.\n",
|
|---|
| 259 | arg1,
|
|---|
| 260 | arg2,
|
|---|
| 261 | arg3,
|
|---|
| 262 | arg4,
|
|---|
| 263 | arg5));
|
|---|
| 264 |
|
|---|
| 265 | return CallWindowProcA(arg1,
|
|---|
| 266 | arg2,
|
|---|
| 267 | arg3,
|
|---|
| 268 | arg4,
|
|---|
| 269 | arg5);
|
|---|
| 270 | }
|
|---|
| 271 | //******************************************************************************
|
|---|
| 272 | //No need to support this
|
|---|
| 273 | //******************************************************************************
|
|---|
| 274 | BOOL WIN32API SetMessageQueue(int cMessagesMax)
|
|---|
| 275 | {
|
|---|
| 276 | #ifdef DEBUG
|
|---|
| 277 | WriteLog("USER32: SetMessageQueue\n");
|
|---|
| 278 | #endif
|
|---|
| 279 | return(TRUE);
|
|---|
| 280 | }
|
|---|
| 281 | //******************************************************************************
|
|---|
| 282 | //******************************************************************************
|
|---|
| 283 | LRESULT WIN32API SendMessageTimeoutA(HWND hwnd, UINT Msg, WPARAM wParam,
|
|---|
| 284 | LPARAM lParam, UINT fuFlags, UINT uTimeOut,
|
|---|
| 285 | LPDWORD lpdwResult)
|
|---|
| 286 | {
|
|---|
| 287 | #ifdef DEBUG
|
|---|
| 288 | WriteLog("USER32: SendMessageTimeoutA, partially implemented\n");
|
|---|
| 289 | #endif
|
|---|
| 290 | //ignore fuFlags & wTimeOut
|
|---|
| 291 | *lpdwResult = SendMessageA(hwnd, Msg, wParam, lParam);
|
|---|
| 292 | return(TRUE);
|
|---|
| 293 | }
|
|---|
| 294 | //******************************************************************************
|
|---|
| 295 | //******************************************************************************
|
|---|
| 296 | LRESULT WIN32API SendMessageTimeoutW(HWND hwnd, UINT Msg, WPARAM wParam,
|
|---|
| 297 | LPARAM lParam, UINT fuFlags, UINT uTimeOut,
|
|---|
| 298 | LPDWORD lpdwResult)
|
|---|
| 299 | {
|
|---|
| 300 | #ifdef DEBUG
|
|---|
| 301 | WriteLog("USER32: SendMessageTimeoutW, partially implemented\n");
|
|---|
| 302 | #endif
|
|---|
| 303 | return(SendMessageTimeoutA(hwnd, Msg, wParam, lParam, fuFlags, uTimeOut, lpdwResult));
|
|---|
| 304 | }
|
|---|
| 305 | //******************************************************************************
|
|---|
| 306 | //******************************************************************************
|
|---|
| 307 | BOOL WIN32API SendNotifyMessageA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 308 | {
|
|---|
| 309 | #ifdef DEBUG
|
|---|
| 310 | WriteLog("USER32: SendNotifyMessageA, not completely implemented\n");
|
|---|
| 311 | #endif
|
|---|
| 312 | return(SendMessageA(hwnd, Msg, wParam, lParam));
|
|---|
| 313 | }
|
|---|
| 314 | //******************************************************************************
|
|---|
| 315 | //******************************************************************************
|
|---|
| 316 | BOOL WIN32API SendNotifyMessageW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 317 | {
|
|---|
| 318 | #ifdef DEBUG
|
|---|
| 319 | WriteLog("USER32: SendNotifyMessageW, not completely implemented\n");
|
|---|
| 320 | #endif
|
|---|
| 321 | return(SendMessageA(hwnd, Msg, wParam, lParam));
|
|---|
| 322 | }
|
|---|
| 323 | //******************************************************************************
|
|---|
| 324 | //******************************************************************************
|
|---|
| 325 | LPARAM WIN32API SetMessageExtraInfo(LPARAM lParam)
|
|---|
| 326 | {
|
|---|
| 327 | #ifdef DEBUG
|
|---|
| 328 | WriteLog("USER32: SetMessageExtraInfo, not implemented\n");
|
|---|
| 329 | #endif
|
|---|
| 330 | return(0);
|
|---|
| 331 | }
|
|---|
| 332 | /*****************************************************************************
|
|---|
| 333 | * Name : BOOL WIN32API SendMessageCallbackA
|
|---|
| 334 | * Purpose : The SendMessageCallback function sends the specified message to
|
|---|
| 335 | * a window or windows. The function calls the window procedure for
|
|---|
| 336 | * the specified window and returns immediately. After the window
|
|---|
| 337 | * procedure processes the message, the system calls the specified
|
|---|
| 338 | * callback function, passing the result of the message processing
|
|---|
| 339 | * and an application-defined value to the callback function.
|
|---|
| 340 | * Parameters: HWND hwnd handle of destination window
|
|---|
| 341 | * UINT uMsg message to send
|
|---|
| 342 | * WPARAM wParam first message parameter
|
|---|
| 343 | * LPARAM lParam second message parameter
|
|---|
| 344 | * SENDASYNCPROC lpResultCallBack function to receive message value
|
|---|
| 345 | * DWORD dwData value to pass to callback function
|
|---|
| 346 | * Variables :
|
|---|
| 347 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 348 | * If the function fails, the return value is FALSE. To get extended
|
|---|
| 349 | * error information, call GetLastError.
|
|---|
| 350 | * Remark :
|
|---|
| 351 | * Status : UNTESTED STUB
|
|---|
| 352 | *
|
|---|
| 353 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 354 | *****************************************************************************/
|
|---|
| 355 |
|
|---|
| 356 | BOOL WIN32API SendMessageCallbackA(HWND hWnd,
|
|---|
| 357 | UINT uMsg,
|
|---|
| 358 | WPARAM wParam,
|
|---|
| 359 | LPARAM lParam,
|
|---|
| 360 | SENDASYNCPROC lpResultCallBack,
|
|---|
| 361 | DWORD dwData)
|
|---|
| 362 | {
|
|---|
| 363 | dprintf(("USER32:SendMessageCallBackA (%08xh,%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
|
|---|
| 364 | hWnd,
|
|---|
| 365 | uMsg,
|
|---|
| 366 | wParam,
|
|---|
| 367 | lParam,
|
|---|
| 368 | lpResultCallBack,
|
|---|
| 369 | dwData));
|
|---|
| 370 |
|
|---|
| 371 | return (FALSE);
|
|---|
| 372 | }
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 | /*****************************************************************************
|
|---|
| 376 | * Name : BOOL WIN32API SendMessageCallbackW
|
|---|
| 377 | * Purpose : The SendMessageCallback function sends the specified message to
|
|---|
| 378 | * a window or windows. The function calls the window procedure for
|
|---|
| 379 | * the specified window and returns immediately. After the window
|
|---|
| 380 | * procedure processes the message, the system calls the specified
|
|---|
| 381 | * callback function, passing the result of the message processing
|
|---|
| 382 | * and an application-defined value to the callback function.
|
|---|
| 383 | * Parameters: HWND hwnd handle of destination window
|
|---|
| 384 | * UINT uMsg message to send
|
|---|
| 385 | * WPARAM wParam first message parameter
|
|---|
| 386 | * LPARAM lParam second message parameter
|
|---|
| 387 | * SENDASYNCPROC lpResultCallBack function to receive message value
|
|---|
| 388 | * DWORD dwData value to pass to callback function
|
|---|
| 389 | * Variables :
|
|---|
| 390 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 391 | * If the function fails, the return value is FALSE. To get extended
|
|---|
| 392 | * error information, call GetLastError.
|
|---|
| 393 | * Remark :
|
|---|
| 394 | * Status : UNTESTED STUB
|
|---|
| 395 | *
|
|---|
| 396 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 397 | *****************************************************************************/
|
|---|
| 398 |
|
|---|
| 399 | BOOL WIN32API SendMessageCallbackW(HWND hWnd,
|
|---|
| 400 | UINT uMsg,
|
|---|
| 401 | WPARAM wParam,
|
|---|
| 402 | LPARAM lParam,
|
|---|
| 403 | SENDASYNCPROC lpResultCallBack,
|
|---|
| 404 | DWORD dwData)
|
|---|
| 405 | {
|
|---|
| 406 | dprintf(("USER32:SendMessageCallBackW (%08xh,%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
|
|---|
| 407 | hWnd,
|
|---|
| 408 | uMsg,
|
|---|
| 409 | wParam,
|
|---|
| 410 | lParam,
|
|---|
| 411 | lpResultCallBack,
|
|---|
| 412 | dwData));
|
|---|
| 413 |
|
|---|
| 414 | return (FALSE);
|
|---|
| 415 | }
|
|---|
| 416 | //******************************************************************************
|
|---|
| 417 | //******************************************************************************
|
|---|