Discussion Locked

Communication between VB and C DLL

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

HI
I have to develope a software which will varify the data in database. I am using VB as GUI and access as database. I want to communicate with a C DLL. The DLL will check for null value and return the reresults. My problem is how can I pass a recordset to a dll ? How should I commuicate with dll from VB ?

7 replies

by kevin.riggs

Are you writing the C .dll? Here are the steps I would take but I don't know where you are in this process:

Create C class that accepts a recordset as input and returns whatever value in whatever type you want.

Put a copy of the C .dll on your computer.

In your VB program, make a reference to this .dll. Select Project and References. Choose the Browse button and find the C .dll file.

Now you can instantiate the .dll in your VB application and pass whatever parameters you want to the .dll.

ex - If the .dll is dbverify.dll then:
Dim m_rsRemote as New dbverify.verify

'You have instantiated the .dll
'and can now use it
m_rsRemote.checkForNulls(m_rsLocal)

You can also create the database verifier in VB if you want. It will be a little slower but if you are planning on use ADO, you are going to have a slight performance hit anyway in your C .dll.

If the C .dll exists on a server rather than your local machine, you can either browse to it remotely or you can create an export package from the server and register it on your local machine (which is pretty similar to browsing to it since it is merely defining the server and putting a CLSID for the remote .dll in your registry).

by wayne m.

Look at Microsoft COM. THis is a set of intrface standards for DLLs. If you build your C DLL in Visual Studio, select the COM DLL project and it will set up most of the structure for you. You can then import the DLL into your VB project and program to the DLL.

by ohjani

if u the C DLL has the correct parameter to accept a recordset, then i think what u should be is

Dim myObj
Set myObj = CreateObject("")
myObj.YourClassName ()
Set myObj = Nothing

This discussion is closed to new replies.