Finalement ce n'était pas trop difficile :
Rechercher la fenêtre Google Earth par sa classe, dans mon cas : Qt5QWindowIcon
Pour cela lancer l'outil SPY de VisualStudio et faire :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| static void Main_OnCreate(HWND __hWnd)
{
hGoogleEarth = FindWindow("Qt5QWindowIcon",NULL) ;
SetParent(hGoogleEarth,hMainWindow) ;
return ;
}
static void Main_OnDestroy(HWND __hWnd)
{
SetParent(hGoogleEarth,NULL) ;
DeleteObject(hMainFont) ;
PostQuitMessage(0) ;
return ;
} |
Pensez également à traiter cette fenêtre dans WM_SIZE.
Quand vous fermez votre fenêtre, message WM_CLOSE, ou WM_DESTROY pensez à faire :
SetParent(hGoogleEarth,NULL) ;
Sans quoi il faudra jouer avec le gestionnaire des tâches pour arrêter Google Earth, c'est pas très clean.
C'est tout.
Partager