Sending a command click to another application

Hello Guys

I created a system installation with inno, in my system installation I have a pach that is from microsoft, there is no parameter to install the files and replace all files when they are found. When my system installation starts the installation, and this patch is started, it finds some dlls already installed in the system, so the system ask if I want to replace (yes, yes to all, no), I would like to install the system and when the installation stopps I would like to send a command that click the button yes to all, is there any way to do this?

Thanks
LVL 1
hidrauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scay7Commented:
Heres how you can send a key to a window...

Procedure sendkey();
var
  window : HWND;
begin
  window := FindWindow('Notepad',nil);
  if window <> 0 then begin
    SendMessage(window,WM_KEYDOWN,wparam(VK_SHIFT),0);
    SendMessage(window,WM_KEYDOWN,wparam('F'),0);
    SendMessage(window,WM_KEYUP,wparam('F'),0);
    SendMessage(window,WM_KEYUP,wparam(VK_SHIFT),0);
  end;
end;

or you can checkup on the following other answers...

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_10339527.html?query=send+key&topics=85
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20299749.html?query=send+key&topics=85
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20440279.html?query=send+key&topics=85
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20832101.html?query=send+key&topics=85
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20583169.html?query=send+key&topics=85

Peace Scay7
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scay7Commented:
Oh here are other keys(some of em) which you can send anything with VK_ eg VK_Back = a key

(Name:'BKSP'; VKey:VK_BACK),
(Name:'BS'; VKey:VK_BACK),
(Name:'BACKSPACE'; VKey:VK_BACK),
(Name:'BREAK'; VKey:VK_CANCEL),
(Name:'CAPSLOCK'; VKey:VK_CAPITAL),
(Name:'CLEAR'; VKey:VK_CLEAR),
(Name:'DEL'; VKey:VK_DELETE),
(Name:'DELETE'; VKey:VK_DELETE),
(Name:'DOWN'; VKey:VK_DOWN),
(Name:'END'; VKey:VK_END),
(Name:'ENTER'; VKey:VK_RETURN),
(Name:'ESC'; VKey:VK_ESCAPE),
(Name:'ESCAPE'; VKey:VK_ESCAPE),
(Name:'F1'; VKey:VK_F1),
(Name:'F10'; VKey:VK_F10),
(Name:'F11'; VKey:VK_F11),
(Name:'F12'; VKey:VK_F12),
(Name:'F13'; VKey:VK_F13),
(Name:'F14'; VKey:VK_F14),
(Name:'F15'; VKey:VK_F15),
(Name:'F16'; VKey:VK_F16),
(Name:'F2'; VKey:VK_F2),
(Name:'F3'; VKey:VK_F3),
(Name:'F4'; VKey:VK_F4),
(Name:'F5'; VKey:VK_F5),
(Name:'F6'; VKey:VK_F6),
(Name:'F7'; VKey:VK_F7),
(Name:'F8'; VKey:VK_F8),
(Name:'F9'; VKey:VK_F9),
(Name:'HELP'; VKey:VK_HELP),
(Name:'HOME'; VKey:VK_HOME),
(Name:'INS'; VKey:VK_INSERT),
(Name:'LEFT'; VKey:VK_LEFT),
(Name:'NUMLOCK'; VKey:VK_NUMLOCK),
(Name:'PGDN'; VKey:VK_NEXT),
(Name:'PGUP'; VKey:VK_PRIOR),
(Name:'PRTSC'; VKey:VK_PRINT),
(Name:'RIGHT'; VKey:VK_RIGHT),
(Name:'SCROLLLOCK'; VKey:VK_SCROLL),
(Name:'TAB'; VKey:VK_TAB),
(Name:'UP'; VKey:VK_UP)

Peace Scay7
0
carolosfCommented:
hmmm...
i dont have delphi installed on my system but you can do this by using
windows api to send keyboard messages to the window
when it pops up
//gets the windows name from a window handle
function GetWinName(cmd :Longint) : string;
var x: hwnd;
    a: array [0..255] of char;

begin
FillChar(a,255,0);
GetWindowText(cmd,a,128);
result := a;
end;

//-- var ActiveWin : string;
ActiveWin := GetWinName(GetForegroundWindow());//to get the window name and convert it to a constant later

repeat

Application.ProcessMessages;
  if  (GetWinName(GetForegroundWindow()) = ActiveWin) then
 begin
   keybd_event(VK_TAB,1,0,0); //use this to tab to the correct
   keybd_event(VK_RETURN,1,0,0); //use this to "click" the button
//-var ticks : cardinal;
  ticks := gettickcount() + 5000; //this sets a timeout of 5 seconds
end;
until ((GetWinName(GetForegroundWindow()) <> ActiveWin) and (gettickcount() >= ticks));
 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.