OPPD Microsoft Course Resources

Skippy helping the class with their new forms
Here's some fun code another instructor recently posted on her web site
- when you use Ctrl-Alt-Del it will list all the programs that are running.
This code will hide your application from this list :
'Add 2 Command Buttons to your form. Press the first to hide your
'program, and the second to show it again.
'Module code
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID _
As Long, ByVal dwType As Long) As Long
'Form code
Public Sub HideApp(Hide As Boolean)
Dim ProcessID As Long
ProcessID = GetCurrentProcessId()
If Hide Then
retval = RegisterServiceProcess(ProcessID, RSP_SIMPLE_SERVICE)
Else
retval = RegisterServiceProcess(ProcessID, RSP_UNREGISTER_SERVICE)
End If
End Sub
Private Sub Command1_Click()
HideApp (True)
End Sub
Private Sub Command2_Click()
HideApp (False)
End Sub
Back to Course Resources

Alrak's Course Resources ©2002-2007 Karla Carter. All rights
reserved. This material (including, but not limited to, Mini-lectures and Challenge
Labs) may not be reproduced, displayed, modified or distributed without the
express prior written permission of the copyright holder. For permission, contact
Karla.
|