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. COM dll that uses Windows7 libraries on XP

COM dll that uses Windows7 libraries on XP

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelpquestion
5 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.
  • A Offline
    A Offline
    Al_Pennyworth
    wrote on last edited by
    #1

    I am at a loss and I am hoping someone can lead me down the right path. I have a COM dll that is written in C++. If a user is on Windows7 (or higher), the user will have the option of invoking this new functionality. Otherwise, it will not be available. The problem is that this new functionality uses specific libraries that are only available with Windows7. I didn't think it was a problem until I went to register the DLL on a XP box, where the registration fails. I am certain it is because of these libraries (which are in the project settings). Is there any way to make the DLLS conditional? I have been looking for some different methods but I haven't located anything.

    T L 2 Replies Last reply
    0
    • A Al_Pennyworth

      I am at a loss and I am hoping someone can lead me down the right path. I have a COM dll that is written in C++. If a user is on Windows7 (or higher), the user will have the option of invoking this new functionality. Otherwise, it will not be available. The problem is that this new functionality uses specific libraries that are only available with Windows7. I didn't think it was a problem until I went to register the DLL on a XP box, where the registration fails. I am certain it is because of these libraries (which are in the project settings). Is there any way to make the DLLS conditional? I have been looking for some different methods but I haven't located anything.

      T Offline
      T Offline
      TheGreatAndPowerfulOz
      wrote on last edited by
      #2

      You can try using the "delay load" functionality of the linker for the dependent Win7 DLLs. If that doesn't work, you will need to LoadLibrary()[^] them, and use GetProcAddress()[^]

      If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
      You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

      A 1 Reply Last reply
      0
      • T TheGreatAndPowerfulOz

        You can try using the "delay load" functionality of the linker for the dependent Win7 DLLs. If that doesn't work, you will need to LoadLibrary()[^] them, and use GetProcAddress()[^]

        If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
        You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

        A Offline
        A Offline
        Al_Pennyworth
        wrote on last edited by
        #3

        Ah, loadlibrary, it never even occurred to me. I have used it for DLLs but I have never tried it for libraries. I will give that a try.

        T 1 Reply Last reply
        0
        • A Al_Pennyworth

          Ah, loadlibrary, it never even occurred to me. I have used it for DLLs but I have never tried it for libraries. I will give that a try.

          T Offline
          T Offline
          TheGreatAndPowerfulOz
          wrote on last edited by
          #4

          If these are static libraries (.LIBs) you're linking to that refer to win7 dlls, then you'll need to put the code that refers to those static libraries into a DLL and then LoadLibrary() those. Also you could detect the OS, and only LoadLibrary() when on Win7 or greater.

          If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
          You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

          1 Reply Last reply
          0
          • A Al_Pennyworth

            I am at a loss and I am hoping someone can lead me down the right path. I have a COM dll that is written in C++. If a user is on Windows7 (or higher), the user will have the option of invoking this new functionality. Otherwise, it will not be available. The problem is that this new functionality uses specific libraries that are only available with Windows7. I didn't think it was a problem until I went to register the DLL on a XP box, where the registration fails. I am certain it is because of these libraries (which are in the project settings). Is there any way to make the DLLS conditional? I have been looking for some different methods but I haven't located anything.

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

            Hi, When you compile your COM library you need to #define the appropriate WINVER, _WIN32_WINNT and _WIN32_IE. By setting these values the windows headers will #include or exclude specific functions/libraries. You may receive some compilation errors after setting these values. Do not panic... you will need to use LoadLibrary/GetProcAddress at runtime to determine if the functions are available. Some Win7 features may not be available on WinXP so you may need to re-implement some portions of your application for backwards compatibility. Using the Windows Headers[^] Best Wishes, -David Delaune

            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