LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI DLL utilizing Windows Message Callbacks

Solved!
Go to solution

Background:

I had a CVI executable application that wrapped around a third party DLL.  I recently built some LabView modules and wanted to use the features in the CVI code.  I stripped out as much as I can from the CVI code and built a DLL out of it, so now its a CVI DLL calling a third party DLL.  The third party DLL uses windows messaging to communicate with teh CVI DLL.  I did not want to re-write the functions already developed in CVI in LabView (way too much effort).

 

Problem:

The issue is windows messaging within CVI uses the InstallWinMsgCallback, and ties it to a panel.  The events aren't processed until you call RunUserInterface(). RunUserInterface does not return. therefore, any LabView module that loads this DLL will hang, waiting for the DLL to return.

 

Has anyone developed a CVI DLL, that uses internal callbacks, which can be called from an external process?   Does anyone have any ideas of how to get around it?

0 Kudos
Message 1 of 3
(2,787 Views)

Hi Bjoles,

 

According to the InstallWinMsgCallback function help, you can use both RunUserInterface() and ProcessSystemEvents() to handle the event.  Have you tried using the ProcessSystemEvents() function?  RunUserInterface() would be expected to simply run until stopped by a call to QuitUserInterface(), which you did not mention to be a feature of your DLL.  

 

Warm Regards,

Daniel Dorroh
National Instruments
0 Kudos
Message 2 of 3
(2,765 Views)
Solution
Accepted by topic author Bjoles

Daniel,

 

I actually stumbled upon the same solution before you posted.  One thing I did notice however is that it was a bit unpredictable when the message would be received.  It turns out that setting the InstallWinMsgCallback to intercept rather than in_queue worked without needing to loop a processsystem events.

 

-Bryan

0 Kudos
Message 3 of 3
(2,757 Views)