BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: exe file

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Multimedia
View previous topic :: View next topic  
Author Message
Pavel Vymazal
Guest





PostPosted: Sun Jul 18, 2004 7:12 am    Post subject: Re: exe file Reply with 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.

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





PostPosted: Sun Jul 18, 2004 10:55 pm    Post subject: Re: exe file Reply with quote



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





PostPosted: Sun Jul 18, 2004 10:56 pm    Post subject: Re: exe file Reply with quote



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





PostPosted: Sun Jul 18, 2004 11:09 pm    Post subject: Re: exe file Reply with 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

Quote:
aHandle := ShellExecute(Application.Handle, 'Open', 'calc.exe', nil,
nil,




Back to top
Noel
Guest





PostPosted: Sun Jul 25, 2004 9:36 am    Post subject: Re: exe file Reply with quote

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






PostPosted: Sat Jul 31, 2004 3:45 am    Post subject: Re: exe file Reply with quote

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





PostPosted: Sun Aug 01, 2004 11:41 pm    Post subject: Re: exe file Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.