 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Aug 27, 2006 8:10 am Post subject: Visually simulating menu selection |
|
|
I want to simulate selecting from a menu. Here
is my code:
procedure Tfrm.select(wnd:HWnd; keys:string; delay:integer=500);
const
AltKey :Longint = $20000000;
count=1;
var lParam:Longint;
ch:Char;
i:integer;
procedure pause(millisecs:integer);
var start:integer;
begin
start:=GetTickCount;
while GetTickCount<start+millisecs do
Application.ProcessMessages; //***Problem
end;
begi
lParam:=AltKey or count;
for i:=1 to length(keys) do
begin
ch:=keys[i];
PostMessage(wnd,WM_SYSCHAR,Word(ch),lParam);
if i<Length(keys) then pause(delay);
end;
end;
Call select(frm.handle,'fo',1000); to stimulate file, open.
I would like the menu to drop down, wait for a second then select the
item.
Without ProcessMessages it works but you don't see the menu. With
ProcessMessages, the selection process stops half way. Do you have any
ideas?
Thank-you,
Julius |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|