Pelles C forum

C language => Beginner questions => Topic started by: Grincheux on October 14, 2019, 07:55:59 PM

Title: Exec a child process
Post by: Grincheux on October 14, 2019, 07:55:59 PM
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?
Title: Re: Exec a child process
Post by: TimoVJL on October 14, 2019, 09:15:49 PM
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);
}
Title: Re: Exec a child process
Post by: Grincheux on October 16, 2019, 06:31:31 PM
Here is what I did :

WM_CREATE :

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

into WM_DESTROY :

   SetParent(hGoogleEarth,hMainWindow) ;

(https://www.mediafire.com/convkey/a5b6/8o83yhzxm5mqset6g.jpg)

The rest is into WM_SIZE

Thank you MS SPY.
Thank You Timo too.

My Blog for it (https://md5finder.blogspot.com/2019/10/trajets-france.html) (Sorry, in French)