LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

call dll made in cvi in visual basic

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.

 

 

0 Kudos
Message 1 of 12
(4,684 Views)

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

0 Kudos
Message 2 of 12
(4,671 Views)

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

0 Kudos
Message 3 of 12
(4,667 Views)

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.

0 Kudos
Message 4 of 12
(4,664 Views)
Thanks.
0 Kudos
Message 5 of 12
(4,662 Views)

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.

0 Kudos
Message 6 of 12
(4,633 Views)

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.


  1. The directory from which the application loaded.
  2. The current directory.
  3. The system directory. Use the GetSystemDirectory function to get the path of this directory.
  4. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
  5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  6. The directories that are listed in the PATH environment variable.

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

 

0 Kudos
Message 7 of 12
(4,628 Views)

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.

 

0 Kudos
Message 8 of 12
(4,618 Views)

Heres a declaration I use for a single parameter function:

 

int DLLEXPORT DLLSTDCALL TGF_USB_Port_Enable (int ComPort); 

0 Kudos
Message 9 of 12
(4,616 Views)

Thanks so Much

 

Menchar.

 

I have conected the project VB with the dll..

 

 

Thanks again.

0 Kudos
Message 10 of 12
(4,611 Views)