Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Windows Calculator By Clicking Button

Status
Not open for further replies.

Bill6868

Technical User
Mar 20, 2007
96
US
There was a question a while back about how to open the Windows Calculator from a button:

Private Sub Command0_Click()

Shell ("calc.exe")

End Sub

The above code works great. Now, how can I get the calculator to close when the form closes? Any suggestion would be appreciated.
 
You could SendKeys, although it is a little dodgy.
 
There is probably a command line parameter for this somewhere, but I haven't been able to find it yet.
It is a good place to start your search, though (and I'll keep looking as well). An example that calls the shutdown.exe:
Code:
%windir%\system32\SHUTDOWN.exe -s -t 00

For the calculator, the command line is %SystemRoot%\system32\calc.exe. I'm guessing there must be some shutdown params at the end of the string (if they exist).

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Also the Kill command might work, IF you have the pathname the calc.exe app is running in.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top