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. See if dll exist

See if dll exist

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
9 Posts 4 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.
  • M Offline
    M Offline
    marca292
    wrote on last edited by
    #1

    Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof

    V CPalliniC L 3 Replies Last reply
    0
    • M marca292

      Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof

      V Offline
      V Offline
      venkatmakam
      wrote on last edited by
      #2

      I think you can use the API PathFileExists() to check wheather a file exist or not in disk. http://msdn.microsoft.com/en-us/library/bb773584%28v=vs.85%29.aspx[^] But according msdn loadlibrary function will return with fail if it wont find the file specified dll.

      M 1 Reply Last reply
      0
      • M marca292

        Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        If you a priori know where the DLL should be then your strategy might be good. On the other hand if you need to follow the same procedure the OS does for searching the DLL then you'll meet the same hanging conditions, I suppose. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • M marca292

          Hi, How can I check if a dll exist in c++ before I try to load it with dllHandle = LoadLibraryW(m_sFileName)? Sometimes it looks like that the LoadLibraryW call hangs the calling thread if the dll doesn't exist on the disc. Regards Olof

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          It's probably more important to investigate why the program hangs. LoadLibrary() should merely search through all paths in the PATH variable to find the named DLL. If it hangs during that process then there is something wrong with your system.

          I must get a clever new signature for 2011.

          M 1 Reply Last reply
          0
          • V venkatmakam

            I think you can use the API PathFileExists() to check wheather a file exist or not in disk. http://msdn.microsoft.com/en-us/library/bb773584%28v=vs.85%29.aspx[^] But according msdn loadlibrary function will return with fail if it wont find the file specified dll.

            M Offline
            M Offline
            marca292
            wrote on last edited by
            #5

            Thanks, I will try this.

            1 Reply Last reply
            0
            • L Lost User

              It's probably more important to investigate why the program hangs. LoadLibrary() should merely search through all paths in the PATH variable to find the named DLL. If it hangs during that process then there is something wrong with your system.

              I must get a clever new signature for 2011.

              M Offline
              M Offline
              marca292
              wrote on last edited by
              #6

              Hi, the problem occurs when the user do sleep/resume test with the computer. We try to load the dll with LoadLibrary and a few milliseconds after the LoadLibrary call the user puts the system into sleep. Maybe thats why I got the problem?

              L 1 Reply Last reply
              0
              • M marca292

                Hi, the problem occurs when the user do sleep/resume test with the computer. We try to load the dll with LoadLibrary and a few milliseconds after the LoadLibrary call the user puts the system into sleep. Maybe thats why I got the problem?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                This is a joke, right? You really expect your program to continue running when the OS enters sleep mode?

                I must get a clever new signature for 2011.

                M 1 Reply Last reply
                0
                • L Lost User

                  This is a joke, right? You really expect your program to continue running when the OS enters sleep mode?

                  I must get a clever new signature for 2011.

                  M Offline
                  M Offline
                  marca292
                  wrote on last edited by
                  #8

                  Of cours not, are you stupid or??? It very difficult to know when the user puts the system into sleep. And I don't see the meaning of your comment, you have no idea how big our application is and how it work. The application stops working ~1/100 sleep resume tests. Thanks for your answer!

                  L 1 Reply Last reply
                  0
                  • M marca292

                    Of cours not, are you stupid or??? It very difficult to know when the user puts the system into sleep. And I don't see the meaning of your comment, you have no idea how big our application is and how it work. The application stops working ~1/100 sleep resume tests. Thanks for your answer!

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    marca292 wrote:

                    are you stupid or?

                    No, how about you?

                    marca292 wrote:

                    ou have no idea how big our application is and how it work.

                    I did not say I did?

                    marca292 wrote:

                    The application stops working ~1/100 sleep resume tests.

                    I have no idea what this is supposed to mean.

                    I must get a clever new signature for 2011.

                    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