Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7
QtWS25 Last Chance

The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7

Scheduled Pinned Locked Moved Solved Installation and Deployment
7 Posts 4 Posters 4.6k Views
  • 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
    mourke
    wrote on last edited by
    #1

    I have successfully deployed my app on Windows 10 and macOS but when testing on Windows 7 I get the following error:

    The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll.

    I have used windeployqt.exe to deploy my application and it has added the following libraries to the build folder:

    • libEGL.dll
    • libGLESV2.dll
    • opengl32sw.dll
    • Qt5Core.dll
    • Qt5Gui.dll
    • Qt5Network.dll
    • Qt5Svg.dll
    • Qt5Widgets.dll
    • styles/qwindowsvistastyle.dll
    • platforms/qwindows.dll
      as well as the vc_redist.x64

    The only other library I am using is libusb which I have statically linked and, to my understanding, do not need to bundle it with the application.

    I have also included the headers: windows.h, WinUser.h and winrt/Windows.UI.ViewManagement.h for the functions SetProcessDPIAware and AllowSetForegroundWindow and the winrt::Windows::UI::ViewManagement class.

    I have also added the #pragma comment(lib, "windowsapp").

    Am I doing something wrong?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, CoIncrementMTAUsage only exists in Windows 8.0, 8.1 and 10.
      And that winrt::Windows::.. stuff only works on Windows 10.
      Qt itself does not call CoIncrementMTAUsage, so perhaps if you don't include the winrt::... files you'll be fine on Windows 7.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mourke
        wrote on last edited by
        #3

        @mourke said in The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7:

        winrt::Windows::UI::ViewManagement

        Oh that makes sense. Can I include them but not call them on earlier versions of windows? I'd rather not resort to using WRL.

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          All bets are off with WRL as well, it doesn't work on Windows 7.

          About including winrt::Windows::UI::ViewManagement files, best/safest would be not to #include them for the Windows 7 version.
          You could try some #ifdef compilation settings, I mean compiling two versions of your program, one for Windows 7 and one for Windows 10.

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @hskoglund said in The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7:

            All bets are off with WRL as well, it doesn't work on Windows 7.

            Yes, see also https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-8-api-sets

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mourke
              wrote on last edited by
              #6

              @hskoglund said in The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7:

              ViewManagement

              Ehhh I'd really prefer to not compile two separate versions. They're dynamically linked libraries so they'd only be loaded once the code is called correct? So if I never call the code by iffing a Windows version runtime check would this not work also?

              Chris KawaC 1 Reply Last reply
              0
              • M mourke

                @hskoglund said in The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7:

                ViewManagement

                Ehhh I'd really prefer to not compile two separate versions. They're dynamically linked libraries so they'd only be loaded once the code is called correct? So if I never call the code by iffing a Windows version runtime check would this not work also?

                Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @mourke said :

                They're dynamically linked libraries so they'd only be loaded once the code is called correct?

                No. The function pointers are resolved when your module is loaded. That's when you're getting that error.
                What you can do is put that troublesome part into another dll and load it dynamically (e.g. using QLibrary) only on Windows versions that support it.

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved