WPARAM wParam,
LPARAM lParam);
LRESULT FASTCALL
+co_IntPostOrSendMessage(HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+LRESULT FASTCALL
co_IntSendMessageTimeout(HWND hWnd,
UINT Msg,
WPARAM wParam,
UINT uFlags,
UINT uTimeout,
ULONG_PTR *uResult);
-BOOL FASTCALL UserSendNotifyMessage( HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam );
+
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd,
UINT Msg,
WPARAM wParam,
if (ret && ClipboardOwnerWindow)
{
DPRINT("Clipboard: WM_DESTROYCLIPBOARD to %p", ClipboardOwnerWindow->head.h);
- co_IntSendMessageNoWait( ClipboardOwnerWindow->head.h, WM_DESTROYCLIPBOARD, 0, 0);
+ co_IntSendMessage( ClipboardOwnerWindow->head.h, WM_DESTROYCLIPBOARD, 0, 0);
}
UserLeave();
for (; *cursor; cursor++)
{
- UserPostMessage(*cursor, gpsi->uiShellMsg, Message, lParam);
+ DPRINT("Sending notify\n");
+ co_IntPostOrSendMessage(*cursor,
+ gpsi->uiShellMsg,
+ Message,
+ lParam);
}
ExFreePool(HwndList);
if (WindowPrev) UserRefObjectCo(WindowPrev, &RefPrev);
/* Send palette messages */
- if (co_IntSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
+ if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
{
- UserSendNotifyMessage( HWND_BROADCAST,
- WM_PALETTEISCHANGING,
- (WPARAM)hWnd,
- 0);
+ UserPostMessage( HWND_BROADCAST,
+ WM_PALETTEISCHANGING,
+ (WPARAM)hWnd,
+ 0);
}
if (Window->spwndPrev != NULL)
if (hWndPrev)
{
IntNotifyWinEvent(EVENT_OBJECT_FOCUS, NULL, OBJID_CLIENT, CHILDID_SELF, 0);
- co_IntSendMessageNoWait(hWndPrev, WM_KILLFOCUS, (WPARAM)hWnd, 0);
+ co_IntPostOrSendMessage(hWndPrev, WM_KILLFOCUS, (WPARAM)hWnd, 0);
}
}
{
PWND pWnd = UserGetWindowObject(hWnd);
IntNotifyWinEvent(EVENT_OBJECT_FOCUS, pWnd, OBJID_CLIENT, CHILDID_SELF, 0);
- co_IntSendMessageNoWait(hWnd, WM_SETFOCUS, (WPARAM)hWndPrev, 0);
+ co_IntPostOrSendMessage(hWnd, WM_SETFOCUS, (WPARAM)hWndPrev, 0);
}
}
if (Window)
IntNotifyWinEvent(EVENT_SYSTEM_CAPTURESTART, Window, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
- co_IntSendMessageNoWait(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
+ co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
ThreadQueue->CaptureWindow = hWnd;
RETURN( hWndPrev);
END_CLEANUP;
}
+/* This function posts a message if the destination's message queue belongs to
+another thread, otherwise it sends the message. It does not support broadcast
+messages! */
+LRESULT FASTCALL
+co_IntPostOrSendMessage( HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam )
+{
+ ULONG_PTR Result;
+ PTHREADINFO pti;
+ PWND Window;
+
+ if ( hWnd == HWND_BROADCAST )
+ {
+ return 0;
+ }
+
+ if(!(Window = UserGetWindowObject(hWnd)))
+ {
+ return 0;
+ }
+
+ pti = PsGetCurrentThreadWin32Thread();
+
+ if ( Window->head.pti->MessageQueue != pti->MessageQueue &&
+ FindMsgMemory(Msg) == 0 )
+ {
+ Result = UserPostMessage(hWnd, Msg, wParam, lParam);
+ }
+ else
+ {
+ if ( !co_IntSendMessageTimeoutSingle(hWnd, Msg, wParam, lParam, SMTO_NORMAL, 0, &Result) )
+ {
+ Result = 0;
+ }
+ }
+
+ return (LRESULT)Result;
+}
+
LRESULT FASTCALL
co_IntDoSendMessage( HWND hWnd,
UINT Msg,
}
if (Ret)
{
- UserSendNotifyMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0);
+ UserPostMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0);
}
UserLeave();
return Ret;
hWnd = IntWindowFromDC(hdc);
if (hWnd) // Send broadcast if dc is associated with a window.
{ // FYI: Thread locked in CallOneParam.
- UserSendNotifyMessage((HWND)HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0);
+ co_IntSendMessage((HWND)HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0);
}
}
return Ret;