source: trunk/src/user32/new/windowmsg.cpp@ 398

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

Lots of changes: Solitaire now displays cards correctly

File size: 18.0 KB
Line 
1/* $Id: windowmsg.cpp,v 1.8 1999-07-26 20:03:49 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//******************************************************************************
24VOID WIN32API PostQuitMessage( int nExitCode)
25{
26 dprintf(("USER32: PostQuitMessage\n"));
27 OSLibWinPostQuitMessage(nExitCode);
28}
29//******************************************************************************
30//******************************************************************************
31LONG WIN32API DispatchMessageA(const MSG * msg)
32{
33 return OSLibWinDispatchMsg((MSG *)msg);
34}
35//******************************************************************************
36//******************************************************************************
37LONG WIN32API DispatchMessageW( const MSG * msg)
38{
39 return OSLibWinDispatchMsg((MSG *)msg, TRUE);
40}
41//******************************************************************************
42//******************************************************************************
43BOOL WIN32API TranslateMessage( const MSG * arg1)
44{
45// return O32_TranslateMessage(arg1);
46 return TRUE;
47}
48//******************************************************************************
49//******************************************************************************
50BOOL WIN32API GetMessageA( LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax)
51{
52 return OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax);
53}
54//******************************************************************************
55//******************************************************************************
56BOOL WIN32API GetMessageW( LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax)
57{
58 return OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, TRUE);
59}
60//******************************************************************************
61//******************************************************************************
62LONG WIN32API GetMessageExtraInfo(void)
63{
64 dprintf(("USER32: GetMessageExtraInfo\n"));
65 return O32_GetMessageExtraInfo();
66}
67//******************************************************************************
68//******************************************************************************
69DWORD WIN32API GetMessagePos(void)
70{
71 dprintf(("USER32: GetMessagePos\n"));
72 return O32_GetMessagePos();
73}
74//******************************************************************************
75//******************************************************************************
76LONG WIN32API GetMessageTime(void)
77{
78 dprintf(("USER32: GetMessageTime\n"));
79 return O32_GetMessageTime();
80}
81//******************************************************************************
82//TODO: hwnd == HWND_BROADCAST
83//******************************************************************************
84LRESULT 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//******************************************************************************
98LRESULT 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//******************************************************************************
112BOOL 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 dprintf(("PostMessageA, %x %x %x %x", hwnd, msg, wParam, lParam));
125 return window->PostMessageA(msg, wParam, lParam);
126}
127//******************************************************************************
128//TODO: hwnd == HWND_BROADCAST
129//******************************************************************************
130BOOL WIN32API PostMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
131{
132 Win32Window *window;
133
134 if(hwnd == NULL)
135 return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam);
136
137 window = Win32Window::GetWindowFromHandle(hwnd);
138 if(!window) {
139 dprintf(("PostMessageW, window %x not found", hwnd));
140 return 0;
141 }
142 dprintf(("PostMessageW, %x %x %x %x", hwnd, msg, wParam, lParam));
143 return window->PostMessageW(msg, wParam, lParam);
144}
145//******************************************************************************
146//******************************************************************************
147BOOL WIN32API WaitMessage(void)
148{
149#ifdef DEBUG
150 WriteLog("USER32: WaitMessage\n");
151#endif
152 return O32_WaitMessage();
153}
154//******************************************************************************
155//******************************************************************************
156BOOL WIN32API PeekMessageA(LPMSG arg1, HWND arg2, UINT arg3, UINT arg4, UINT arg5)
157{
158#ifdef DEBUG
159// WriteLog("USER32: PeekMessage\n");
160#endif
161 return O32_PeekMessage(arg1, arg2, arg3, arg4, arg5);
162}
163//******************************************************************************
164//******************************************************************************
165BOOL WIN32API PeekMessageW( LPMSG arg1, HWND arg2, UINT arg3, UINT arg4, UINT arg5)
166{
167#ifdef DEBUG
168 WriteLog("USER32: PeekMessageW\n");
169#endif
170 // NOTE: This will not work as is (needs UNICODE support)
171 return O32_PeekMessage(arg1, arg2, arg3, arg4, arg5);
172}
173//******************************************************************************
174//******************************************************************************
175BOOL WIN32API InSendMessage(void)
176{
177#ifdef DEBUG
178 WriteLog("USER32: InSendMessage\n");
179#endif
180 return O32_InSendMessage();
181}
182//******************************************************************************
183//******************************************************************************
184//******************************************************************************
185BOOL WIN32API ReplyMessage( LRESULT arg1)
186{
187#ifdef DEBUG
188 WriteLog("USER32: ReplyMessage\n");
189#endif
190 return O32_ReplyMessage(arg1);
191}
192//******************************************************************************
193//******************************************************************************
194BOOL WIN32API PostThreadMessageA( DWORD arg1, UINT arg2, WPARAM arg3, LPARAM arg4)
195{
196#ifdef DEBUG
197 WriteLog("USER32: PostThreadMessageA\n");
198#endif
199 return O32_PostThreadMessage(arg1, arg2, arg3, arg4);
200}
201//******************************************************************************
202//******************************************************************************
203BOOL WIN32API PostThreadMessageW( DWORD arg1, UINT arg2, WPARAM arg3, LPARAM arg4)
204{
205#ifdef DEBUG
206 WriteLog("USER32: PostThreadMessageW\n");
207#endif
208 // NOTE: This will not work as is (needs UNICODE support)
209 return O32_PostThreadMessage(arg1, arg2, arg3, arg4);
210}
211//******************************************************************************
212//SvL: 24-6-'97 - Added
213//******************************************************************************
214UINT WIN32API RegisterWindowMessageA(LPCSTR arg1)
215{
216 UINT rc;
217
218 rc = O32_RegisterWindowMessage(arg1);
219#ifdef DEBUG
220 WriteLog("USER32: RegisterWindowMessageA %s returned %X\n", arg1, rc);
221#endif
222 return(rc);
223}
224//******************************************************************************
225//******************************************************************************
226UINT WIN32API RegisterWindowMessageW( LPCWSTR arg1)
227{
228 char *astring = UnicodeToAsciiString((LPWSTR)arg1);
229 UINT rc;
230
231#ifdef DEBUG
232 WriteLog("USER32: RegisterWindowMessageW\n");
233#endif
234 rc = O32_RegisterWindowMessage(astring);
235 FreeAsciiString(astring);
236 return rc;
237}
238//******************************************************************************
239//******************************************************************************
240LRESULT WIN32API CallWindowProcA(WNDPROC wndprcPrev,
241 HWND arg2,
242 UINT arg3,
243 WPARAM arg4,
244 LPARAM arg5)
245{
246#ifdef DEBUG
247//// WriteLog("USER32: CallWindowProcA %X hwnd=%X, msg = %X\n", wndprcPrev, arg2, arg3);
248#endif
249
250 return wndprcPrev(arg2, arg3, arg4, arg5); //win32 callback (__stdcall)
251}
252//******************************************************************************
253//******************************************************************************
254LRESULT WIN32API CallWindowProcW(WNDPROC arg1,
255 HWND arg2,
256 UINT arg3,
257 WPARAM arg4,
258 LPARAM arg5)
259{
260 dprintf(("USER32: CallWindowProcW(%08xh,%08xh,%08xh,%08xh,%08xh) not properly implemented.\n",
261 arg1,
262 arg2,
263 arg3,
264 arg4,
265 arg5));
266
267 return CallWindowProcA(arg1,
268 arg2,
269 arg3,
270 arg4,
271 arg5);
272}
273//******************************************************************************
274//No need to support this
275//******************************************************************************
276BOOL WIN32API SetMessageQueue(int cMessagesMax)
277{
278#ifdef DEBUG
279 WriteLog("USER32: SetMessageQueue\n");
280#endif
281 return(TRUE);
282}
283//******************************************************************************
284//******************************************************************************
285LRESULT WIN32API SendMessageTimeoutA(HWND hwnd, UINT Msg, WPARAM wParam,
286 LPARAM lParam, UINT fuFlags, UINT uTimeOut,
287 LPDWORD lpdwResult)
288{
289#ifdef DEBUG
290 WriteLog("USER32: SendMessageTimeoutA, partially implemented\n");
291#endif
292 //ignore fuFlags & wTimeOut
293 *lpdwResult = SendMessageA(hwnd, Msg, wParam, lParam);
294 return(TRUE);
295}
296//******************************************************************************
297//******************************************************************************
298LRESULT WIN32API SendMessageTimeoutW(HWND hwnd, UINT Msg, WPARAM wParam,
299 LPARAM lParam, UINT fuFlags, UINT uTimeOut,
300 LPDWORD lpdwResult)
301{
302#ifdef DEBUG
303 WriteLog("USER32: SendMessageTimeoutW, partially implemented\n");
304#endif
305 return(SendMessageTimeoutA(hwnd, Msg, wParam, lParam, fuFlags, uTimeOut, lpdwResult));
306}
307//******************************************************************************
308//******************************************************************************
309BOOL WIN32API SendNotifyMessageA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
310{
311#ifdef DEBUG
312 WriteLog("USER32: SendNotifyMessageA, not completely implemented\n");
313#endif
314 return(SendMessageA(hwnd, Msg, wParam, lParam));
315}
316//******************************************************************************
317//******************************************************************************
318BOOL WIN32API SendNotifyMessageW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
319{
320#ifdef DEBUG
321 WriteLog("USER32: SendNotifyMessageW, not completely implemented\n");
322#endif
323 return(SendMessageA(hwnd, Msg, wParam, lParam));
324}
325//******************************************************************************
326//******************************************************************************
327LPARAM WIN32API SetMessageExtraInfo(LPARAM lParam)
328{
329#ifdef DEBUG
330 WriteLog("USER32: SetMessageExtraInfo, not implemented\n");
331#endif
332 return(0);
333}
334/*****************************************************************************
335 * Name : BOOL WIN32API SendMessageCallbackA
336 * Purpose : The SendMessageCallback function sends the specified message to
337 * a window or windows. The function calls the window procedure for
338 * the specified window and returns immediately. After the window
339 * procedure processes the message, the system calls the specified
340 * callback function, passing the result of the message processing
341 * and an application-defined value to the callback function.
342 * Parameters: HWND hwnd handle of destination window
343 * UINT uMsg message to send
344 * WPARAM wParam first message parameter
345 * LPARAM lParam second message parameter
346 * SENDASYNCPROC lpResultCallBack function to receive message value
347 * DWORD dwData value to pass to callback function
348 * Variables :
349 * Result : If the function succeeds, the return value is TRUE.
350 * If the function fails, the return value is FALSE. To get extended
351 * error information, call GetLastError.
352 * Remark :
353 * Status : UNTESTED STUB
354 *
355 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
356 *****************************************************************************/
357
358BOOL WIN32API SendMessageCallbackA(HWND hWnd,
359 UINT uMsg,
360 WPARAM wParam,
361 LPARAM lParam,
362 SENDASYNCPROC lpResultCallBack,
363 DWORD dwData)
364{
365 dprintf(("USER32:SendMessageCallBackA (%08xh,%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
366 hWnd,
367 uMsg,
368 wParam,
369 lParam,
370 lpResultCallBack,
371 dwData));
372
373 return (FALSE);
374}
375
376
377/*****************************************************************************
378 * Name : BOOL WIN32API SendMessageCallbackW
379 * Purpose : The SendMessageCallback function sends the specified message to
380 * a window or windows. The function calls the window procedure for
381 * the specified window and returns immediately. After the window
382 * procedure processes the message, the system calls the specified
383 * callback function, passing the result of the message processing
384 * and an application-defined value to the callback function.
385 * Parameters: HWND hwnd handle of destination window
386 * UINT uMsg message to send
387 * WPARAM wParam first message parameter
388 * LPARAM lParam second message parameter
389 * SENDASYNCPROC lpResultCallBack function to receive message value
390 * DWORD dwData value to pass to callback function
391 * Variables :
392 * Result : If the function succeeds, the return value is TRUE.
393 * If the function fails, the return value is FALSE. To get extended
394 * error information, call GetLastError.
395 * Remark :
396 * Status : UNTESTED STUB
397 *
398 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
399 *****************************************************************************/
400
401BOOL WIN32API SendMessageCallbackW(HWND hWnd,
402 UINT uMsg,
403 WPARAM wParam,
404 LPARAM lParam,
405 SENDASYNCPROC lpResultCallBack,
406 DWORD dwData)
407{
408 dprintf(("USER32:SendMessageCallBackW (%08xh,%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
409 hWnd,
410 uMsg,
411 wParam,
412 lParam,
413 lpResultCallBack,
414 dwData));
415
416 return (FALSE);
417}
418/*****************************************************************************
419 * Name : long WIN32API BroadcastSystemMessage
420 * Purpose : The BroadcastSystemMessage function sends a message to the given
421 * recipients. The recipients can be applications, installable
422 * drivers, Windows-based network drivers, system-level device
423 * drivers, or any combination of these system components.
424 * Parameters: DWORD dwFlags,
425 LPDWORD lpdwRecipients,
426 UINT uiMessage,
427 WPARAM wParam,
428 LPARAM lParam
429 * Variables :
430 * Result : If the function succeeds, the return value is a positive value.
431 * If the function is unable to broadcast the message, the return value is -1.
432 * If the dwFlags parameter is BSF_QUERY and at least one recipient returned FALSE to the corresponding message, the return value is zero.
433 * Remark :
434 * Status : UNTESTED STUB
435 *
436 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
437 *****************************************************************************/
438
439long WIN32API BroadcastSystemMessage(DWORD dwFlags,
440 LPDWORD lpdwRecipients,
441 UINT uiMessage,
442 WPARAM wParam,
443 LPARAM lParam)
444{
445 dprintf(("USER32:BroadcastSystemMessage(%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
446 dwFlags,
447 lpdwRecipients,
448 uiMessage,
449 wParam,
450 lParam));
451
452 return (-1);
453}
454//******************************************************************************
455//******************************************************************************
Note: See TracBrowser for help on using the repository browser.