Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Can someone help me with the implementation of KillProcessByName funct Posted by Neophyte185 on 22 Jul 2005 at 6:17 AM
My original question was: How do I access menu commands in one program from a Delphi Form?

I have figured out how to generate a simple Delphi 7 form with a button in it which will run an executable.

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute
(Form1.Handle, 'open', 'c:\E3238s\bin\E3238s.exe',
nil, nil, SW_SHOWNORMAL);
end;
end.

My problem is I need to know how to access the menus that are a part of this executable. For example how would I access the FILE menu in order to select EXIT.

In light of the lack of a simple solution I am considering a different approach. I will use the SHELLEXECUTABLE and a timer from Delphi in order to start the external program. After the timer runs out I would like to use KillProcessByName in order to exit the external program. So now can any one help me with the implementation and syntax for the KillProcessByName function? Please!


Report
Re: Can someone help me with the implementation of KillProcessByName f Posted by zibadian on 22 Jul 2005 at 8:15 AM
: My original question was: How do I access menu commands in one program from a Delphi Form?
:
: I have figured out how to generate a simple Delphi 7 form with a button in it which will run an executable.
:
: procedure TForm1.Button1Click(Sender: TObject);
: begin
: ShellExecute
: (Form1.Handle, 'open', 'c:\E3238s\bin\E3238s.exe',
: nil, nil, SW_SHOWNORMAL);
: end;
: end.
:
: My problem is I need to know how to access the menus that are a part of this executable. For example how would I access the FILE menu in order to select EXIT.
:
: In light of the lack of a simple solution I am considering a different approach. I will use the SHELLEXECUTABLE and a timer from Delphi in order to start the external program. After the timer runs out I would like to use KillProcessByName in order to exit the external program. So now can any one help me with the implementation and syntax for the KillProcessByName function? Please!
:
:
:
If you truly wish to control the process, you should start it using CreateProcess() instead of ShellExecute(). This board contains several examples of that.
In order to automatically click on the menu, you need to implement a keyboard hook. This allows you to play various keyboard and mouse commands. The Developer's Guide by Teixeira and Pacheco has example code and describes how to implement it. You might also find examples on the internet.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.