user32.SendMessageCallback
Robert Shearman
R.J.Shearman at warwick.ac.uk
Wed Dec 4 18:36:43 CST 2002
Just thought I'd submit a few patches that were hanging around. This one
implements SendMessageCallback properly which is used in one of the versions
of IE and enables it to work properly.
Changelog:
- Make SendMessageCallback support calling any window, regardless of thread
or process
-------------- next part --------------
Index: wine/dlls/user/message.c
===================================================================
RCS file: /home/wine/wine/dlls/user/message.c,v
retrieving revision 1.31
diff -u -r1.31 message.c
--- wine/dlls/user/message.c 3 Dec 2002 23:34:54 -0000 1.31
+++ wine/dlls/user/message.c 4 Dec 2002 22:37:09 -0000
@@ -1876,7 +1876,33 @@
}
return send_inter_thread_message( dest_tid, &info, &result );
}
-
+
+static DWORD WINAPI threadproc_sendmessagecallback(LPVOID lpParameter)
+{
+ struct send_message_info * lpInfo = (struct send_message_info *) lpParameter;
+ LRESULT result;
+ DWORD dest_tid;
+ if (!(dest_tid = GetWindowThreadProcessId( lpInfo->hwnd, NULL )))
+ {
+ HeapFree( GetProcessHeap(), 0, lpInfo );
+ return 1;
+ }
+
+ if (USER_IsExitingThread( dest_tid ))
+ {
+ HeapFree( GetProcessHeap(), 0, lpInfo );
+ return 0;
+ }
+
+ if (send_inter_thread_message( dest_tid, lpInfo, &result ))
+ {
+ lpInfo->callback( lpInfo->hwnd, lpInfo->msg, lpInfo->data, result );
+ HeapFree( GetProcessHeap(), 0, lpInfo );
+ return 0;
+ }
+ HeapFree( GetProcessHeap(), 0, lpInfo );
+ return 1;
+}
/***********************************************************************
* SendMessageCallbackA (USER32.@)
@@ -1895,7 +1921,8 @@
BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
SENDASYNCPROC callback, ULONG_PTR data )
{
- struct send_message_info info;
+ struct send_message_info info;
+ struct send_message_info * lpInfo;
LRESULT result;
DWORD dest_tid;
@@ -1929,11 +1956,11 @@
callback( hwnd, msg, data, result );
return TRUE;
}
- FIXME( "callback will not be called\n" );
- return send_inter_thread_message( dest_tid, &info, &result );
+ lpInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(struct send_message_info) );
+ CopyMemory( lpInfo, &info, sizeof(struct send_message_info) );
+ return (CreateThread(NULL, 0, threadproc_sendmessagecallback, (LPVOID)lpInfo, 0, NULL) != NULL);
}
-
-
+
/***********************************************************************
* ReplyMessage (USER32.@)
*/
More information about the wine-patches
mailing list