System.DllNotFound Exception

  • Thread starter Thread starter AP
  • Start date Start date
A

AP

Hello, I am trying to register a dll so that I can call functions from it
within vb.net.
I have used the command "regsvr32 game.dll" which diplays a message box
saying DllRegisterServer in Game.dll suceeded.

In my VB.net application, I have added the following function to a module.

Declare Auto Sub CGL Lib "Game.dll" _
Alias "CreateGameLevel" (ByVal s As Integer)

When I try to run the program with the code CGL(1) placed in the Form load
method, I get an System.DllNotFound Exception, unable to load dll.
Why is this message appearing after windows has successfully registered the
dll, what am I doing wrong?

Thanks
AP
 
Hello AP



API declaration like

Declare Auto Sub CGL Lib "Game.dll" _
Alias "CreateGameLevel" (ByVal s As Integer)

is used for "native" dll`s you do not need to register them ( they are
written in C , C++ ) the dll muct be in the system directory or in the
application path

dll`s that need to be registred with regsvr32.dll ( needed for install
location , and classid lookup ) are dll`s with a std ole interface (
Activex / COM / idispatch ) these dll`s need to be referenced in your
project .

project explorer , references , select the COM tab , press browse and
select the dll , now in you project you can access the property`s and
methods with the following syntax

private nameyoulike as new yourclassname

if the class exposes events

private withevents nameyoulike as new yourclassname


hth

M. Posseth
 
Thanks for the info. I have used your code, but I get an error saying that
the object isnt initialised.
How do I initialise the object with a running instance?
What do I need to pass as a parameter for the getObject() function? Name of
the dll? Name of the class? Title of the window?

Thanks
AP
 
in wich language is the dll written ? ,,,,, because if it has a ole
interface ( win 32 non native windows ) you should use the functionality as
i showed however if this dll is written in a .Net language and does not
enforce an exposed COM interface you must set a .Net reference ( the first
tab instead of the second COM tab )

regrds

Michel Posseth
 

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

Back
Top