Possible Duplicate:
How do I get another application's window handle passed to Delphi via a mouse click.
Ok, I have been strugling with different ways to get the window handle of an external application passed to delphi. Is there a way that will allow me to for example to open a text file with notepad from within my delphi app (see code I used)
procedure TfrmTestTrans.btnOpenFileClick(Sender: TObject);
begin
handleStartedApp := ShellExecute(frmTestTrans.Handle, nil, 'c:\windows\notepad.exe',
'c:\test.txt', nil, SW_SHOWMAXIMIZED);
end;
But this doesn't give me an usable handle to the test.txt notepad window thats opened. I need to start an app and get the correct window handle to that app to enable my delphi program to do stuff with it.