Solved

sendkeys

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

756 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