Thread: Dll woes

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    8

    Dll woes

    Hi
    Quick question about loading dlls. I used to have windows Malignant Edition and put my dll's into the windows system folder and everything was okay, now I have win 2000 and I cant get my dlls to load, where should they be placed? I have tried the various WINDOWS & WINNT system/system32 folders.
    I load dlls like this
    Code:
    LibInst = LoadLibrary( "WH_KeyHook" );
    hhk = SetWindowsHookEx( WH_GETMESSAGE, ( HOOKPROC ) &GetMsgProc, hInst, 0 );
    the return values are checked for NULL so I assume all is okay there. My dlls should be fine to as they worked before, this driving me nuts.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Is WM_KeyHook.DLL somewhere in your search path?
    Try using a full pathname in the call LoadLibrary().
    If LoadLibrary() returns NULL, call GetLastError() to see why it failed.

    gg

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Win2000? Probably c:\WinNT\system32...

    LoadLibrary uses the following list to look for dlls

    • The directory from which the application loaded.
    • The current directory.
    • The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
    • The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
    • The directories that are listed in the PATH environment variable.
    Or you can use a custom directory and use LoadLibraryEx to load the dll

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    8
    LOL, it was one of those stupid errors you dont want to admit to.
    Heh heh, I changed the name of hInst to LibInst, but the complier didnt pick it up because I'd called something else hInst.
    *slaps himself about the head with keyboard*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. Replies: 1
    Last Post: 09-18-2005, 09:06 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  4. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  5. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM