LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use of windows message

Hi,

anyone got an idea how to use the windowsmessages in LabVIEW?
send and retrieve msgs?

thanks
timo
---
Message 1 of 10
(7,753 Views)
Based on the 1-star rating that was given to your post, somebody out there doesn't like you, or doesn't like your post, or doesn't like your signature. The rating seems a little extreme to me.

To your query: Not sure if you're asking what you need, or if you know what you need to do, and want to know the how. What you need to do is to use the Windows API calls "SendMessage" and "PostMessage" (not sure about the difference - you'll need to check MSDN). As to the how, you can just call these Windows API functions like any other DLL. If you search this forum you will find this question having been asked before.  Another alternative, if you want to spend the money is to use George Zou's Windows API library.
Message 2 of 10
(7,736 Views)
To add more information to what smercurio_fc said:
Windows messages are addressed to windows (a window could be a dialog, a control or even a hidden object).
To do this, you need to know the window handle (a 32 bit identifier).
Normally, when the window receives a message, some code is executed in a routine named the window procedure (for example the message WM_QUIT generally causes the window to close itself, WM_PAINT to redraw the client area, and so on - there are hundreds of message types).
If you send a message calling SendMessage, the routine doesn't return until the window completes the code execution; if you call PostMessage instead, the routine sends the message and returns immediately.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 10
(7,724 Views)

Hi,

 

I am waking this thread up as it is exatly what I want to do.

 

How can I catch SendMessage in Labview? I have a software that does:

 

SendMessage(targetWindow, WM_COPYDATA, senderWindow, COPYDATASTRUCT);

 

This is the standard way of copying data between applications. The software puts its data inside COPYDATASTRUCT (I can modify what I put in). Now I want labview to react to this message. What should I do? I have no idea where to start.

 

Below are clips what I have found on the topic so far. What would you recommend to be the best starting point?

 

My own starting point would be to spy the message which is send when I click a Labview-control. That is most likely a WM_LABVIEW_CLICK_OBJECT_116 or similar. After that I could just copy the Message ID to my external program. Any comments?

 

br,

Juha

 

<clip>

The program I am writing is in LabVIEW. LabVIEW does not interface with
Windows messages directly, but it does interface with ActiveX objects and
..NET objects. If I have to I will figure out how to call Win32 directly
from LabVIEW, but I suspect that there is an easier way. Windows form
controls have a protected method, WndProc(), so I guess I could write a .NET
custom control that handles the messages and reference that custom control
from LabVIEW.

</clip>

 

<clip>

This seems the most promising (I am out of office and thus cannot check the .vi)

http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.labview/2006-01/msg00987.html

</clip>

 

<clip>

MFC-wrapper

http://ni.lithium.com/t5/LabVIEW/What-do-i-need-to-get-started-with-windows-messages/td-p/847629

</clip>

 

 

Message 4 of 10
(6,746 Views)

I just found this:

http://zone.ni.com/devzone/cda/epd/p/id/4394

 

Although there is a comment: does not support WM_COPYDATA... 😞

 

Juha

0 Kudos
Message 5 of 10
(6,744 Views)

Hi Juha,

have your tried it with the windows message queue? Did you get the event?

 

Mike

0 Kudos
Message 6 of 10
(6,731 Views)

No,

 

I haven't ... and I cannot. I have a labview 2009 (on win 7) and the windows_message_que.zip is made with labview 5. It gets nasty with me "cannot convert vi, version is too old".

 

I read the readme file. The copydata message is in supported list. Now, I just have to find a way to convert the vi to my 2009 version... Any suggestions how I do this?

 

 

br,

Juha

0 Kudos
Message 7 of 10
(6,707 Views)

Hi Juha,

there is also a 2009 version on the page.

 

Mike

0 Kudos
Message 8 of 10
(6,703 Views)

 

ups, I was too hasty... there is also a 2009 version...

 

I'll give this a try. Although it seems that you cannot bind these to event handlers... I'll have to play around a bit.

 

br,

Juha

0 Kudos
Message 9 of 10
(6,697 Views)

It works fine for me (WinXP, LV2011).

It is also possible to choose other Windows messages to catch (hook)

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 10 of 10
(6,392 Views)