Solved

sendkeys

Posted on 1997-05-16
5
384 Views
Last Modified: 2010-04-04
I'm using the sendkeys function that was suggested
here, what happens is that when I send a keystroke
and the menu opens, my other procedures stop working,
al least until I close the menu. I want to send a keystroke
and open the menu, do a pause for a set time, then move
down the menu--this is for a demo and it has to be native
to the program. How do I get around delphi not running my
routines with the menu open? Any suggestions would be
welcome.
0
Comment
Question by:jenny042797
5 Comments
 

Expert Comment

by:sbehrens
ID: 1336347
Assuming you are using Delphi 2.0/3.0: Put the routine that
sends keys into its own thread. That way, it is (at least moderately) independent from the rest of the program being busy.

If you are using Delphi 1.0, please rate this an F :)

Soenke
0
 
LVL 3

Expert Comment

by:sperling
ID: 1336348
To create a good-looking demo, use the WH_JOURNALRECORD and WH_JOURNALPLAYBACK hooks. (Look up SetWindowsHookEx) These allows you to record mouse movements/clicks and keypresses, and to play them back exactly as entered. The mouse and the keyboard will also be disabled while playing back.

It is a bit of work to code this, but it makes great demos of your apps. Works for both 16 and 32-bit windows.

Regards,

Erik.
0
 

Author Comment

by:jenny042797
ID: 1336349
Thanks, but unfortunately I am using 1.0. The demo needs
to run on cheesy systems.

0
 
LVL 1

Accepted Solution

by:
slp earned 100 total points
ID: 1336350
Teixiera and Pacheco's _Delphi Developer's Guide_ has a very nice implementation of a SendKeys() function.  The two editions of the book contain versions for Win16 and Win32.  This function alone is almost worth the price of the book; considering how great it is otherwise (I'd rate it as the TOP general Delphi programming book), it's a bargain.

HTH

SLP

0
 

Author Comment

by:jenny042797
ID: 1336351
any idea why procedrues stop executing when the menu is opened?

sendkey (vk_menu)
   pause a sec
    stops here and doesnt come back
sendkey(vk_down)

where as taking out the pause and stuff in between it will work
but too fast to follow.

The problem isnt in the pause either.

Oh, I've seen the book, now I have an excuse to buy it.
thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now