LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display a dialog created from VC++6.0 in Lab/CVI 5.5

I created a MFC Extension DLL in VC++6.0, and include a dialog in the DLL.
In the export function, a dialog is created.
I need to display the dialog in a CVI exe application. I include the .h and
.lib files in the CVI project. In the main function of CVI exe, I call the
VC exported function to generate the dialog, but failed. The reason I've
got as far is when executing CDialog::Create(...) , WIN32 API AfxGetInstanceHandle()
is called. It should return the handle of current application., then the
location can be decided from where the resource loaded. But AfxGetInstanceHandle()
can¡¯t return a valid handle always NULL.
If the main application is generated with VC++6.0, no matter the display
function
is called directly by the VC++ application or via a DLL from CVI,
everything is OK. But if the main application is generated with CVI, it fails
all the time.
I don¡¯t know if the CVI exe application does not accept a VC++ DLL which
exports dialog. If it accepts such DLL, what should I do ?
0 Kudos
Message 1 of 3
(2,963 Views)
Since this is more of a LabWindows/CVI question, as opposed to LabVIEW, you probably should think about posting this question in the LabWindows/CVI newsgroup from this location:

http://newsgroups.ni.com/cgi-bin/dnewsweb.exe

I hope this helps,

Carlos Lopez
0 Kudos
Message 2 of 3
(2,963 Views)
Hello friends,
Thank for your help! I already know why I got the problem. Although here
is not CVI newsgroup, I think I'd better answer from here at first 'Cause
I raised the question here.
I already solved the problem and I'd like to write it here, hope it can help
someone now or in the future she/he has similar problem like me.
If a DLL create under MS Visual C++ 6.0 with MFC support and plan to call
it from other C application, ''Regular DLL with MFC statically linked' and
'Regular DLL using shared MFC DLL' can be selected. 'Cause the these two
kinds of DLLs are embeded with a CWinApp object. But 'MFC Extension DLL (using
shared MFC DLL)' does not have a CWinApp object and it can only be called
under an application starts from a CWinApp object.

Best wishes

Sh
rimp
0 Kudos
Message 3 of 3
(2,963 Views)