LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Couldn't see a dialog message from VC++ in LabVIEW 6

Hi!

My problem is that I have a DLL in VC++ and this DLL gives a dialog
message to LabVIEW. When I include
AFX_MANAGE_STATE(AfxGetStaticModuleState()); it doesn't chrash but the
dialog message doesn't appear. If I dont't include this term the
dialogbox is shown but it chrash.


// AFX_MANAGE_STATE(AfxGetStaticModuleState());


AfxMessageBox("Starte Dialog mit DoModal");
ODlg_NumberEdit oDlg;
AfxMessageBox("Mitte Dialog mit DoModal");

oDlg.DoModal();


Thanks for help
0 Kudos
Message 1 of 2
(2,525 Views)
hahnenbrick,

The thread which calls the dialog box must be apartment threaded. Since LabVIEW threads are initialized for a different thread model, a LabVIEW thread cannot directly call an MFC dialog. You would need to create a temporary thread, initialize it correctly, and then call the dialog box from this temporary thread. The original thread waits on the temporary thread to finish and then returns back to LabVIEW.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 2
(2,525 Views)