System.DllNotFound Exception

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AP

    #1

    System.DllNotFound Exception

    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 DllRegisterServ er 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 "CreateGameLeve l" (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.DllNotFo und Exception, unable to load dll.
    Why is this message appearing after windows has successfully registered the
    dll, what am I doing wrong?

    Thanks
    AP



  • m.posseth

    #2
    Re: System.DllNotFo und Exception

    Hello AP



    API declaration like

    Declare Auto Sub CGL Lib "Game.dll" _
    Alias "CreateGameLeve l" (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


    "AP" <no@no.com> wrote in message news:UqadnbLJm8 zPCqzeRVnygA@pi pex.net...[color=blue]
    > 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 DllRegisterServ er 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 "CreateGameLeve l" (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.DllNotFo und Exception, unable to load dll.
    > Why is this message appearing after windows has successfully registered
    > the dll, what am I doing wrong?
    >
    > Thanks
    > AP
    >
    >
    >[/color]


    Comment

    • AP

      #3
      Re: System.DllNotFo und Exception

      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

      "m.posseth" <michelp@nohaus ystems.nl> wrote in message
      news:uMsx0NtvFH A.2132@TK2MSFTN GP15.phx.gbl...[color=blue]
      > Hello AP
      >
      >
      >
      > API declaration like
      >
      > Declare Auto Sub CGL Lib "Game.dll" _
      > Alias "CreateGameLeve l" (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
      >
      >
      > "AP" <no@no.com> wrote in message news:UqadnbLJm8 zPCqzeRVnygA@pi pex.net...[color=green]
      >> 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 DllRegisterServ er 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 "CreateGameLeve l" (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.DllNotFo und Exception, unable to load dll.
      >> Why is this message appearing after windows has successfully registered
      >> the dll, what am I doing wrong?
      >>
      >> Thanks
      >> AP
      >>
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • m.posseth

        #4
        Re: System.DllNotFo und Exception


        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


        "AP" <no@no.com> wrote in message news:LPydna3sfK fXJKzeRVnyuQ@pi pex.net...[color=blue]
        > 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
        >
        > "m.posseth" <michelp@nohaus ystems.nl> wrote in message
        > news:uMsx0NtvFH A.2132@TK2MSFTN GP15.phx.gbl...[color=green]
        >> Hello AP
        >>
        >>
        >>
        >> API declaration like
        >>
        >> Declare Auto Sub CGL Lib "Game.dll" _
        >> Alias "CreateGameLeve l" (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
        >>
        >>
        >> "AP" <no@no.com> wrote in message
        >> news:UqadnbLJm8 zPCqzeRVnygA@pi pex.net...[color=darkred]
        >>> 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 DllRegisterServ er 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 "CreateGameLeve l" (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.DllNotFo und Exception, unable to load dll.
        >>> Why is this message appearing after windows has successfully registered
        >>> the dll, what am I doing wrong?
        >>>
        >>> Thanks
        >>> AP
        >>>
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...