?
Solved

sendkeys

Posted on 1997-05-16
5
Medium Priority
?
423 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
[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
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 300 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

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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