LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Another question about calling dialog from DLL

I have read few of the questions and answers in the forum. However I am still having problem with calling dialog from DLL.

Case :

I tried to use DoModal to open a dialog. The dialog is opened but Labview hangs there and I couldnt select things from my dialog.

Here is my code:

AFX_MANAGE_STATE(AfxGetStaticModuleState());
CInputVoltage dlgInputV;
dlgInputV.DoModal();

Case 2:

I use Create to create a dialog box. Labview closes when I tried to run the VI.

Here is the code:

AFX_MANAGE_STATE(AfxGetStaticModuleState());
CInputVoltage dlgInputV;
dlgInputV.Create(IDD_DIALOG1,NULL);
dlgInputV.ShowWindow(SH_SHOW);

----

I am a beginner on VC++ and LV. Please advise. Thanks.
0 Kudos
Message 1 of 6
(3,274 Views)
MFC CWnd::DoModal starts its own loop so you will not be able to get to LabVIEW until you dismiss the modal dialog.
Call Library node is generally meant for calling c functions from dlls. You are calling separate UI from it. What are you trying to accomplish? May be there is another way around.

A Rafiq
0 Kudos
Message 2 of 6
(3,274 Views)
I have a MFC program that generates voltages needed to control a device. I need to pass the voltages value to VI and then to control the device.

I am calling DLL since the program has been stored in DLL file. It is a dialog.


"MFC CWnd::DoModal starts its own loop so you will not be able to get to LabVIEW until you dismiss the modal dialog.


I can see my dialog comes out but I cant control the dialog UI. Is that what you mean for "calling separate UI from it"?

THanks.
0 Kudos
Message 3 of 6
(3,274 Views)
What you could do, is call LabVIEW through ActiveX from MFC. You point MFC wizard to labview's type library and it will generate the wrapper class for you (i beleive it gets derived from COleDisptachDriver).

Also take a look at
http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E09556A4E034080020E74861&p_node=DZ52061&p_submitted=N&p_rank=&p_answer=&p_source=External

A Rafiq
0 Kudos
Message 4 of 6
(3,274 Views)
Thanks I will look into it. I am a beginner in LV and VC++. By the way, if I call a dll generated by LV, will it able to work?
0 Kudos
Message 5 of 6
(3,274 Views)
Yep that should also work. Actually i would prefer that because it will be faster than using ActiveX

AR
0 Kudos
Message 6 of 6
(3,274 Views)