The procedure entry point CoIncrementMTAUsage could not be located in the dynamic link library ole32.dll on Windows 7
-
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
andwinrt/Windows.UI.ViewManagement.h
for the functionsSetProcessDPIAware
andAllowSetForegroundWindow
and thewinrt::Windows::UI::ViewManagement
class.I have also added the
#pragma comment(lib, "windowsapp")
.Am I doing something wrong?
-
-
@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.
-
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. -
@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
-
@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?
-
@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.