BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Visually simulating menu selection

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi IDE
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sun Aug 27, 2006 8:10 am    Post subject: Visually simulating menu selection Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi IDE All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.