How can I start some application and then close it? I tried something like this, but it doesn't work. The problem is with closing application.
procedure TForm1.Button1Click(Sender: TObject);
temp := ShellExecute(handle, 'open', 'test.exe', nil, nil, SW_SHOWNORMAL);
procedure TForm1.Button2Click(Sender: TObject);
SendMessage(temp, WM_CLOSE, 0, 0);