Solved

typing in an opened external file (Exe) Delphi 4

Posted on 2004-04-14
5
289 Views
Last Modified: 2013-11-13
Using Delphi 4
I am making a program that will open an already existing exe, it does that, now i need it to type what you would usually input with a keyboard, I found the procedure keypress but am unsure of what to type to get the code working. I have this so far and don't know how to fix it:

keypress: procedure (var key : char);

What needs to go where in order for this to work and can i get a list from somewhere to know all keys?

Another easy question:

When using:
ShellExecute(Handle, 'open', PChar('http://www.whatever.com'), nil, nil, SW_SHOW);

What needs to be added to uses it was something like shellopen api or something like that i forget now

I want Delphi to type the keys i tell it to into the exe i had it open, when delphi opens the other exe the cursor is already placed in the correct editbox all i need is for delphi to do the keys for me and hit return, thanks in advance.
                                                                                     Justin Dashney
0
Comment
Question by:JustinDashney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 7

Expert Comment

by:mquiroz
ID: 10833168
0
 

Author Comment

by:JustinDashney
ID: 10839171
Helped a bit but using keys besides deleted and f9.... don't work Example: VK_J VK_9
and for some reason the key entries are not sent to my program i am using this:

procedure SendKey;
begin
  keybd_event(7, 0, KEYEVENTF_EXTENDEDKEY, 0);        // does not work
  keybd_event(7, 0, KEYEVENTF_KEYUP, 0);                   // does not work
//  keybd_event(VK_F9, 0, KEYEVENTF_EXTENDEDKEY, 0);
//  keybd_event(VK_F9, 0, KEYEVENTF_KEYUP, 0);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShellExecute(Handle, 'open', PChar('c:\Program Files\the 4th coming\wrapper.exe'), nil, nil, SW_SHOW);
  Sleep (100000);   //My external program takes 5-10 seconds to load. any suggestion?
  SendKey;
end;

The key does not end up in the program, it may be becaue i have not used correct format at
keybd_event(7, 0, KEYEVENTF_EXTENDEDKEY, 0);        
or the sleep or i don't really know, any help is appreciated, feel free to email me JustinDashney@hotmail.com but please use the title of this post as subject, thank you
0
 
LVL 7

Accepted Solution

by:
mquiroz earned 125 total points
ID: 10842587
try this code samples (the "sendkeys" ones), and to execute another exe on synchronous way try using ShellExecuteEx API
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Insert parts by customer 12 61
Using Third Party DLL with Access VBA 14 63
Select specific duplicate row based on specific criteria 4 83
Java List 4 74
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question