Hi, i am unable to use the function MonitorFromPoint in my Qt application. I have the latest Qt SDL 2010.05 with mingw on Windows XP
#include <QtCore/QCoreApplication>
#include<windows.h>
#include <winuser.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
POINT pt;
MonitorFromPoint(pt,2);
return a.exec();
}
I added this to the .pro file
LIBS+= -luser32
And the result is
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\include\QtCore" -I"..\include" -I"..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\testUser32" -I"." -I"..\mkspecs\win32-g++" -o tmp\obj\debug_shared\main.o ..\testUser32\main.cpp
mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/testUser32-build-desktop'
mingw32-make: Leaving directory `C:/Qt/2010.05/qt/testUser32-build-desktop'
..\testUser32\main.cpp: In function 'int main(int, char**)':
..\testUser32\main.cpp:8: error: 'MonitorFromPoint' was not declared in this scope
mingw32-make[1]: *** [tmp/obj/debug_shared/main.o] Error 1
mingw32-make: *** [debug-all] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project testUser32 (target: Desktop)
When executing build step 'Make'
Someone on the IRc said that is a mingw prolem and i should use visualc compiler. Switching the compiler will take time and maybe i will findother problems. I imported functions from wingdi.h and i had no problems. I need a better explanation about the problem, how you figure it out and the solution
P.S. I am trying to get the screen geometryes in a multi monitor system, QDesktopWidget does not work ,see the topic http://stackoverflow.com/questions/3966429/capture-multiple-screens-desktop-image-using-qt4