?
Solved

typing in an opened external file (Exe) Delphi 4

Posted on 2004-04-14
5
Medium Priority
?
298 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

800 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