api回调函数.bas
来自「个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助」· BAS 代码 · 共 26 行
BAS
26 行
Attribute VB_Name = "Module1"
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
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
Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, IpRect As Rect) As Long
Global Const gcSetCaption = 1
Global Const gcSetPos = 2
Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Function EnumChildProc(ByVal hWnd As Long, ByVal IParam As Long) As Boolean
Dim R As Rect
Select Case IParam
Case gcSetCaption
SetWindowText Form1.hWnd, "New Caption"
Case gcSetPos
If GetWindowRect(Form1.hWnd, R) Then
SetWindowPos Form1.hWnd, 0, R.Left + 20, R.Top + 20, R.Right - R.Left, R.Bottom - R.Top, 0
End If
End Select
EnumChildProc = True
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?