01-13-2006 08:42 AM
01-13-2006 01:17 PM
01-16-2006 07:09 AM
01-16-2006 11:11 AM
It quite likely does work, but you do not want to compare hWnd to your message value of 0x401 but rather Msg. hWnd is the window handle of the window receiving the message, but Msg is the message code (WM_xxxxxx).
@while loop wrote:
Hi Jason ,
thanks for your reply. My problem is still alive, so I attach 2 Test VIs. The Send-VI works, I can send my WM_User messages
to other (non-LV) applications and the triggered action will be performed. Looking for the reason of the receiving problem in
LabVIEW (WM_queue_Test1.vi) I have used Microsoft Spy to see if the messages will be received it seems to be allright.
But my messages didn't occur in the message queue. - So what is my mistake, or isn't there a way to receive WM_User messages?
I'm using LV7.1 (WinXP).
Steffen
01-17-2006 06:59 PM
01-18-2006 02:20 AM
One other catch might be that LabVIEW itself is actually using a few WM_USER - WM_USER + 4 or so messages itself for asynchronous event messaging between different parts of LabVIEW, though those messages usually are only directed towrds the hidden main window. Maybe that it's internal message translation and distribution swallows these messages.
@Odd_Modem wrote:
Yeah, I see what you are saying. Microsoft Spy++ shows that the receiver window is getting the user message, but the LabVIEW queue does not do anything, even though it is registered for the exact user event number (and compare to MSG instead of HWND). I think in your dll interface to SendMessageA all the input parameters should be set to U32 instead of U16. I am using W2K and MSVC++5. I wonder if this user event ever worked? The GUI events seem to work with the queue. I think the baseline for this project was LV5, MSVC++6 and WinNT. Maybe something has changed with security patches???
01-24-2006 01:38 PM
01-24-2006 08:55 PM
01-25-2006 04:28 AM
01-25-2006 05:15 AM
Stupid me! Of course! SendMessage waits for the message to be handled and the return value of the message be provided by the target window before returning. Apparently Windows has some protection built into SendMessage to avoid deadlocks by checking if the target window message loop runs in the same thread as the one calling SendMessage and in that case reverts possibly to PostMessage for known WM_xxx messages and just simply returns for unknown messages. If it wouldn't do that you would end up blocking in SendMessage for indefinite time as it waits for the message to be handled which never will happen since the thread handling the message loop is blocking on SendMessage.
@Odd_Modem wrote:
I got it to work with PostMessageA, message 0x8000. It works with occurrence drive or polling drive. I used U32 for all the function inputs. I used the original dll and LabVIEW 7.1.1. This, at least, shows that it works between two windows in the same process.