LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DdeConnect API in an MFC program causes my LabWindow appication hanging

My LabWindows application uses ActiveX controller connecting to an MFC application. This MFC application is a DDE client. When it tries to use DdeConnect connecting to a DDE server, all programs are hanging.

In MSDN, I found an artcle, ID: Q136218 may relate to this issue. It says "Any thread that creates a top-level window and doesn't have a message loop will cause DdeConnect to block. The only current solution is to add a message loop to the thread that created the window. "

How can this be done in my LabWindows application?

Thanks
0 Kudos
Message 1 of 4
(3,460 Views)
This is true that this is probably the source of the problem. This doesn't really have anything to do with CVI though since you are using ActiveX. The MFC application you are creating is being run as a separate process and communicated with via ActiveX. The architecture of the CVI process isn't important since it is a separate process and whether the CVI process is processing messages doesn't effect the MFC app process. The problem is your ActiveX MFC application probably isn't processing messages. You need to redesign your MFC application to process messages to run a DDE client inside it. Consult MSDN for how to build your MFC application to have it process messages.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,460 Views)
I use Visual Basic to test the same programs, everything is ok. So I am not sure if the ActiveX MFC program has anything to do with this.
0 Kudos
Message 3 of 4
(3,460 Views)
If that is the case, then the messaging probably isn't the problem. The fix for handling messages would have to be done in the MFC app, not in CVI. I'm not sure what could be causing it.

Chris
0 Kudos
Message 4 of 4
(3,460 Views)