CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Unload a dll

  1. #1
    Join Date
    Sep 2005
    Posts
    173

    Unload a dll

    Hi All

    Please tell me that how can I unload a dll.
    As I need to unload msoe.dll.

    Please reply
    Thanks

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: Unload a dll

    Quote Originally Posted by hash123
    Please tell me that how can I unload a dll.
    As I need to unload msoe.dll.
    look at ::FreeLibrary(..)

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #3
    Join Date
    May 2002
    Location
    Phoenix, AZ
    Posts
    95

    Re: Unload a dll

    Call FreeLibrary() with the module handle of the dll which you wish to unload.

    You can get the module handle by calling GetModuleHandle with the name of the module as a parameter.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Unload a dll

    Quote Originally Posted by hash123
    ... I need to unload msoe.dll.
    Why do you need it? Are you using LoadLibrary to load this dll?

  5. #5
    Join Date
    Sep 2005
    Posts
    173

    Re: Unload a dll

    Infact I am not loading msoe.dll,
    I need to unload this dll because if it is not unloaded then it would not change( switch) the identities of Outlook express.

    So tell me that without loading how can I unload a dll.

    Pls reply
    Thanks

  6. #6
    Join Date
    May 2002
    Location
    Phoenix, AZ
    Posts
    95

    Re: Unload a dll

    If you have not loaded the dll explicitly using loadlibrary it means either

    a. You have loaded it implicity - run dumpbin on your binaries and check for references to msoe.dll
    b. You are using some other dll that is using msoe.dll

    In either case you should not unload msoe.dll by calling unloadlibrary, because there are likely to be live references to exported objects / functions in your process. And if in your process, you try to make use of any exported functions / classes exported by msoe.dll after you have explicitly unloaded it, you will get an exception.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured