VB,我想要把任务栏上面任意一个程序给隐藏起来

来源:百度知道 编辑:UC知道 时间:2024/06/22 01:58:37
VB,我想要把任务栏上面任意一个程序给隐藏起来,比如说我打开我的电脑,它就会在任务栏上显示,但我要把它隐藏起来,但不能关闭它,而且还可以打开它。请问要怎么做?

'这个问题也不是很难,先给你一个隐藏自己程序任务栏的例子,隐藏任务栏其他程序只需查找该程序的句柄即可

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_EX_APPWINDOW As Long = &H40000

Private Sub Form_Click()
Static ShowFlags As Boolean
Dim TempLng As Long

Me.Hide

TempLng = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
If ShowFlags Then
TempLng = TempLng Or WS_EX_APPWINDOW
Else
TempLng = TempLng And Not WS_EX_APPWINDOW
End If
Call SetWindow