📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Option Explicit
Declare Function EnumChildWindows Lib "user32" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hwnd As Long, ByVal lpClassName As String, _
ByVal nMaxCount 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
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) 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
Public Const GWL_WNDPROC = (-4)
Public Const WM_MOUSEMOVE = &H200
Public Const WM_RBUTTONDOWN = &H204
Public preWinProc As Long
Private hEditWnd As Long
Public Function wndproc(ByVal hwnd As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
'以下会截取mouse Rbutton Down。
If Msg = WM_RBUTTONDOWN Then
Debug.Print "Combol Mouse RButton Down "
Else
'将之送往原来的Window Procedure。
wndproc = CallWindowProc(preWinProc, hwnd, Msg, wParam, lParam)
End If
End Function
Public Function FindEditInCombo(ctl As ComboBox) As Long
Call EnumChildWindows(ctl.hwnd, AddressOf EnumFunc, 0)
FindEditInCombo = hEditWnd
End Function
Public Function EnumFunc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim ClsName As String
Dim lentxt As Long
If hwnd = 0 Then
EnumFunc = 0
Else
ClsName = String(255, 0)
lentxt = GetClassName(hwnd, ClsName, 256)
ClsName = Left(ClsName, lentxt)
If ClsName = "Edit" Then
hEditWnd = hwnd
EnumFunc = 0
Else
EnumFunc = 1
End If
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -