LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows messaging

I am interested to know how to communicate with another program using
Windows messaging from LabVIEW. I did not develop the program with which I
want to communicate. The developer allows other programs to interact with
it using Windows messaging.

I need to post messages to that application and receive messages from that
application. The application does not use Windows message ID's. Instead it
uses a message name. The message ID can be determined using a Win32 call,
RegisterWindowMessage().

National Instruments has an example LabVIEW 5.1 program with a C++ DLL that
receives messages, although it does not post messages. It works with
message ID's. Unfortunately, I cannot even get the C++ to compile using
Microsoft C++ 6.0. Something about "redefinition of Occur".

The developer of the application knows that they have customers who are
interfacing with their software using LabVIEW. The developer does not know
the particulars. But they did say that some big name companies are doing
it. Darn, I wish I had their budget.

I attempted to write a VB.NET 2.0 Windows control and use WndProc() to
handle messages. It just sat there. Even when I called it from a VB.NET
2.0 containing form. It responds to messages from the application, but not
from an external application.

I have a VB.NET 1.1 program that overrides WndProc() in the Windows form.
It behaves. I can receive messages and post messages. Now if I can only
teach LabVIEW how to do that!

I am an application programmer. I did not expect to have to get this
intimate with Windows. Is there someone who has done this from LabVIEW or
can steer me through some of the issues. I would be delighted.

Thanks,
Hamilton Woods


0 Kudos
Message 1 of 25
(3,362 Views)
0 Kudos
Message 2 of 25
(3,337 Views)
0 Kudos
Message 3 of 25
(3,335 Views)

Hi Hamilton,

 

Did those example programs linked above help (are you working in LabVIEW 2009)? You can also use LabVIEW to call a DLL, would you consider calling your DLL in LabVIEW? 

 

I'd like to get a little more background information from you.  What kind of messages do you need to post back to windows?  What version of LabVIEW are you working in?  Windows version? 64 or 32 bit? 

 

Cheers, 

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 4 of 25
(3,317 Views)
Accutrol wrote:
> I am interested to know how to communicate with another program using
> Windows messaging from LabVIEW. I did not develop the program with which I
> want to communicate. The developer allows other programs to interact with
> it using Windows messaging.
>
> I need to post messages to that application and receive messages from that
> application. The application does not use Windows message ID's. Instead it
> uses a message name. The message ID can be determined using a Win32 call,
> RegisterWindowMessage().
>
> National Instruments has an example LabVIEW 5.1 program with a C++ DLL that
> receives messages, although it does not post messages. It works with
> message ID's. Unfortunately, I cannot even get the C++ to compile using
> Microsoft C++ 6.0. Something about "redefinition of Occur".
>
> The developer of the application knows that they have customers who are
> interfacing with their software using LabVIEW. The developer does not know
> the particulars. But they did say that some big name companies are doing
> it. Darn, I wish I had their budget.
>
> I attempted to write a VB.NET 2.0 Windows control and use WndProc() to
> handle messages. It just sat there. Even when I called it from a VB.NET
> 2.0 containing form. It responds to messages from the application, but not
> from an external application.
>
> I have a VB.NET 1.1 program that overrides WndProc() in the Windows form.
> It behaves. I can receive messages and post messages. Now if I can only
> teach LabVIEW how to do that!
>
> I am an application programmer. I did not expect to have to get this
> intimate with Windows. Is there someone who has done this from LabVIEW or
> can steer me through some of the issues. I would be delighted.
>
> Thanks, Hamilton Woods

This newsgroups is not frequently used.
See:
http://forums.ni.com/ni/board?board.id=170
0 Kudos
Message 5 of 25
(3,316 Views)

Marti,

 

Thanks for your response.

 

I am using LabVIEW 8.5.  I am pretty sure that the Microsoft Visual C++ DLL source has not been 

updated on the NI Developer Zone.  I was unable to get it to compile.  I was thinking that I might 

extend it to allow message posting as well.  I am pretty sure that I am going to use a different 

solution.

 

The provider of the3rd party app sent me a zip file with a Delphi example.  It turns out that the 

zip file also contained a .NET 1.1 example as well.  I have that example doing what I need to do 

from within LabVIEW.  Basically, I need to listen for specific messages (WM_CIRRIS_APP0 through 

WM_CIRRIS_APP19) and to broadcast messages for the 3rd party app to receive.

 

I created a .NET 2.0 custom control (WndProc() lives as a protected method of a control) that I 

instantiated in LabVIEW.  The custom control received no messages.

 

If I cannot solve the issue any other way, I will write a .NET application that sits between LabVIEW 

and the 3rd party app.  I will use something (probably sockets) to communicate between

LabVIEW the .NET application.  I will, obviously, use Windows messaging to communicate 

between the .NET application and the 3rd party app.

 

Thanks again for all the responses to my question,

Hamilton Woods, Certified LabVIEW weanie

 

0 Kudos
Message 6 of 25
(3,304 Views)

One correction - replace

 

"I have that example doing what I need to do from within LabVIEW"

 

with


"I have that example doing what I need to do.  Now I need to figure 

out how to do that from with LabVIEW"

 

Thanks again, and have a blessed day,

Hamilton Woods

 

0 Kudos
Message 7 of 25
(3,302 Views)

Hamilton,

 

I think you are making this more complicated than it needs to be.  Muks was pointing you in the right direction... My LabVIEW app uses a USB security dongle that posts messages when it is plugged in or removed.   The app has to receive these messages to decide whether to run or not.  I used the same files Muks pointed at - it really is pretty straightforward. 

 

I'm not allowed to send out my VIs, but take a look at these screenshots.  All you have to do is create the message queue, and then pass the hwnd and queue around as needed. 

 

Jason
Download All
Message 8 of 25
(3,280 Views)

Anonymous wrote:
This newsgroups is not frequently used.
See:
http://forums.ni.com/ni/board?board.id=170

Where do you think you are?

 

This IS the National Instruments discussion forum linked to by the web address you gave.

0 Kudos
Message 9 of 25
(3,278 Views)
I think that poster is probably accessing the forums through a newsreader and not a web browser.
0 Kudos
Message 10 of 25
(3,264 Views)