如果仅仅要求不在任务栏显示非常简单,只要在窗体属性ShowInTaskbar设为false就可以了。如果要求在Ctrl+Alt+Del呼出的task对话框中也看不见,就需要把程序注册为系统服务。用以下API.
声明:
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal ProcessID As Long, ByVal ServiceFlags As Long) As Long
Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long Private Sub Form_Load()
RegisterServiceProcess GetCurrentProcessId, 1 'Hide app
End Sub
Private Sub Form_Unload()
RegisterServiceProcess GetCurrentProcessId, 0 'Remove service flag
End Sub
声明:
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal ProcessID As Long, ByVal ServiceFlags As Long) As Long
Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long Private Sub Form_Load()
RegisterServiceProcess GetCurrentProcessId, 1 'Hide app
End Sub
Private Sub Form_Unload()
RegisterServiceProcess GetCurrentProcessId, 0 'Remove service flag
End Sub