Exec a child process

Started by Grincheux, October 14, 2019, 07:55:59 PM

Previous topic - Next topic

Grincheux

I have a window into which I would like to run Google Earth.
With CreateProcess Google Earth runs but outside my program.
How could I do?
I thought searching for the window hadle of Google Earth and setting it has a child window of my program.
Is it a solution?

TimoVJL

#1
Do you mean something like this?void DoTest(HWND hWnd)
{
WinExec(TEXT("notepad.exe"), SW_HIDE);
Sleep(500);
HWND hWndChild = FindWindow(TEXT("Notepad"), NULL);
SetParent(hWndChild, hWnd);
RECT rect;
GetClientRect(hWnd, &rect);
MoveWindow(hWndChild, 0, 0, rect.right, rect.bottom, 0);
ShowWindow(hWndChild, SW_SHOW);
}
May the source be with you

Grincheux

#2
Here is what I did :

WM_CREATE :

   hGoogleEarth = FindWindow("Qt5QWindowIcon",NULL) ;
   SetParent(hGoogleEarth,hMainWindow) ;

into WM_DESTROY :

   SetParent(hGoogleEarth,hMainWindow) ;



The rest is into WM_SIZE

Thank you MS SPY.
Thank You Timo too.

My Blog for it (Sorry, in French)