trausti
asked on
Invisible man that push a button
Hello!!!
I want my Delphi app to run a setup file and when the setup file is finish to load i have to push "next" and may be again "next" , i want my Delphi app to listen if this window is running use FindWindowEx(Findwindow('n otepad', nil), 0, 'edit', nil); or something like that. and when this window is upp and running i will let my Delphi program to hit automatically the left mouse button and more, "that's needs to the setup" with API Postmessage - WM_LBUTTONDOWN and UP
Is this Possible?
I want my Delphi app to run a setup file and when the setup file is finish to load i have to push "next" and may be again "next" , i want my Delphi app to listen if this window is running use FindWindowEx(Findwindow('n
Is this Possible?
Just so I understand, You want your application to sit in the background and automate the setup process of some other application?
ASKER
Yes , and thank you for understand me
Well, your grammer needs improving, but I think I get the jist - I'll see what I can come up with...
Hmmm This would be subclassing a window I think. I have no idea how to do this in Delphi. Going to have to look into it.
-Pal
-Pal
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
PS: if you don't have winsight, let me know. i wrote my own 'small' version -)
ASKER
I have not the Winsight, what is that, can you send me
question@vis.is
question@vis.is
ASKER
This won't work
hwnd:=FindWindowEx(hwnd,0, 'TButton', '&Next');
What is 0,TButton,&Next ?
I'm trying to install "Getright" and push &next And ?
hwnd:=FindWindowEx(hwnd,0,
What is 0,TButton,&Next ?
I'm trying to install "Getright" and push &next And ?
ASKER
hwnd get 0 in debugging
hwnd:=FindWindowEx(hwnd,0, 'TButton', '&Next');
hwnd:=FindWindowEx(hwnd,0,
Winspy is included in delphi professionell and c/s, so i can't send it (would be illegal).
I'll send you my small prog.
hwnd:=FindWindowEx(hwnd,0, 'TButton', '&Next');
0 = handle to a childwindow. 0 because there is no.
'TButton' = Name of a component (like Tform or TButton, TEdit,...)
'&Next' = Title of the window or button.
PhrAtoR
I'll send you my small prog.
hwnd:=FindWindowEx(hwnd,0,
0 = handle to a childwindow. 0 because there is no.
'TButton' = Name of a component (like Tform or TButton, TEdit,...)
'&Next' = Title of the window or button.
PhrAtoR
ASKER
This won't work, here is the code
var
hwnd : THandle;
h : THandle;
begin
hwnd := FindWindow(NIL,'Cool Edit 96 Installation');
if hwnd<>0 then begin
//h:=hwnd;
SetForeGroundWindow(hwnd);
Sleep(1000);
h := FindWindowEx(hwnd,0,'Welco me!','&OK' );
SetForeGroundWindow(h);
//hwnd:=FindWindowEx(h,0,' Welcome!', 'Next');
//if hwnd<>0 then begin
SendMessage(hwnd,WM_KEYDOW N,13,0);
SendMessage(hwnd,WM_KEYUP, 13,0);
end;
end;
//end;
var
hwnd : THandle;
h : THandle;
begin
hwnd := FindWindow(NIL,'Cool Edit 96 Installation');
if hwnd<>0 then begin
//h:=hwnd;
SetForeGroundWindow(hwnd);
Sleep(1000);
h := FindWindowEx(hwnd,0,'Welco
SetForeGroundWindow(h);
//hwnd:=FindWindowEx(h,0,'
//if hwnd<>0 then begin
SendMessage(hwnd,WM_KEYDOW
SendMessage(hwnd,WM_KEYUP,
end;
end;
//end;
if there is no window/button with componentname 'TButton' and Title '&Next' FindWindowEX MUST result 0
ASKER
There is a button with name "next" and the window caption is GetRight Installation the same as parent
what can i do?
what can i do?
Thats right. This code won't work.
in your code hwnd is the handle of the window 'Cool Edit 96 Installation'.
you have to send the messages to the button, so you need the handle of the button.
hwnd:=FindWindow('Cool Edit 96 Installation',NIL);
if hwnd<>0 then begin
h:=hwnd;
hwnd:=FindWindowEx(hwnd,0, [COMPONENT NAME],'OK' );
if hwnd<>0 then begin
SendMessage(h,WM_KEYDOWN,1 3,0);
SendMessage(h,WM_KEYUP,13, 0);
end;
You have to replace [COMPONENTNAME] by the name of the Button's component. Use my program to get its name.
it's the string in the brackets ().
If one letter in 'OK' is underlined then put a & in front of it.
in your code hwnd is the handle of the window 'Cool Edit 96 Installation'.
you have to send the messages to the button, so you need the handle of the button.
hwnd:=FindWindow('Cool Edit 96 Installation',NIL);
if hwnd<>0 then begin
h:=hwnd;
hwnd:=FindWindowEx(hwnd,0,
if hwnd<>0 then begin
SendMessage(h,WM_KEYDOWN,1
SendMessage(h,WM_KEYUP,13,
end;
You have to replace [COMPONENTNAME] by the name of the Button's component. Use my program to get its name.
it's the string in the brackets ().
If one letter in 'OK' is underlined then put a & in front of it.
Thats right. This code won't work.
in your code hwnd is the handle of the window 'Cool Edit 96 Installation'.
you have to send the messages to the button, so you need the handle of the button.
hwnd:=FindWindow('Cool Edit 96 Installation',NIL);
if hwnd<>0 then begin
h:=hwnd;
hwnd:=FindWindowEx(hwnd,0, [COMPONENT NAME],'OK' );
if hwnd<>0 then begin
SendMessage(h,WM_KEYDOWN,1 3,0);
SendMessage(h,WM_KEYUP,13, 0);
end;
You have to replace [COMPONENTNAME] by the name of the Button's component. Use my program to get its name.
it's the string in the brackets ().
If one letter in 'OK' is underlined then put a & in front of it.
in your code hwnd is the handle of the window 'Cool Edit 96 Installation'.
you have to send the messages to the button, so you need the handle of the button.
hwnd:=FindWindow('Cool Edit 96 Installation',NIL);
if hwnd<>0 then begin
h:=hwnd;
hwnd:=FindWindowEx(hwnd,0,
if hwnd<>0 then begin
SendMessage(h,WM_KEYDOWN,1
SendMessage(h,WM_KEYUP,13,
end;
You have to replace [COMPONENTNAME] by the name of the Button's component. Use my program to get its name.
it's the string in the brackets ().
If one letter in 'OK' is underlined then put a & in front of it.
Thats right. This code won't work.
in your code hwnd is the handle of the window 'Cool Edit 96 Installation'.
you have to send the messages to the button, so you need the handle of the button.
hwnd:=FindWindow('Cool Edit 96 Installation',NIL);
if hwnd<>0 then begin
h:=hwnd;
hwnd:=FindWindowEx(hwnd,0, [COMPONENT NAME],'OK' );
if hwnd<>0 then begin
SendMessage(h,WM_KEYDOWN,1 3,0);
SendMessage(h,WM_KEYUP,13, 0);
end;
You have to replace [COMPONENTNAME] by the name of the Button's component. Use my program to get its name.
it's the string in the brackets ().
If one letter in 'OK' is underlined then put a & in front of it.
in your code hwnd is the handle of the window 'Cool Edit 96 Installation'.
you have to send the messages to the button, so you need the handle of the button.
hwnd:=FindWindow('Cool Edit 96 Installation',NIL);
if hwnd<>0 then begin
h:=hwnd;
hwnd:=FindWindowEx(hwnd,0,
if hwnd<>0 then begin
SendMessage(h,WM_KEYDOWN,1
SendMessage(h,WM_KEYUP,13,
end;
You have to replace [COMPONENTNAME] by the name of the Button's component. Use my program to get its name.
it's the string in the brackets ().
If one letter in 'OK' is underlined then put a & in front of it.
oops. last comment was posted three times. sorry.
PhrAtoR
PhrAtoR
ASKER
Where is the program email: emil@vis.is
ASKER
Alright this works,
When i have click one "&next" i have to wait for extract , before i can click the &next button. How can i wait for the next window?
When i have click one "&next" i have to wait for extract , before i can click the &next button. How can i wait for the next window?
just implemant a loop that looks for the next window like this:
while findwindow('NameOfSecondWi ndow',Nil) = 0 do;
handleof2ndwindow:=findwin dow('NameO fSecondWin dow',Nil)
PhrAtoR
while findwindow('NameOfSecondWi
handleof2ndwindow:=findwin
PhrAtoR
don't forget the ; behind the do!
ASKER
What are you meaning?
ASKER
Can you show me some examples with While - DO
Examples? What kind of examples?
do; means do nothing
so
while findwindow('NameOfSecondWi ndow',Nil) = 0 do;
means: while there is no window with the title 'NameOfSecondWindow' do nothing. When there is a window -> finish the loop and continue with the program.
PhrAtoR
do; means do nothing
so
while findwindow('NameOfSecondWi
means: while there is no window with the title 'NameOfSecondWindow' do nothing. When there is a window -> finish the loop and continue with the program.
PhrAtoR
The problem with that is, what if a window NEVER opens with that name.. suddenly you have an application running waiting for something that will never happen..
-Pal
-Pal
ASKER
Let's say i'm installing Acrobat Reader 4.0, this setup opens tvo windows Main and Child, i just want to control the Childe window and send WM_KEYDOWN - WM_KEYUP thats all. You can test this if you have Acrobat Reader 4.0
Thanks
Trausti
Thanks
Trausti
i'll test it.