unit unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Panel1: TPanel;<br> Button1: TButton;<br> OpenDialog1: TOpenDialog;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> if not OpenDialog1.Execute then<br> Exit;<br><br> WinExec(Pchar(OpenDialog1.FileName + ' /p' + IntToStr(Panel1.Handle)), SW_SHOW);<br>end;<br><br>function EnumChildWindowsProc(hwnd: Integer; lparam: Longint): Boolean; stdcall;<br>begin<br> PostMessage(hwnd, WM_CLOSE, 0, 0);<br> Result := True;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> EnumChildWindows(Panel1.Handle, @EnumChildWindowsProc, 0);<br>end;<br><br><br>end.