 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Pavel Vymazal Guest
|
Posted: Sun Jul 18, 2004 7:12 am Post subject: Re: exe file |
|
|
This question has the same answer as the question:
"How to give a birth to a child and make it use the mother's body instead of
a new one?" - No way.
Please, understand that EXE files are APPLICATIONS and they are
"encapsulated" in themselves.
| Quote: | How can we open any exe files (windows yada dos application) in a delphi
form without starting a second window?
Please note that " ShellExecute(Handle, 'open', 'c:Windowsnotepad.exe',
nil, nil, SW_SHOWNORMAL); " code opens a second window while the main
form
is open.
|
|
|
| Back to top |
|
 |
Andrew Jameson Guest
|
Posted: Sun Jul 18, 2004 10:55 pm Post subject: Re: exe file |
|
|
Easy ...
procedure TForm1.Button1Click(Sender: TObject);
var
aHandle : HWND;
begin
aHandle := ShellExecute(Application.Handle, 'Open', 'calc.exe', nil, nil,
SW_SHOWNORMAL);
repeat
Sleep(10);
aHandle := FindWindow(nil, 'Calculator');
until (aHandle <> 0);
Windows.SetParent(aHandle, Handle);
SetWindowPos(aHandle, 0, 0, 0, 0, 0, SWP_NOSIZE);
end;
You can do all sorts of clever stuff by grabbing other forms ... yes you can
wrap other applications ... there used to be an application that wrapped two
copies of explorer side by side that had all the original buttons and
captions stripped ... there was a nice piece of code showing how you can
wrap applications in Delphi ... I recollect that it was maybe done by
UtilMind Solutions at http://www.utilmind.com/ ... don't know whether it's
still there ?
By the way, I'm not advocating that you use the above code ... I think that
you should be able to get the handle of the launched application window in a
more elegant way ... maybe from CreateProcess ?
Andrew
|
|
| Back to top |
|
 |
Andrew Jameson Guest
|
Posted: Sun Jul 18, 2004 10:56 pm Post subject: Re: exe file |
|
|
By the way ... what has this thread to do with multimedia ? ... might get
better response from the win32 group.
Andrew
|
|
| Back to top |
|
 |
Andrew Jameson Guest
|
Posted: Sun Jul 18, 2004 11:09 pm Post subject: Re: exe file |
|
|
Ignore the aHandle assignment by ShellExecute ... it was all just a two
minute hack and I wondered what I could do with that handle. Be aware that
closing the main application does not terminate calc.exe ... it gets left
behind as a hidden process ...
Andrew
| Quote: | aHandle := ShellExecute(Application.Handle, 'Open', 'calc.exe', nil,
nil, |
|
|
| Back to top |
|
 |
Noel Guest
|
Posted: Sun Jul 25, 2004 9:36 am Post subject: Re: exe file |
|
|
On Sun, 18 Jul 2004 09:12:15 +0200, "Pavel Vymazal"
<alcator (AT) seznam (DOT) cz> wrote:
| Quote: | This question has the same answer as the question:
"How to give a birth to a child and make it use the mother's body instead of
a new one?" - No way.
|
Actually, this answer is quite simply wrong. It is possible to launch
another app and set your own app as its parent. Whether you should do
so is another matter entirely.
--
Noel
|
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jul 31, 2004 3:45 am Post subject: Re: exe file |
|
|
and How to close the calc.exe when closing the main app?
"Andrew Jameson" <contact (AT) softspotsoftware (DOT) com> wrote
| Quote: | Ignore the aHandle assignment by ShellExecute ... it was all just a two
minute hack and I wondered what I could do with that handle. Be aware
that
closing the main application does not terminate calc.exe ... it gets left
behind as a hidden process ...
Andrew
aHandle := ShellExecute(Application.Handle, 'Open', 'calc.exe', nil,
nil,
|
|
|
| Back to top |
|
 |
Charles Hacker Guest
|
Posted: Sun Aug 01, 2004 11:41 pm Post subject: Re: exe file |
|
|
zoom wrote:
| Quote: |
and How to close the calc.exe when closing the main app?
|
You could find the window, then send a close message to it.
var
theHandle: THandle;
begin
theHandle := FindWindow('SciCalc', nil);
if theHandle <> 0 then
begin
SendMessage(theHandle, WM_CLOSE, 0, 0);
//or
SendMessage(theHandle, WM_QUIT, 0, 0);
end
end;
--
Charles Hacker
Lecturer in Electronics and Computing
School of Engineering
Griffith University - Gold Coast
Australia
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|