How to call functions from a VB6 dll ??

  • Thread starter Thread starter Jason Jacob
  • Start date Start date
J

Jason Jacob

To all,

How can I make function calls from a VB6 dll in c# ???
What are type libraries ?? Is it the XXX.lib file generated by VB6 ??

I've tried using P/Invoke to call the dll, but IO Exception occurs
(..... can't find the function's Entry Point ....)

Thanks

From Jason (Kusanagihk)
 
The only way to call into C# from VB6 or the other way arround is through
COM interop.
Search the MSDN docs for "COM Interop" and you will find a tutorial that
explains very well what should be done.

Willy.
 
To all,

Thanks for the links first, but I want to clarify 1 thing.
If I'm using .Net to write a class library (Dll), then all I have to
do is to import that dll under "References", then I can instantiate
the dll object and perform the functions (ie. treat it as an object).
Is that right? It worked quite well to me.

But if the dll is written by unmanaged code (eg. VB6), then I must
somehow create a type library for that dll first (but how ???),
hopefully, if I could generate the required type library file, I can
import and use it just like the above way ??? (I don't know yet, since
I don't know how to generate the type library)
Or, I should use P/Invoke instead ???

Thanks

From Jason (Kusanagihk)
 
Inline ***
Willy.

Jason Jacob said:
To all,

Thanks for the links first, but I want to clarify 1 thing.
If I'm using .Net to write a class library (Dll), then all I have to
do is to import that dll under "References", then I can instantiate
the dll object and perform the functions (ie. treat it as an object).
Is that right? It worked quite well to me.
*** Right.
But if the dll is written by unmanaged code (eg. VB6), then I must
somehow create a type library for that dll first (but how ???),
*** VB6 merges the typelib info into the DLL, so you only need to reference
the DLL as a COM DLL.
 
to all,

Thanks! It works well now.
But one last question, from the MSDN link supplied earlier, I've read
something like a "Wrapper" class to wrap up the unmanaged dll....
What does that mean ?? (sounds complicated)

Thanks again!

From Jason (Kusanagihk)
 
Jason,
What was your resolution for this problem? I am doing the exact
samething right now. Thank you for your help


Richard
 
To Richard,

Please read the 6th thread.
Actually, just include the dll to your project through "Reference -->
add reference --> browse for the dll......."

everything should be working as long as that dll doesn't contain
functionalities that your WinCE/PocketPC Platform doesn't support at
all.

From Jason (Kusanagihk)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top