Click to See Complete Forum and Search --> : Closing a Window
Dayo312
Jan 10th, 2000, 02:49 AM
How can I close a window without it doing ANYTHING while it closes??? (It usually shuts another program down.)
Thankyou!
Evan
QWERTY
Jan 10th, 2000, 02:52 AM
I don't get it: what do you mean by "doing ANYTHING?"
------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.
Dayo312
Jan 10th, 2000, 04:16 AM
I want to send it a command to close it without it being able to go through its Form_Unload code (Its another app).
Is that possable?
Aaron Young
Jan 10th, 2000, 04:31 AM
You can force the App to Terminate, bypassing any Shutdown procedures it may have in place, ie.
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Sub TerminateIt(ByVal lHwnd As Long)
Dim lProcess As Long
Dim lExitCode As Long
'Get the ProcessID
Call GetWindowThreadProcessId(lHwnd, lProcess)
'Get the Process Handle
lProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, lProcess)
'Get the Exitcode
Call GetExitCodeProcess(lProcess, lExitCode)
'Terminate the Process
Call TerminateProcess(lProcess, lExitCode)
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com
Dayo312
Jan 10th, 2000, 09:36 AM
Well, The intetnet conection still disconnects when the window goes away. Could I make it so it would stay online?? thankyou aaron!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.