I know this is the easiest question but i can't remember how to do it. How do i send Alt+F4 to an active program using Sendkeys and if there is a better way you have to give, give it.
Printable View
I know this is the easiest question but i can't remember how to do it. How do i send Alt+F4 to an active program using Sendkeys and if there is a better way you have to give, give it.
To close a window you should use:
Code:'declare the function first
Destroy Window(HWND)
try this
just got it from the vb help fileCode:Dim ReturnValue As Long
Private Sub Command1_Click()
AppActivate ReturnValue ' Activate the Calculator.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
End Sub
Private Sub Form_Load()
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
End Sub
cya