Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DLL loading trouble.

DLL loading trouble.

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    The_Server
    wrote on last edited by
    #1

    I created a dll (Win32- Dynamic Link Library) and I'm having a trouble loading that DLL ( using 'LoadLibrary' / 'GetModuleHandle') *** I keep getting a NULL or the handle is invalid. (GetLastError() returns 6 or 126) *** PLEASE, I've been on then about 6 hours straight. Is there anything I'm missing ???? NOTES: 1: Could it be that functions can not be importable? 2: Could it be that the released .dll file is damaged? please H E L P ! ! ! Name: STR

    Y M 2 Replies Last reply
    0
    • T The_Server

      I created a dll (Win32- Dynamic Link Library) and I'm having a trouble loading that DLL ( using 'LoadLibrary' / 'GetModuleHandle') *** I keep getting a NULL or the handle is invalid. (GetLastError() returns 6 or 126) *** PLEASE, I've been on then about 6 hours straight. Is there anything I'm missing ???? NOTES: 1: Could it be that functions can not be importable? 2: Could it be that the released .dll file is damaged? please H E L P ! ! ! Name: STR

      Y Offline
      Y Offline
      yamini
      wrote on last edited by
      #2

      Hi, The GetLastError() function of yr's says "Handle invalid"(6) and "Module can't be found"(126).So, I hope problem with the Dll path u have given.First find out in which path yr Dll is present and give that path in the LoadLibrary()/GetModuleHandle() function.Then check for the handle.This could be the only problem I hope.Let me know if it works. Regards, yamini.

      T 1 Reply Last reply
      0
      • Y yamini

        Hi, The GetLastError() function of yr's says "Handle invalid"(6) and "Module can't be found"(126).So, I hope problem with the Dll path u have given.First find out in which path yr Dll is present and give that path in the LoadLibrary()/GetModuleHandle() function.Then check for the handle.This could be the only problem I hope.Let me know if it works. Regards, yamini.

        T Offline
        T Offline
        The_Server
        wrote on last edited by
        #3

        Thanks for your quick answer But... That is not the problem. I could this function like this: 1: 'LoadLibrary("c:\\MyDLL2.DLL")' or 2: 'LoadLibrary(_T("c:\\MyDLL2.DLL"))' or 3: 'LoadLibrary((LPCTSTR)"c:\\MyDLL2.DLL")' *) I added 'C:\MyDLL2.lib' in Project->Settings... *) I added 'C:\' to the system path *) I added 'C:\' to the project path (in Project->Settings) :(( I don't know what to do :(( Name: STR

        1 Reply Last reply
        0
        • T The_Server

          I created a dll (Win32- Dynamic Link Library) and I'm having a trouble loading that DLL ( using 'LoadLibrary' / 'GetModuleHandle') *** I keep getting a NULL or the handle is invalid. (GetLastError() returns 6 or 126) *** PLEASE, I've been on then about 6 hours straight. Is there anything I'm missing ???? NOTES: 1: Could it be that functions can not be importable? 2: Could it be that the released .dll file is damaged? please H E L P ! ! ! Name: STR

          M Offline
          M Offline
          Mukkie
          wrote on last edited by
          #4

          Launch depends.exe - Dependency Walker which is a part of MsVisual C++. Drag and drop this Your dll onto depends.exe window. See what it will say. Probably some dll which is required by Your dll cannot be found. For example the dll You are loading needs msvcrt.dll(insert any), which is not on the path. Hope, this helps

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups