⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 185.txt

📁 介绍VB里的各种控件的使用方法,窗口控制,图像编程以及OCX等内容,还提供了一个API集供参考.
💻 TXT
字号:
运行中隐藏/显示窗口标题栏

声明:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long 
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long 
Private Const GWL_STYLE = (-16) 
Private Const WS_CAPTION = &HC00000
Private Const WS_MAXIMIZEBOX = &H10000 
Private Const WS_MINIMIZEBOX = &H20000 
Private Const WS_SYSMENU = &H80000 

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long 
Private Enum ESetWindowPosStyles 
SWP_SHOWWINDOW = &H40 
SWP_HIDEWINDOW = &H80 
SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE 
SWP_NOACTIVATE = &H10 
SWP_NOCOPYBITS = &H100 
SWP_NOMOVE = &H2 
SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering 
SWP_NOREDRAW = &H8 
SWP_NOREPOSITION = SWP_NOOWNERZORDER 
SWP_NOSIZE = &H1 
SWP_NOZORDER = &H4 
SWP_DRAWFRAME = SWP_FRAMECHANGED 
HWND_NOTOPMOST = -2 
End Enum 

Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long 
Private Type RECT 
Left As Long 
Top As Long 
Right As Long 
Bottom As Long 
End Type 

Private Function ShowTitleBar(ByVal bState As Boolean) 
Dim lStyle As Long 
Dim tR As RECT 

GetWindowRect Me.hwnd, tR 
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE) 
If (bState) Then 
Me.Caption = Me.Tag 
If Me.ControlBox Then 
lStyle = lStyle Or WS_SYSMENU 
End If 
If Me.MaxButton Then 
lStyle = lStyle Or WS_MAXIMIZEBOX 
End If 
If Me.MinButton Then 
lStyle = lStyle Or WS_MINIMIZEBOX 
End If 
If Me.Caption <> "" Then 
lStyle = lStyle Or WS_CAPTION 
End If 
Else 
Me.Tag = Me.Caption 
Me.Caption = "" 
lStyle = lStyle And Not WS_SYSMENU 
lStyle = lStyle And Not WS_MAXIMIZEBOX 
lStyle = lStyle And Not WS_MINIMIZEBOX 
lStyle = lStyle And Not WS_CAPTION 
End If 
SetWindowLong Me.hwnd, GWL_STYLE, lStyle 
' 保证窗口具有相同的大小

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -