TIP: Click on subject to list as thread! ANSI
echo: delphi
to: FRANCOIS PIETTE
from: MARTIN MAAT
date: 1997-03-01 11:54:00
subject: SendKeys equivalent

Hallo Francois
 FP> Dans un message de Martin Maat dat‚ du 23 Feb 97  10:34:34 il ‚tait
 FP> dit: 
  MM> How do I send keys to other windows in the system, like I could 
  MM> in VB with the SendKeys statement? I tried to send WM_KEYDOWN
  MM> messages to no avail, the target window seems to ignore them.
 FP> You have to call SendMessage to send two messages: one WM_KEYDOWN
 FP> and  one WM_KEYUP to simulate a real keyboard event.
I did not try to send both WM_KEYDOWN _and_ WM_KEYUP messages since I felt it 
had to work with only WM_KEYDOWN which was not the case. I also tried WM_CHAR 
to no avail. When I wasn't sure about the wParam and lParam parameters I put 
the SendMessage in a loop and scattered 64K messages with random parameters. 
Nothing seemed to happen in the target window (a Notepad instance).
 FP> Are you sure you use the correct window handle for the destination 
 FP> window ? 
Absolutely. Sending a WM_COMMAND message, I can minimize the target window. 
Some things _do_ work with the handle I got using FindWindow, this must be 
the right handle, I can also tell by the result of FindWindow. But when I try 
to change focus for instance, I do see a caret appear but I do not see the 
caption bar turn blue. So some thing just work, some work "a little" and 
others do not work at all. I'm using Window NT Workstation 4.0.
I'll try to send both WM_KEYDOWN and WM_KEYUP and see if that makes any 
difference. Thanks.
Groeten, Martin.
--- FMail/386 1.02
---------------
* Origin: -=[ E-mail: m_maat@knoware.nl .......... ]=- (2:286/420.1)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.