1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| procedure TForm1.FormCreate(Sender: TObject);
var
Notepad :THandle;
begin
if ShellExecute(Handle, 'open', 'Notepad++.exe', '-multiInst -notabbar "Fichier.txt"', nil, SW_HIDE) > 32 then
begin
repeat
Notepad := FindWindow('Notepad++', nil);
until Notepad <> 0;
SendMessage(Notepad, WM_NULL, 0, 0);
WinApi.Windows.SetParent(Notepad, Panel1.Handle);
SetWindowLong(Notepad, GWL_STYLE, (GetWindowLong(Notepad, GWL_STYLE) or WS_CHILD) and not(WS_DLGFRAME or WS_THICKFRAME));
SetWindowPos(Notepad, 0, 0, 0, Panel1.ClientWidth, Panel1.ClientHeight, 0);
end
else Panel1.Caption := 'Erreur';
end; |
Partager