讓你的程序不在任務欄中顯示
發表于:2007-07-14來源:作者:點擊數:
標簽:
首先在一個模塊中做如下聲明: Public Const SW_HIDE = 0 Public Const GW_OWNER = 4 Declare Function GetWindow Lib user32 Alias GetWindow (ByVal hwnd As _ Long, ByVal wCmd As Long) As Long Declare Function ShowWindow Lib user32 Alias ShowWindo
首先在一個模塊中做如下聲明:
Public Const SW_HIDE = 0
Public Const GW_OWNER = 4
Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As _
Long, ByVal wCmd As Long) As Long
Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd _
As Long, ByVal nCmdShow As Long) As Long
將下面的代碼添加到窗體的Load事件中:
Dim rc As Long
Dim OwnerhWnd As Long
'讓窗體不可見
Me.Visible = False
'從任務管理器列表中移除
OwnerhWnd = GetWindow(Me.hWnd, GW_OWNER)
rc = ShowWindow(OwnerhWnd, SW_HIDE)
請看本文中所用到的兩個API函數GetWindow和ShowWindow的用法。
原文轉自:http://www.anti-gravitydesign.com