Can I use this DLL in VB6 ?

BarryTang used Ask the Experts™
I have a DLL written by VC++ 6.0 and some related documents as follows

    A thisDLL.h file
    A thisDLL LIB file
    A thisDLL.dll file

It has no problem to call a function from thisDLL in VC++ as follows

#include "thisDLL.h"

int main()
     func1(my arguments...);
     return 0;

However, when I use it VB6 by following code :

Private Declare Function func1 Lib "thisDLL.dll" (the arguments declaration)
Private Sub Form_Load()
    call func1(my arguments...);
End Sub

It returns :
  Can't find DLL entry point func1 in thisDLL.dll

Is thisDLL can be used in VB6 or not ?

Actually I am not familiar with DLL calling process and know little about VC++.
Does anybody know how to fix my problem or give some hits for me about it.
Thank you


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

is "thisDLL.dll" registered with windows?

first locate where "regsrv32.exe" is and put thisDLL.dll in the same folder as it, then do the following:

start->run->regsrv32 thisDLL.dll
also, thisDLL.dll MUST be a COM DLL, and that takes some special coding in how the Exports are setup in the C++ code.

Not all C++ DLLS are automatically COM-compatible.  And a DLL MUST be COM compatible, to be registered.

you may need to treat the DLL like an API, and EXPLICITLY DECLARE the calling sequence.

Okay to use a c++ dll in vb you have to do a couple things. One add a .DEF file to your c++ project, then you have to add something similar to

     FuncName   @1
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

    FuncName2  @2

and so forth

then to use it in vb you have to do something like

Private Declare Function Func1 Lib "YOURDLL" (ByVal Whatever as whatever)

that should let you use your dll in vb


Hello everybody :

When I try to register this DLL, it returns message as follows :

   thisDLL.dll was loaded, but the DllRegisterServer entry point was not found. This file can not be registered

So this may not be a COM DLL, right ?

Is there a way to solve this problem, actually I don't have the source code of the DLL so that I cannot do modification as List244 suggest !


then, the dll should work fine.


Private Declare Function FUNCNAMEHERE lib "LIBRARY" (byval STuff as stuff)

but you have to know its function names and what it wants you to give it ie: Byval Stuff as stuff ect.


List244 :

I still don't know what is the difference between

Private Declare Function FUNCNAMEHERE lib "LIBRARY" (byval STuff as stuff)

and your previous one :

Private Declare Function Func1 Lib "YOURDLL" (ByVal Whatever as whatever)

Actually in my example, my 3 files are
   A thisDLL.h file
   A thisDLL LIB file
   A thisDLL.dll file
so the library name and dll name are the same

Actually I know the argument declarations : (ByVal ....)
and I try

Private Declare Function func1 Lib "thisDLL.dll"
Private Declare Function func1 Lib "thisDLL"

But both gives similiar error message !

Would you kindly explain it in a little more details since I only know a little about using DLL ?


Try this:
Private Declare Function Function1 Lib "C:\Mydll.dll" ()

''' ASSUMING its actually in C:\... ect...

Or if you dont want to type in "c:\..." then you have to register the dll and then you should be able to do

Private Declare Function Function1 Lib "mydll" ()


List244 :
The result still the same when I use full path in the declaration !

Okay Open the dll with the dependency viewer comes with
visualstudio, if you dont have that then you can download
a free version at:

Open  the dll with this

Now if it shows the functions like


then it will work if it shows you weird symbols
then its lacking the .def file i mentioned before.
And tthe dll will not work in your vb project.

Thhough from the error it seems you may have the wrong function name, check what you have typed with what the dependency walker shows, the dependency walker however, WILL NOT show you what the function wants you will need to know that, but it will tell you the function names.

Now when you redeclare it try

Private Declare Function FUNCNAMEHERE lib "LIBRARY" (byval STuff as stuff)

and still give it the full path remember to include .dll so

If it still errors please paste your highlighted line (the one that errors) as well as the error message here in a comment


List244 :

When I view the DLL with the dependency walker. I find that the function column display as follows :


and the entry point state : 0x00003400

It is difference when I view other windows DLL such as user32.dll, the function name will not consist of strange character like '?','@',....

So, is this fcuntion : func1 not export to use.


Okay thats what I was guessing. As far as I know you can not use that dll, i believe that means only the program that was compiled with that can use it, but im new to c++ and could be wrong. Though i dont believe you can use that in vb either way, in order for it to work with vb it should show a normal name no weird characters like that one did. Sorry, but i can't help you with using that dll.
You have 17 opened questions as of this date.  
I will be posting in each of these questions.  
Please take care of your opened questions older than 30 days by clicking on your logon name link and looking for UnlockedQ or using the links I am providing below.  
Please finalize these within 72 hours or I will ask administration to look into your account at that point.  If you have questions, please ask and I will provide assistance.

Thank you.
Administrative Action - PAQ'd and points NOT refunded.

Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial