lpRect As RECT) _
As Long
Private Declare Function GetClientRect Lib "user32" _
(ByVal hwnd As Long, _
lpRect As RECT) _
As Long
''''** 定义窗体状态的枚举量 **
Public Enum enumWindowStatus
WIN_Normal = 0 '''' 一般窗体
WIN_Min = 1 '''' 最小化
WIN_Max = 2 '''' 最大化
End Enum
''''** 定义关于窗体状态的变量 **
Private myRect As RECT
Public Left As Single
Public Top As Single
Public Width As Single
Public Height As Single
Public WindowState As enumWindowStatus
''''Private MYFrm As Form
Public hwnd As Long
''''Public myForm As Form
''''Public MoveRect As clsMoveRect
''''Public SysEvent As clsSystemEvent
''''** 定义接口过程及函数 ********************************************************
''''** 窗体大小改变时改变窗体大小方框 **
Public Sub GetRect()
Call Resize
End Sub
Public Sub Resize()
GetClientRect hwnd, myRect
End Sub
''''** 禁止客户区重画 **
Public Sub ForbitDraw()
ValidateRect hwnd, myRect
End Sub
''''
'''' ''''** 设置当前窗体
'''' Public Property Let Hwnd(ByVal lngHwnd As Long)
''''
'''' lngHwnd = frm.Hwnd
'''' Set MYFrm = frm
'''' End Property
''''** 获得窗体状态数据
Public Sub GetWindowState()
'''' If MYFrm Is Nothing Then Exit Sub
'''' With MYFrm
'''' WindowState = .WindowState
'''' If WindowState <> WIN_Normal Then
'''' .WindowState = WIN_Normal
'''' End If
'''' Left = .Left
'''' Top = .Top
'''' Width = .Width
'''' Height = .Height
'''' End With
End Sub
''''** 设置窗体状态数据
Public Sub SetWindowState()
'''' If MYFrm Is Nothing Then Exit Sub
'''' With MYFrm
'''' .WindowState = WIN_Normal
'''' .Left = Left
'''' .Top = Top
'''' .Width = Width
'''' .Height = Height
'''' .WindowState = WindowState
'''' End With
End Sub
''''将窗体放在屏幕最高层
Public Property Let TopMost(ByVal bolTopMost As Boolean)
Const HWND_TOPMOST = -&H1
Const HWND_NOTOPMOST = -&H2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
If bolTopMost Then
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Else
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End If
End Property
Public Property Let FlashWin(ByVal bolFlash As Boolean)
FlashWindow hwnd, bolFlash
End Property
Public Sub Refresh()
UpdateWindow hwnd
End Sub
Public Function SendString(ByVal wMsg As Long, ByVal wParam As Long, ByVal strMsg As String) As Long
SendString = SendMessageByString(hwnd, wMsg, wParam, strMsg)
End Function
Public Function SendKey(ByVal KeyAscii As Integer) As Long
SendKey = SendMessageByString(hwnd, WM_CHAR, KeyAscii, 0)
End Function