I'm currently developing a screen reader project using C++. The problem starts when i tried to create an IUIAutomation object instance. The vscode and the g++ complains that IUIAutomation is undefined, even though the #include <uiautomation.h> works perfectly. After some digging into the libraries i discovered that the definitions of IUIAutomation are indeed missing from the uiautomationcore.h file (maybe to old versions?). MinGW64 update did nothing...
I tried "stealing" the uiautomation.h, uiautomationcore.h, uiautomationclient.h and uiautomationcoreapi.h files from the latest Windows SDK (under ..\Include\10.0.22621.0\um folder) and replace the old MinGW64 ones. This worked up well until there was the need to initialize the IUIAutomation instance.
According to Documentation, the code below should do the trick but it produces the following errors on compilation.
bool IUIARecorder::InitializeUIAutomation(IUIAutomation **automation) {
if (!SUCCEEDED(CoInitialize(NULL))) {
std::cout << "Error while CoInitialize()..." << std::endl;
}
HRESULT hr = CoCreateInstance(CLSID_CUIAutomation, NULL, CLSCTX_INPROC_SERVER, IID_IUIAutomation, reinterpret_cast<void **>(&automation));
return (SUCCEEDED(hr));
}
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccL19ouT.o:main.cpp:(.rdata$.refptr.CLSID_CUIAutomation[.refptr.CLSID_CUIAutomation]+0x0): undefined reference to CLSID_CUIAutomation' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccL19ouT.o:main.cpp:(.rdata$.refptr.IID_IUIAutomation[.refptr.IID_IUIAutomation]+0x0): undefined reference to IID_IUIAutomation'
Seems that 'CLSID_CUIAutomation' & 'IID_IUIAutomation' are undefined, which is not the case if you see the source (from Windows SDK) in uiautomationcore.h.
For the sake of completeness, i need to integrate it with a Gtkmm inteface so i am kind off stuck with MinGW64. In the best of my knowledge i cannot use Msvc for the job.
Does anyone knows anything that can be helpful?