Hello !

First I appologize for my english, I'm french.

I'm building a DLL who contains QWidgets. This DLL is launch by an external software (Flight Simulator X).

I have to SetParent() my Qt window to FSX, but the result is not good ...

I have spent several hours trying to solve this issue but I didn't ...

The problem is that my Qt window is not displaying correctly even not displaying, the style of the Qt window is deleted etc...

If I don't SetParent() my Qt window and FSX main window, my Qt window is displaying correctly.

Qt Code:
  1. HWND lFsxHandle=FindWindow(L"FS98MAIN", NULL);
  2. HINSTANCE hInstance = (HINSTANCE)GetWindowLong(lFsxHandle, GWL_HINSTANCE);
  3.  
  4. SimConnect_SetSystemState(gSimConnect, "DialogMode", 1, 0, NULL);
  5.  
  6. qint32 argc = 1;
  7. char *argv[] = {"SDManager"};
  8. int result;
  9.  
  10. QApplication lA(argc, argv);
  11. SDManagerFenetre lF;
  12. SetParent(lF.winId(), lFsxHandle);
  13. lF.show();
  14. result = lA.exec();
  15.  
  16. SimConnect_SetSystemState(gSimConnect, "DialogMode", 0, 0, NULL);
To copy to clipboard, switch view to plain text mode 

I click on my button who trigger the QtWidget.show() :

1_20121024-1220.jpg

When I just clik on the Windows Start Button my QtWidget appear :

2.jpg

I can find my QtWidget using my mouse to rezize etc .. :

3.jpg

I give you my creation code of my Qwidget :

cpp :
Qt Code:
  1. #include "StdAfx.h"
  2. #include "SDManagerFenetre.h"
  3.  
  4.  
  5. SDManagerFenetre::SDManagerFenetre(QWidget *parent) : QWidget(parent)
  6. {
  7. resize(512, 512);
  8. setWindowTitle(tr("SkyDream Manager"));
  9. }
  10.  
  11. SDManagerFenetre::~SDManagerFenetre()
  12. {
  13.  
  14. }
  15.  
  16. void SDManagerFenetre::showEvent(QShowEvent *event)
  17. {
  18. Q_UNUSED(event);
  19.  
  20. CenterOnScreen();
  21. }
  22.  
  23. void SDManagerFenetre::CenterOnScreen()
  24. {
  25.  
  26. QRect screenGeom = screen.screenGeometry(this);
  27.  
  28. int screenCenterX = screenGeom.center().x();
  29. int screenCenterY = screenGeom.center().y();
  30.  
  31. move(screenCenterX - width () / 2,
  32. screenCenterY - height() / 2);
  33. }
To copy to clipboard, switch view to plain text mode 

.h :

Qt Code:
  1. #pragma once
  2. #include <QtGui>
  3.  
  4. class SDManagerFenetre : public QWidget
  5. {
  6. public:
  7. SDManagerFenetre(QWidget *parent = 0);
  8. ~SDManagerFenetre(void);
  9. protected:
  10. void showEvent(QShowEvent *event);
  11.  
  12. private:
  13. void CenterOnScreen();
  14. };
To copy to clipboard, switch view to plain text mode 
Have u an idea ? Thank you in advance.