Hello, i try to port a DLL i made in C++ (Win32, without MFC) to Qt but it's a bit hard.

My DLL is loaded by LoadLibrary from a non-Qt application. But even if it's Qt is portable, it have serious problems with some standards of Windows :|
Actually, i just want to load my QtGui and handle it like any Qt application. Since the entry point DllMain must return a value to continue, i thought i should make a thread to load it. Here is my problem. In this code :

Qt Code:
  1. #include "test_ui.h"
  2. #include <windows.h>
  3. #include <process.h>
  4. #include <QApplication>
  5. #include <QMessageBox>
  6.  
  7. void StartThread();
  8.  
  9. BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID /*lpvReserved*/ )
  10. {
  11. if (dwReason == DLL_PROCESS_ATTACH)
  12. {
  13. DisableThreadLibraryCalls(hModule);
  14. // MessageBoxA(NULL, "Test DllMain", NULL, NULL);
  15. // QMessageBox::information(0, "Test", "Test Qt");
  16. // QtConcurrent::run(StartThread);
  17. //_beginthread((void(*)(void*))StartThread,NULL,NULL);
  18. }
  19. return TRUE;
  20. }
  21.  
  22. void StartThread()
  23. {
  24. MessageBoxA(NULL, "app test", "app test", NULL);
  25. }
To copy to clipboard, switch view to plain text mode 

The MessageBoxA in the DllMain works perfectly, the QMessageBox doesn't, the QtConcurrent neither, and same way for _beginthread.
I tried by the CreateThread function :

Qt Code:
  1. printf("TestThr address : 0x%.8X\n", (DWORD)TestThr);
  2. HANDLE hThread = CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)TestThr, NULL, NULL, NULL);
  3. printf("CreateThread return : %d - GetLastError : %d\n", hThread, GetLastError());
To copy to clipboard, switch view to plain text mode 

The console returned me this :

TestThr address : 0x6F761010
CreateThread return : 380 - GetLastError : 6
The GetLastError return ERROR_INVALID_HANDLE while the CreateThread return me an handle, of course the thread is absolutely not loaded ...
I wanted to try with QtWinMigrate (http://qt.gitorious.org/qt-solutions...r/qtwinmigrate), but it's absolutely not for Qt5 cause there is always much errors.

I tried with this code : http://stackoverflow.com/a/11056698

Actually my GUI is loaded EXCEPT :
  1. The dll don't load into the application it should be, but with another one (AutoIt script) it does
  2. The GUI events are not handled at all, except if i minimize then maximize the UI (sort of repaint)


Well i think i said everything, i use Qt5 final, building with MSVC2010.
I hope you could help me to get this working.