Solved

sendkeys

Posted on 1997-05-16
5
407 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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