vb 无标题栏 任务栏显示
'添加一个模块,加入以下代码Option Explicit
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const WM_CLOSE = &H10
Private Const SC_CLOSE = &HF060&
Public lOldproc As Long
'处理一些消息
Public Function WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case Msg
Case WM_SYSCOMMAND
'使无边框窗体系统菜单的关闭按钮有效
If wParam = SC_CLOSE Then
SendMessage hWnd, WM_CLOSE, ByVal 0&, ByVal 0&
End If
End Select
WndProc = CallWindowProc(lOldproc, hWnd, Msg, wParam, lParam)
End Function
'窗体加载事件
'使无边框窗体获得系统菜单
Private Sub Form_Load()
Dim lStyle&
lStyle = GetWindowLong(Me.hWnd, -16)
lStyle = lStyle Or &H80000 Or &H20000
SetWindowLong Me.hWnd, -16, lStyle
lOldproc = SetWindowLong(Me.hWnd, -4, AddressOf WndProc)
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Me.Caption = "1"
End Sub
'当时间过后标题名称改变则 任务栏 不能小化及还原了 这个问题怎么处理