📄 屏敝文本框菜单和用户定义标题栏.bas
字号:
Attribute VB_Name = "Module1"
Option Explicit
Public Const GWL_WNDPROC = (-4)
Public Const WM_NCHITTEST = &H84
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_RBUTTONDOWN = &H204
Public Const HTCLIENT = 1
Public Const HTCAPTION = 2
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
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
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public prevWndProc(1) As Long
Function WndProcForForm1(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WndProcForForm1 = CallWindowProc(prevWndProc(0), hwnd, Msg, wParam, lParam)
If Msg = WM_NCHITTEST And WndProcForForm1 = HTCLIENT Then
If Form1.IsInImage(lParam Mod 65536, lParam \ 65536) Then
WndProcForForm1 = HTCAPTION
End If
End If
End Function
Function WndProcForText1(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_RBUTTONDOWN Then
Msg = WM_LBUTTONDOWN
End If
WndProcForText1 = CallWindowProc(prevWndProc(1), hwnd, Msg, wParam, lParam)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -