01-28-2010 03:58 PM
Hi
Everyone
I have some questions for us, I hope that can help me, I have made a dll in cvi for send info to databases for web service, this program work very well in cvi. but now I have one problem, I have other program developed in visual basic 6.0, I am not very familiared with VB.
My question is this.
Can I use this same dll made in cvi in the aplication visual basic.??
is possible to do this??
If your responces is yes How ??
I am using a instrument driver of microsoft for use the webservice in the dll this is the soap.fp.
will I need to install this driver to the machine for run the dll ??
Thanks a lot for your responces.
01-29-2010 11:08 AM
You can call a CVI authored DLL from VB, we do it all the time.
There are some limitations on the data types that are supported. For example, VB6 doesn't support an unsigned integer type. and it can be tricky to pass a string fromthe DLL to VB.
If you add a type library then the dll can be added to the VB development environment as a reference.
Menchar
01-29-2010 11:33 AM
Menchar
Thanks for your help
Do you known what is the sintaxis that I will need to declare in VB for call to dll ??
Mario Ku
01-29-2010 11:44 AM
There's a white paper on the NI website, or included in the CVI help, that talks about calling DLL's from VB6.
We always include a type library and add the dll as a reference.
Otherwise, you need to use a Declare statement to let VB6 know how to make the call.
Data type considerations aside, you add the DLL C function prototype to your VB^ application in a Declare statement.
01-29-2010 11:50 AM
02-02-2010 08:45 AM
Hi
Menchar
I have other question, I have define in the top of the project VB my dll but
where I define the path in where the project VB try to find this dll ??.
Thanks for your help.
02-02-2010 10:12 AM
Windows will automatically search for the DLL when it tries to load it when you start the VB6 application.
The search path differs a bit by OS version, but generally it looks in the directory of the application .exe file first, then the system directory ( C:\WINDOWS\system32 on an XP machine), then the current directory, and so on.
The exact search path is the one used by LoadLibrary Win32 function.
You can also specify the DLL path in the declare function I believe.
Here's an example of declaring a function timeGetTime that's in a DLL named winmm.dll:
Public Declare Function timeGetTime Lib "winmm.dll" () As Long
02-02-2010 01:07 PM
thanks for your responces Menchar.
I have define my dll in the top of the project visual basic and I have access to this but now I am having a problem with the convention of call of the dll.
I have been reading and need to declare the functions to export with stdcall for that these work well in visual basic. before I had to declare these of this manner __declspec(dllexport) int validaFlujo(char c_serialNumber[50],char resultado[10]) with declspec now I need to declare stdcall but I have restrictions with this I can not to declare more of one variable in the function.
what is the best form for declare the function with stdcall if I have more of one variable in the function??
thanks for your help.
02-02-2010 01:21 PM
Heres a declaration I use for a single parameter function:
int DLLEXPORT DLLSTDCALL TGF_USB_Port_Enable (int ComPort);
02-02-2010 05:24 PM
Thanks so Much
Menchar.
I have conected the project VB with the dll..
Thanks again.