After changing the following code,
Var
The vh: HWND;
The begin
ShellExecute (Self. Handle, the 'open', Pchar (' C: \ Windows \ System32 \ notepad exe '), '1', nil, SW_SHOWNORMAL);
The vh:=Windows. FindWindow (nil, 'Form1');
ShowMessage (IntToStr (vh));
If vh<> 0 then
The begin
Windows. SetParent (pnlApp. Handle, the Self. PnlApp. Handle).
Windows. MoveWindow (pnlApp. Handle, 0, 0, the Self. The pnlApp. The Width of the Self. PnlApp. Height, True);
End the else
ShowMessage (' xx program is not running! ');
Program is call out, but not on the panel, but in the outside, what reason be excuse me?
CodePudding user response:
The second is: https://blog.csdn.net/xtfnpgy/article/details/39900331After the operation error directly,

I would appreciate your warrior advice please,
CodePudding user response:
The first method:The vh:=Winapi. Windows. FindWindow (nil, 'Form8'); Here, should not be your form name should be name needs to be embedded application form,
The following pictures Form8 is embedded in another application,

The title of the notepad. Exe, notepad, as if not shown on the form, always can't find,
CodePudding user response:
With a calculator to do the test, found that can change the calculator window size (as large as Panel1), but can't be embedded,ShellExecute (Self. Handle, the 'open', Pchar (' C: \ Windows \ System32 \ calc exe '), ' ', nil, SW_SHOWNORMAL);
Sleep (1000);
The vh:=Winapi. Windows. FindWindow (nil, 'calculator');
CodePudding user response:
Var vh: HWND;
The begin
ShellExecute (Self. Handle, the 'open', Pchar (' C: \ Windows \ System32 \ notepad exe '), ' ', nil, SW_SHOWNORMAL);
Sleep (1000);//delay, waiting for the three open notebook,
The vh:=Winapi. Windows. FindWindow (nil, 'no title - notepad);
If vh<> 0 then
The begin
Winapi. Windows. SetParent (vh, Self. Panel1. Handle).
Winapi. Windows. MoveWindow (vh, 0, 0, the Self. Panel1. Width, the Self. Panel1. Height, False);
End
The else
ShowMessage (' xx program is not running! ');
The results are as follows:
