NO

Author Topic: Exec a child process  (Read 1895 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: 2091
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 »