tags:

views:

105

answers:

2

For now ,i want to run exe file from my disk, after finished to install that exe file, will show a popup message which tell user that already finished install exe file, but i do not konw how to close the popup message.

Does anyone know how to do that ??

thank you very much

A: 

Some installers on Windows have a silent mode launch flag, so they won't show any pop-ups during installation. However, this option depends on the type of the installation package.

floatless
+1  A: 

I'm assuming that you have a ruby script which is running an EXE installer program (via the system call or similar), and the installer opens a popup message which can't be suppressed and prohibits the script from continuing.

If this is the case, then you could use the ruby Win32 API to call functions like EnumWindows and CloseWindow. Of course, they'd have to be run concurrently to the installer (but perhaps necessarily in a separate process, depending on ruby/win32 threading implementation details) and it would have to know how to identify the correct message box before attempting to close it.

Here's how I might hack it. Write a separate program named "CloseMsgBox.exe" which takes a single command-line argument which is the title of the MessageBox which it will close; the program will periodically call EnumWindows with a callback function which calls GetWindowText until it finds the target title and closes the window via CloseWindow. The outer Ruby script would first run this program in a separate thread via a system call (or popen, etc.) then exec the installer. Once the installer opens the message box, the CloseMsgBox program will close it, so the installer will exit, CloseMsgBox will exit, and the outer Ruby script will exit.

maerics
CloseWinodw method can be closed, but the parames is hwnd, you know, hwnd will be changed everytime.can you give me other way ?i just do exec("gamexiu.exe"), then want to close the pop up message
It depends on how you could identify the message box window programmatically. EnumWindows takes a [callback function](http://msdn.microsoft.com/en-us/library/ms633498%28v=VS.85%29.aspx) that takes each hWnd as the argument; if you know the title of the message box, for example, you could select the right hWnd using [GetWindowText](http://msdn.microsoft.com/en-us/library/ms633520%28VS.85%29.aspx) then call CloseWindow.
maerics