locked
VB.NET DLL Explicit run-time linking RRS feed

  • Question

  •  Hi

    What are the main  functions needed to create a .dll file in vb.net which needs to be Explicitly linked i.e at run time to an application
    Plz post me an equivalent code snippet in VB.Net



    Explicit run-time linking
    DLL files may be explicitly loaded at run-time, a process referred to simply as run-time dynamic linking by Microsoft, by using the LoadLibrary (or LoadLibraryEx) API function. The GetProcAddress API function is used to lookup exported symbols by name, and FreeLibrary — to unload the DLL.


    HINSTANCE hOle2Dll ;
     
    hOle2Dll = LoadLibrary ( "OLE2.DLL" ) ;
     
    if ( hOle2Dll != NULL )
    {
      FARPROC lpOleDraw ;
     
      lpOleDraw = GetProcAddress ( hOle2Dll , "OleDraw" ) ;
     
      if ( lpOleDraw != (FARPROC)NULL )
      {
        (*lpOleDraw) (pUnknown , dwAspect , hdcDraw , lprcBounds ) ;
      }
      FreeLibrary ( hOle2Dll ) ;
    }
    The procedure for explicit run-time linking is the same in any language that supports pointers to functions, since it depends on the Windows API rather than language constructs.



    Thanks

    Silna


    Regards anliS www.businessinsightsconsulting.com
    Wednesday, February 25, 2009 2:27 PM

Answers

All replies