how to make a program that closes a certain program when running?(some code?)
and
how do i exclude a programs name from the "Close Program " list?
tanx!
Printable View
how to make a program that closes a certain program when running?(some code?)
and
how do i exclude a programs name from the "Close Program " list?
tanx!
VB Code:
'close a program Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Const WM_CLOSE = &H10 Private Sub cmdCloseApp_Click() Dim CloseIt As Long CloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed") PostMessage CloseIt, WM_CLOSE, CLng(0), CLng(0) End SubVB Code:
'hide from task manager Private Const RSP_SIMPLE_SERVICE = 1 Private Const RSP_UNREGISTER_SERVICE = 0 Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long Private Sub HideApp() Dim process As Long process = GetCurrentProcessId() Call RegisterServiceProcess(process, RSP_SIMPLE_SERVICE) End Sub Private Sub UnHideApp() Dim process As Long process = GetCurrentProcessId() Call RegisterServiceProcess(process, RSP_UNREGISTER_SERVICE) End Sub