如何让VB程序启动后不在任务栏显示?

2024-11-02 04:39:41
推荐回答(3个)
回答1:

办法如下:
1、首先在一个模块中做如下声明:
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
2、 将下面的代码添加到窗体的Load事件中:
Dim rc As Long
Dim OwnerhWnd As Long
'让窗体不可见
Me.Visible = False
'从任务管理器列表中移除
wnerhWnd = GetWindow(Me.hWnd, GW_OWNER)
rc = ShowWindow(OwnerhWnd, SW_HIDE)

回答2:

窗体的Showintaskbar属性改成False

回答3:

private sub form_load()
me.hide
end sub

那样的话
在窗体属性里 把ShowInTaskbar 设置为False就可以了,不需要代码