NO

Author Topic: Exec a child process  (Read 587 times)

Grincheux

  • Guest
Exec a child process
« 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?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1883
Re: Exec a child process
« Reply #1 on: October 14, 2019, 09:15:49 pm »
Do you mean something like this?
Code: [Select]
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);
}
« Last Edit: October 14, 2019, 09:25:51 pm by TimoVJL »
May the source be with you

Grincheux

  • Guest
Re: Exec a child process
« Reply #2 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) ;



The rest is into WM_SIZE

Thank you MS SPY.
Thank You Timo too.

My Blog for it (Sorry, in French)
« Last Edit: October 17, 2019, 05:58:47 am by Grincheux »