1
0
mirror of https://e.coding.net/circlecloud/VBFunctionBas.git synced 2024-10-31 22:38:50 +00:00
VBFunctionBas/Frm_Tools.bas

1076 lines
52 KiB
QBasic
Raw Permalink Normal View History

Attribute VB_Name = "Frm_Tools"
'#######################################<23>û<EFBFBD><C3BB>ؼ<EFBFBD>˵<EFBFBD><CBB5>#########################################
'<27><><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD>
'<27><><EFBFBD><EFBFBD><>ִ<EFBFBD><D6B4><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صȹ<D8B5><C8B9><EFBFBD>
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:2014<31><34>6<EFBFBD><36>5<EFBFBD><35>
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'<27><>λ:<3A>Ϻ<EFBFBD><CFBA>ж<EFBFBD><D0B6><EFBFBD>ˮ<EFBFBD><EFBFBD>̰<EFBFBD>װ<EFBFBD><D7B0><EFBFBD>޹<EFBFBD>˾
''====================================<3D>û<EFBFBD><C3BB>ؼ<EFBFBD>ʹ<EFBFBD><CAB9>˵<EFBFBD><CBB5>=======================================
'<27><><EFBFBD>忿<EFBFBD><E5BFBF><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>:Auto_Hide(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [(<28><>ѡ)<29>ƶ<EFBFBD><C6B6>ٶ<EFBFBD> As Long = 1])
'<27><><EFBFBD>忿<EFBFBD><E5BFBF><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>:Auto_Magnet(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Form, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long,[<5B><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬])
'*****************************************************************************************************************************
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>:Daily_Show(<28><><EFBFBD><EFBFBD> As Form, <20><>ʱʱ<CAB1><CAB1> As Long)
'<27><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>:Daily_Tpt(<28><><EFBFBD><EFBFBD>ģʽ As Boolean, <20><><EFBFBD><EFBFBD> As Long, ͸<><CDB8><EFBFBD><EFBFBD> As Integer, <20><>ʱʱ<CAB1><CAB1> As Long)
'*****************************************************************************************************************************
<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>):fMove(<28><><EFBFBD><EFBFBD> As Form, Button As Integer, Shift As Integer, X As Single, Y As Single)
<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>):hMove(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'*****************************************************************************************************************************
'<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:GetClassName(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long) As String
'*****************************************************************************************************************************
'<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EEB4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GetFedWnd() As Long
'<27><><EFBFBD><EFBFBD><EEB4B0><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>):SetFedWnd(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'*****************************************************************************************************************************
'<27><>ȡԭ<C8A1>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>С: GetFrmSize
'<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>С: SetFrmSize
'*****************************************************************************************************************************
<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>:GetWindowhWnd(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String) As Long
<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>:GethWndByClass(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String) As Long
<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>:GethWndByTitle(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String) As Long
'<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:GetIconhWnd(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long) As Long
'<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GetMouseWindowhWnd() As Long
'*****************************************************************************************************************************
'<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>):GetTitle(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long) As String
'<27><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>):SetTitle(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'*****************************************************************************************************************************
'<27><>̨<EFBFBD><CCA8><EFBFBD>¼<EFBFBD>:hWndKeyDown(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><><EFBFBD><EFBFBD>ģʽ As KeyPressMode = Normal])
'<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>:hWndKeyPress(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><><EFBFBD><EFBFBD>ģʽ As KeyPressMode = Normal])
'<27><>̨<EFBFBD>ͷż<CDB7>:hWndKeyUp(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><><EFBFBD><EFBFBD>ģʽ As KeyPressMode = Normal])
'<27><><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD><EFBFBD>Ϣ:KeyNum2Key(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As long) As String
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>MakeKeyLparam:(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As long,<2C><><EFBFBD><EFBFBD>ģʽ As Long) As String
'*****************************************************************************************************************************
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>:InShow(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><>ʾģʽ As Boolean = True](True<75><65><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>False<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>))
'<27><><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>:InTop(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><>ʾģʽ As Boolean = True](True<75><65><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>False<73>Dz<EFBFBD><C7B2>ö<EFBFBD>))
'*****************************************************************************************************************************
'ʹ<><CAB9><EFBFBD><EFBFBD><E5B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B4B0>:NoControl(<28><><EFBFBD><EFBFBD> As Long, [ģʽ As Boolean](Mode=Ture<72><65>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>False<73><65>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>))
'*****************************************************************************************************************************
'<27><><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>:GethWndByClassEx(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long<6E><67>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'*****************************************************************************************************************************
'<27><>ʱ:Sleep(<28><>ʱ<EFBFBD><CAB1>С As Long[<5B><><EFBFBD><EFBFBD>])
'*****************************************************************************************************************************
'<27><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8>:Tpt(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, ͸<><CDB8><EFBFBD><EFBFBD>(0-100) As Integer, [<5B><>Ҫ͸<D2AA><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ As Long])
'#######################################<23>û<EFBFBD><C3BB>ؼ<EFBFBD>˵<EFBFBD><CBB5>#########################################
Option Explicit
Public VisibleT As Boolean
''#########################################ģ<><EFBFBD><E9BAAF>########################################
'====================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>=======================
Public Enum KeyPressMode
Normal
System
GameMode
End Enum
Private Const WM_KEYDOWN As Long = &H100
Private Const WM_KEYUP As Long = &H101
Private Const WM_CHAR As Long = &H102
Private Const WM_SYSKEYDOWN As Long = &H104
Private Const WM_SYSKEYUP As Long = &H105
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
'====================<3D><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=======================
Private Declare Function WindowFromPoint Lib "user32.dll" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
''================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>=========================================
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SETICON As Long = &H80
''================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=========================================
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
''================================<3D><><EFBFBD><EFBFBD><E5BCA4>=========================================
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
''================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=========================================
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetClassNameh Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
''================================<3D><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=========================================
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)
Private Const FRM_TOP = -1 '<27>ö<EFBFBD>
Private Const FRM_NORMAL = -2 '<27><>ͨ
Private Const FRM_NOSIZE = &H1 '<27><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>С
Private Const FRM_NOMOVE = &H2 '<27><><EFBFBD>ƶ<EFBFBD>
Private Const FRM_TOPMOST = &H3 '<27><><EFBFBD>ö<EFBFBD>
Private Const FRM_NOZEROER = &H4
Private Const FRM_NOREDRAW = &H8 '<27><><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD>
Private Const FRM_NOACTIVATE = &H10 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4B0>
Private Const FRM_FRAMECHANGED = &H20
Private Const FRM_SHOWWINDOW = &H40 '<27><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
Private Const FRM_HIDEWINDOW = &H80 '<27><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
Private Const FRM_NOCOPYBITS = &H100
Private Const FRM_NOOWNERZORDER = &H200
Private Const FRM_NOSENDCHANGING = &H400
'========================ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>============================
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
'''========================<3D><><EFBFBD>忿<EFBFBD><E5BFBF><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>============================
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Type RECT '<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Enum SetPos
SpTop
SPButton
SpLeft
SPRight
End Enum
Private Type POINTAPI '<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
X As Long
Y As Long
End Type
Private IsInFrm As Boolean '<27><><EFBFBD><EFBFBD><E2B4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸
Private Const HWND_TOPMOST = -1 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function IsIconic Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function IsZoomed Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
'''========================<3D><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8>============================
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20&
Private Const WS_EX_TOPMOST = &H8
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
'===================================Բ<>Ǵ<EFBFBD><C7B4><EFBFBD>====================================================
Private Declare Function SetWindowRgn Lib "user32.dll" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
'=================================Sleep========================================
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Savetime As Double
''================================<3D><><EFBFBD>ݾ<EFBFBD><DDBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PID=========================================
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, ByRef lpdwprocessid As Long) As Long
''================================ϵͳ<CFB5><EFBFBD><E6B1BE>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>=========================================
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CLEANBOOT = 67
Private Const SM_DEBUG = 22
Private Const SM_SLOWMACHINE = 73
Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Private Declare Function SafeArrayGetDim Lib "oleaut32.dll" (ByRef saArray() As Any) As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
''#####################################################ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>#####################################################
'#############################################<23>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>#################################################
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SetWindowIcon
'***<2A><> <20><> <20><><EFBFBD>ı<C4B1><E4B4B0>ICOͼ<4F><CDBC>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><>ѡ<><CDBC><EFBFBD>ļ<EFBFBD> As String, [<5B><>ѡ<><CDBC>λ<EFBFBD><CEBB> As Integer)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>PID
'***˵ <20><><EFBFBD><EFBFBD>NULL
'**********************************************************************************************************
Public Sub SetWindowIcon(hWnd As Long, Optional FileName As String, Optional IconIndex As Integer)
Dim m_Icon As Long
Dim hModule As Long
If Len(FileName) = 0 Or Len(Dir(FileName, vbHidden)) = 0 Then
Dim MyPath As String
MyPath = App.Path
If Right(MyPath, 1) <> "\" Then MyPath = MyPath & "\"
FileName = MyPath & App.EXEName & ".exe"
End If
hModule = GetModuleHandle(FileName)
m_Icon = ExtractIcon(hModule, FileName, IconIndex)
SendMessage hWnd, WM_SETICON, 0, ByVal m_Icon
End Sub
Public Function GetSystemVer()
Dim myVer As OSVERSIONINFO
Dim q As Long
myVer.dwOSVersionInfoSize = 148 '<27><>ȡϵͳ<CFB5>
q& = GetVersionEx(myVer)
GetSystemVer = myVer.dwMajorVersion & "." & myVer.dwMinorVersion
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SetRgnWindows
'***<2A><> <20><> <20><><EFBFBD>ı<C4B1><E4B4B0><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD>С
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD> As Form,<2C><>Ե<EFBFBD><D4B5>С As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>PID
'***˵ <20><><EFBFBD><EFBFBD>NULL
'**********************************************************************************************************
Public Function SetRgnWindows(Frm As Form, Rng As Long) As Long
Dim FRng As Long
Dim w As Long
Dim h As Long
w = Frm.ScaleX(Frm.Width, vbTwips, vbPixels)
h = Frm.ScaleY(Frm.Height, vbTwips, vbPixels)
FRng = CreateRectRgn(Rng, Rng, w - Rng, h - Rng)
SetRgnWindows = SetWindowRgn(Frm.hWnd, FRng, True)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SetRoundWindows
'***<2A><> <20><> <20><><EFBFBD>ı<C4B1><E4B4B0>ΪԲ<CEAA>Ǵ<EFBFBD><C7B4><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD> As Form,Բ<>Ǵ<EFBFBD>С As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>PID
'***˵ <20><><EFBFBD><EFBFBD>NULL
'**********************************************************************************************************
Public Function SetRoundWindows(Frm As Form, Rng As Long) As Long
Dim FRng As Long
Dim w As Long
Dim h As Long
w = Frm.ScaleX(Frm.Width, vbTwips, vbPixels)
h = Frm.ScaleY(Frm.Height, vbTwips, vbPixels)
FRng = CreateRoundRectRgn(0, 0, w - 0, h - 0, Rng, Rng)
SetRoundWindows = SetWindowRgn(Frm.hWnd, FRng, True)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetPidByhWnd
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ݾ<EFBFBD><DDBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PID
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>PID
'***˵ <20><><EFBFBD><EFBFBD>NULL
'**********************************************************************************************************
Public Function GetPidByhWnd(ByVal hWnd As Long) As Long
Dim PID As Long
GetWindowThreadProcessId hWnd, PID
GetPidByhWnd = PID
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tpt
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, ͸<><CDB8><EFBFBD><EFBFBD>(0-100) As Integer, [<5B><>Ҫ͸<D2AA><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ As Long = -1])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub Tpt(ByVal hWnd As Long, ByVal Range As Integer, Optional ByVal TransColor As Long = -1)
If Range > 100 Then Range = 100 '<27><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>100<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ100
If Range < 0 Then Range = 0 '<27><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
Dim rtn As Long
rtn = GetWindowLong(hWnd, GWL_EXSTYLE) <>ô<EFBFBD><C3B4><EFBFBD>״̬
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, rtn
If TransColor = -1 Then
SetLayeredWindowAttributes hWnd, 0, Range * 2.55, LWA_ALPHA '<27><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>
Else
SetLayeredWindowAttributes hWnd, TransColor, Range * 2.55, LWA_COLORKEY '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>
End If
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NoControl
'***<2A><> <20><> <20><>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><E5B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B4B0>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD> As Long, [ģʽ As Boolean])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Mode=Ture<72><65>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>False<73><65>ʾ<EFBFBD><CABE><EFBFBD>ܡ<EFBFBD>
'**********************************************************************************************************
Public Sub NoControl(ByVal hWnd As Long, Optional ByVal Mode As Boolean = True)
Dim rtn As Long
rtn = GetWindowLong(hWnd, GWL_EXSTYLE) <>ô<EFBFBD><C3B4><EFBFBD>״̬
rtn = rtn Or WS_EX_LAYERED
If Mode Then
rtn = rtn Or WS_EX_TRANSPARENT
Else
rtn = rtn And Not WS_EX_TRANSPARENT
End If
SetWindowLong hWnd, GWL_EXSTYLE, rtn
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Daily_Tpt
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD>ģʽ As Boolean, <20><><EFBFBD><EFBFBD> As Long, ͸<><CDB8><EFBFBD><EFBFBD> As Integer, <20><>ʱʱ<CAB1><CAB1> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,Mode = True '<27><>ʾ<EFBFBD><CABE><EFBFBD>壬Mode = False '<27><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
'**********************************************************************************************************
Public Sub Daily_Tpt(ByVal Mode As Boolean, ByVal hWnd As Long, ByVal Range As Integer, ByVal Daily As Long, Optional ByVal AddTpt As Long = 1)
'Mode = True '<27><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
'Mode = False '<27><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
If Daily > 5 Then Daily = 5 '<27><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬵<EFBFBD><F3A3ACB5><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>
If Daily <= 0 Then Daily = 0.1
Daily = Daily * 10
Dim Tpti As Integer
If Mode = True Then
Do Until Tpti > Range
Tpti = Tpti + AddTpt
Sleep Daily
Tpt hWnd, Tpti
Loop
Else
Tpti = Range
Do Until Tpti < 0
Tpti = Tpti - AddTpt
Sleep Daily
Tpt hWnd, Tpti
Loop
End If
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Daily_Show
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD> As Form, <20><>ʱʱ<CAB1><CAB1> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'**********************************************************************************************************
Public Sub Daily_Show(ByVal Frm As Form, ByVal Daily As Long)
Dim h As Long
Dim w As Long
Dim i As Long
h = Frm.Height
w = Frm.Width
Frm.Height = 20
Frm.Width = 20
For i = 20 To w Step Daily
Sleep 10
Frm.Width = i
Frm.Refresh
Next
For i = 20 To h Step Daily
Sleep 10
Frm.Height = i
Frm.Refresh
Next
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>InTop
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><>ʾģʽ As Boolean = True](True<75><65><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>False<73>Dz<EFBFBD><C7B2>ö<EFBFBD>))
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub InTop(ByVal hWnd As Long, Optional ByVal Mode As Boolean = True)
If Mode Then
SetWindowPos hWnd, FRM_TOP, 0, 0, 0, 0, FRM_TOPMOST '<27>ö<EFBFBD>
Else
SetWindowPos hWnd, FRM_NORMAL, 0, 0, 0, 0, FRM_TOPMOST '<27><><EFBFBD>ö<EFBFBD>
End If
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>InShow
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><>ʾģʽ As Boolean = True](True<75><65><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>False<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>))
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub InShow(ByVal hWnd As Long, Optional ByVal Mode As Boolean = True)
If Mode Then
SetWindowPos hWnd, 0, 0, 0, 0, 0, FRM_SHOWWINDOW Or FRM_TOPMOST '<27><>ʾ
Else
SetWindowPos hWnd, 0, 0, 0, 0, 0, FRM_HIDEWINDOW Or FRM_TOPMOST '<27><><EFBFBD><EFBFBD>ʾ
End If
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Auto_Hide
'***<2A><> <20>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>忿<EFBFBD><E5BFBF><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [(<28><>ѡ)<29>ƶ<EFBFBD><C6B6>ٶ<EFBFBD> As Long = 1])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd
'**********************************************************************************************************
'Public Sub Auto_Hide(ByVal Enable As Boolean, Optional ByVal hWnd As Long, Optional ByVal Range As Long, Optional Daily As Long, Optional ByVal MoveInt As Long = 1)
' Tim.Enabled = Enable
' Tim.Interval = Daily
' Tim.Tag = hWnd & " " & Range & " " & MoveInt
'End Sub
'
'Private Sub Tim_Timer()
' Dim info
' info = Split(Tim.Tag)
' Auto_Hide_Load Val(info(0)), Val(info(1)), Val(info(2))
'End Sub
Private Sub Auto_Hide_Load(ByVal hWnd As Long, ByVal Range As Long, Optional ByVal MoveInt As Long)
Dim P As POINTAPI
Dim F As RECT
Dim T As Long
Dim WinHeight As Long
Dim WinWidth As Long
Dim ScrHeight As Long
Dim ScrWidth As Long
Dim IsTop As Long
IsTop = IsTopmost(hWnd)
GetCursorPos P '<27>õ<EFBFBD>MOUSEλ<45><CEBB>
GetWindowRect hWnd, F '<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
WinWidth = F.Right - F.Left
WinHeight = F.Bottom - F.Top
ScrHeight = Screen.Height / 15
ScrWidth = Screen.Width / 15
If MoveInt <= 0 Then MoveInt = 0
If IsZoomed(hWnd) = 0 And IsIconic(hWnd) = 0 Then
If P.X >= F.Left And P.X <= F.Right And P.Y >= F.Top And P.Y <= F.Bottom Then
If IsInFrm Then
SetWindowPos hWnd, FRM_TOP, 0, 0, 0, 0, FRM_TOPMOST
If F.Top <= 0 Then
T = F.Top
Do Until T >= 0 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
If MoveInt = 0 Then T = 0 Else T = T + MoveInt
If T > 0 Then T = 0
SetWindowPos hWnd, 0, F.Left, T, 0, 0, FRM_NOSIZE
DoEvents
Loop
ElseIf F.Left <= 0 Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
T = F.Left
Do Until T >= 0
If MoveInt = 0 Then T = 0 Else T = T + MoveInt
If T > 0 Then T = 0
SetWindowPos hWnd, 0, T, F.Top, 0, 0, FRM_NOSIZE
DoEvents
Loop
ElseIf F.Bottom >= ScrHeight Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
T = F.Bottom
Do Until T <= ScrHeight
If MoveInt = 0 Then T = ScrHeight Else T = T - MoveInt
If T > ScrHeight Then T = ScrHeight
SetWindowPos hWnd, 0, F.Left, T - WinHeight, 0, 0, FRM_NOSIZE
DoEvents
Loop
ElseIf F.Right >= ScrWidth Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
T = F.Right
Do Until T <= ScrWidth
If MoveInt = 0 Then T = ScrWidth Else T = T - MoveInt
If T > ScrWidth Then T = ScrWidth
SetWindowPos hWnd, 0, T - WinWidth, F.Top, 0, 0, FRM_NOSIZE
DoEvents
Loop
End If
IsInFrm = False
End If
Else
If Not IsInFrm Then
SetWindowPos hWnd, FRM_NORMAL, 0, 0, 0, 0, FRM_TOPMOST
If F.Top <= 5 Then
T = F.Top
Do Until T <= Range / 15 - WinHeight '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>,rangeΪ¶<CEAA><C2B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B3A4>
If MoveInt = 0 Then T = Range / 15 - WinHeight Else T = T - MoveInt
If T < Range / 15 - WinHeight Then T = Range / 15 - WinHeight
SetWindowPos hWnd, 0, F.Left, T, 0, 0, FRM_NOSIZE
DoEvents
Loop
ElseIf F.Left <= 5 Then
T = F.Left
Do Until T <= Range / 15 - WinWidth '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
If MoveInt = 0 Then T = Range / 15 - WinWidth Else T = T - MoveInt
If T < Range / 15 - WinWidth Then T = Range / 15 - WinWidth
SetWindowPos hWnd, 0, T, F.Top, 0, 0, FRM_NOSIZE
DoEvents
Loop
ElseIf F.Bottom >= ScrHeight - 5 Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
T = F.Bottom - WinHeight
Do Until T >= ScrHeight - Range / 15
If MoveInt = 0 Then T = ScrHeight - Range / 15 Else T = T + MoveInt
If T > ScrHeight - Range / 15 Then T = ScrHeight - Range / 15
SetWindowPos hWnd, 0, F.Left, T, 0, 0, FRM_NOSIZE
DoEvents
Loop
ElseIf F.Right >= ScrWidth - 5 Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
T = F.Right - WinWidth
Do Until T >= ScrWidth - Range / 15
If MoveInt = 0 Then T = ScrWidth - Range / 15 Else T = T + MoveInt
If T > ScrWidth - Range / 15 Then T = ScrWidth - Range / 15
SetWindowPos hWnd, 0, T, F.Top, 0, 0, FRM_NOSIZE
DoEvents
Loop
End If
IsInFrm = True
End If
End If
End If
If IsTop <> IsTopmost(hWnd) Then SetWindowPos hWnd, IsTop, 0, 0, 0, 0, FRM_TOPMOST
End Sub
Public Function IsTopmost(hWnd As Long) As Long '<27>жϴ<D0B6><CFB4><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>
Dim Ret As Long, t1 As Long
Ret = GetWindowLong(hWnd, GWL_EXSTYLE)
t1 = Ret Or WS_EX_TOPMOST
IsTopmost = IIF(Ret = t1, -1, -2)
End Function
'------------------------------------<2D><><EFBFBD><EFBFBD>Ϊ<EFBFBD>ϰ汾--------------------------------------------------------
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Auto_Hide
'***<2A><> <20>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>忿<EFBFBD><E5BFBF><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Form, <20><>ʱ<EFBFBD><CAB1> As Timer, <20><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>м<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Timer<65>¼<EFBFBD><C2BC>е<EFBFBD><D0B5><EFBFBD>(<28><><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>Timer<65><72><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ֵ)
'**********************************************************************************************************
'Public Sub Auto_Hide(ByVal Frm As Form, ByVal Tmr As Timer, ByVal Range As Long, ByVal Daily As Long)
' Dim P As POINTAPI
' Dim f As RECT
' Tmr.Enabled = True
' Tmr.Interval = Daily
' GetCursorPos P '<27>õ<EFBFBD>MOUSEλ<45><CEBB>
' GetWindowRect Frm.hwnd, f '<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
' If Frm.WindowState <> 1 Then
' If P.X >= f.Left And P.X <= f.Right And P.Y >= f.Top And P.Y <= f.Bottom Then
' 'MOUSE <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
' If Not IsInFrm Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
' If Frm.Top <= 0 Then
' Do Until Frm.Top >= 0 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
' Frm.Top = Frm.Top + 1
' Loop
' ElseIf Frm.Left <= 0 Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
' Do Until Frm.Left >= 0
' Frm.Left = Frm.Left + 1
' Loop
' ElseIf Frm.Top + Frm.Height >= Screen.Height Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
' Do Until Frm.Top <= Screen.Height - Frm.Height
' Frm.Top = Frm.Top - 1
' Loop
' ElseIf Frm.Left + Frm.Width >= Screen.Width Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
' Do Until Frm.Left <= Screen.Width - Frm.Width
' Frm.Left = Frm.Left - 1
' Loop
' End If
' IsInFrm = True
' End If
' Else
' If IsInFrm Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
' If Frm.Top <= 5 Then
' Do Until Frm.Top <= Range - Frm.Height '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>,rangeΪ¶<CEAA><C2B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B3A4>
' Frm.Top = Frm.Top - 1
' Loop
' ElseIf f.Left <= 5 Then
' Do Until Frm.Left <= Range - Frm.Width '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
' Frm.Left = Frm.Left - 1
' Loop
' ElseIf Frm.Top + Frm.Height >= Screen.Height - 5 Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
' Do Until Frm.Top >= Screen.Height - Range
' Frm.Top = Frm.Top + 1
' Loop
' ElseIf Frm.Left + Frm.Width >= Screen.Width - 5 Then '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
' Do Until Frm.Left >= Screen.Width - Range
' Frm.Left = Frm.Left + 1
' Loop
' End If
' IsInFrm = False
' End If
' End If
' End If
'End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Auto_Magnet
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>忿<EFBFBD><E5BFBF><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Form, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long,[<5B><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>MouseMove<76>¼<EFBFBD><C2BC>е<EFBFBD><D0B5><EFBFBD>
'**********************************************************************************************************
Public Sub Auto_Magnet(ByVal Frm As Form, ByVal Range As Long, Optional ByVal Button As Integer) 'range<67><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Dim P As POINTAPI
GetCursorPos P '<27>õ<EFBFBD>MOUSEλ<45><CEBB>
If Button = 1 Then '<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ڱ<EFBFBD>Ե
If P.X = 0 Then Frm.Left = 0 '<27><><EFBFBD><EFBFBD><EAB4A6><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>Ե<EFBFBD><D4B5>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
If P.Y = 0 Then Frm.Top = 0
If P.X = Screen.Width Then Frm.Left = Screen.Width - Frm.Width
If P.Y = Screen.Height Then Frm.Top = Screen.Height - Frm.Height
Else
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>ȱ<EFBFBD>Ե<EFBFBD><D4B5>
If Frm.Left < Range And Frm.Left > 0 Then
Frm.Left = 0 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
End If
If Frm.Top < Range And Frm.Top > 0 Then
Frm.Top = 0 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
End If
If Frm.Left + Frm.Width > Screen.Width - Range And Frm.Left + Frm.Width < Screen.Width Then
Frm.Left = Screen.Width - Frm.Width '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
End If
If Frm.Top + Frm.Height > Screen.Height - Range And Frm.Top + Frm.Height < Screen.Height Then
Frm.Top = Screen.Height - Frm.Height '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
End If
ReleaseCapture
End If
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WindowKiss
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long,<2C><><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD>
'**********************************************************************************************************
'Public Sub WindowKiss(ByVal Enable As Boolean, Optional ByVal BhWnd As Long, Optional ByVal KhWnd As Long, Optional ByVal SetRect As SetPos, Optional ByVal IsIN As Long, Optional ByVal Daily As Long)
' Ktmr.Enabled = Enable
' Ktmr.Interval = Daily
' Ktmr.Tag = BhWnd & " " & KhWnd & " " & SetRect & " " & IsIN
'End Sub
'
'Private Sub Ktmr_Timer()
' On Error Resume Next
' Dim AWK() As String
' AWK = Split(Ktmr.Tag)
' AutoWindowKiss AWK(0), AWK(1), AWK(2), AWK(3)
'End Sub
Public Sub AutoWindowKiss(ByVal BhWnd As Long, ByVal KhWnd As Long, ByVal SetRect As SetPos, ByVal IsIN As Boolean, ByVal IsTop As Boolean)
Dim B As RECT
Dim k As RECT
Dim BH As Long
Dim BW As Long
Dim KH As Long
Dim KW As Long
Dim BHK As Long
Dim BWK As Long
Dim Frm_ST As Long
If IsTop Then Frm_ST = -1 Else Frm_ST = -2
GetWindowRect BhWnd, B
GetWindowRect KhWnd, k
BH = B.Bottom - B.Top
BW = B.Right - B.Left
KH = k.Bottom - k.Top
KW = k.Right - k.Left
BHK = Abs(BH - KH) / 2
BWK = Abs(BW - KW) / 2
Select Case SetRect
Case SpTop
If IsIN Then
SetWindowPos KhWnd, Frm_ST, B.Left + BWK, B.Top, 0, 0, FRM_NOSIZE
Else
SetWindowPos KhWnd, Frm_ST, B.Left + BWK, B.Top - KH, 0, 0, FRM_NOSIZE
End If
Case SPButton
If IsIN Then
SetWindowPos KhWnd, Frm_ST, B.Left + BWK, B.Bottom - KH, 0, 0, FRM_NOSIZE
Else
SetWindowPos KhWnd, Frm_ST, B.Left + BWK, B.Bottom, 0, 0, FRM_NOSIZE
End If
Case SpLeft
If IsIN Then
SetWindowPos KhWnd, Frm_ST, B.Left, B.Top, 0, 0, FRM_NOSIZE
Else
SetWindowPos KhWnd, Frm_ST, B.Left - KW, B.Top, 0, 0, FRM_NOSIZE
End If
Case SPRight
If IsIN Then
SetWindowPos KhWnd, Frm_ST, B.Left - KW, B.Top, 0, 0, FRM_NOSIZE
Else
SetWindowPos KhWnd, Frm_ST, B.Left, B.Top, 0, 0, FRM_NOSIZE
End If
End Select
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>hMove
'***<2A><> <20><> <20><>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>MouseDown<77>¼<EFBFBD><C2BC>е<EFBFBD><D0B5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me.hWnd<6E><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub hMove(ByVal hWnd As Long)
ReleaseCapture '<27>ӵ<EFBFBD>ǰ<EFBFBD>߳<EFBFBD><DFB3>еĴ<D0B5><C4B4><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>񣬲<EFBFBD><F1A3ACB2>ָ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB4A6><EFBFBD><EFBFBD>
SendMessage hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& '<27>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>fMove
'***<2A><> <20><> <20><>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD> As Form, Button As Integer, Shift As Integer, X As Single, Y As Single)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>MouseMove<76>¼<EFBFBD><C2BC>е<EFBFBD><D0B5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Me<4D><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壬ʣ<E5A3AC>µ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD>Button, Shift, X, Y
'**********************************************************************************************************
Public Sub fMove(Frm As Form, Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
Static nX&, nY&
If Button = 1 Then
Frm.Move Frm.Left - nX + X, Frm.Top - nY + Y
Button = 0
Else
nX = X
nY = Y
End If
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetTitle
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String
'**********************************************************************************************************
Public Function GetTitle(ByVal hWnd As Long) As String '<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Dim StrText As String * 256 '<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
Dim cch As Long '<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cch = GetWindowText(hWnd, StrText, 256) '<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GetTitle = Left(StrText, cch) '<27><><EFBFBD>ݳ<EFBFBD><DDB3>Ƚ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SetTitle
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'**********************************************************************************************************
Public Sub SetTitle(ByVal hWnd As Long, ByVal TitleStr As String) '<27><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SetWindowText hWnd, TitleStr '<27><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetFedWnd
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EEB4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EEB4B0><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD> As Long
'**********************************************************************************************************
Public Function GetFedWnd() As Long
GetFedWnd = GetForegroundWindow '<27>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SetFedWnd
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4B0><><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'**********************************************************************************************************
Public Sub SetFedWnd(ByVal hWnd As Long)
SetForegroundWindow hWnd '<27><><EFBFBD>þ<EFBFBD><C3BE><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EEB4B0>
End Sub
'##########################################<23><><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ؼ<EFBFBD>ԭ<EFBFBD>д<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>#############################################
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetFrmSize
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ȡԭ<C8A1>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>С
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Load<61>¼<EFBFBD><C2BC>е<EFBFBD><D0B5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>ҿؼ<D2BF><D8BC><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub GetFrmSize(FormName As Form)
On Error Resume Next
Dim obj As Control '<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>
FormName.ScaleWidth = 1000 '<27><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
FormName.ScaleHeight = 1000 '<27><><EFBFBD>ô<EFBFBD><C3B4>崹ֱ<E5B4B9><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
For Each obj In FormName '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пؼ<D0BF>
obj.Tag = Str(obj.Left) & Str(obj.Top) & Str(obj.Width) & Str(obj.Height) '<27><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD>Tag
Next obj
On Error GoTo 0
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SetFrmSize
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>С
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>NULL
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Resize<7A>¼<EFBFBD><C2BC>е<EFBFBD><D0B5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>ҿؼ<D2BF><D8BC><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub SetFrmSize(FormName As Form) 'Optional FormName As Form = UserControl.Parent)
On Error Resume Next
Dim Pos() As String
Dim obj As Control
FormName.ScaleWidth = 1000 '<27><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
FormName.ScaleHeight = 1000 '<27><><EFBFBD>ô<EFBFBD><C3B4>崹ֱ<E5B4B9><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
For Each obj In FormName '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пؼ<D0BF>
Pos = Split(obj.Tag) '
obj.Left = Val(Pos(1)) '<27><><EFBFBD><EFBFBD>
obj.Top = Val(Pos(2)) '<27>ؼ<EFBFBD>
obj.Width = Val(Pos(3)) <><CEBB>
obj.Height = Val(Pos(4)) '<27><>С
Next obj
On Error GoTo 0
End Sub
'##########################################<23><><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ؼ<EFBFBD>ԭ<EFBFBD>д<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>#############################################
'##########################################<23><><EFBFBD>ھ<EFBFBD><DABE><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>#############################################
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>KeyNum2Key
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD><EFBFBD>Ϣ
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ As String
'***˵ <20><><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function KeyNum2Key(ByVal KeyNum As Long) As String
'Debug.Print KeyNum
Select Case KeyNum
Case vbKeyLButton: KeyNum2Key = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
Case vbKeyRButton: KeyNum2Key = "<22><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD>"
Case vbKeyCancel: KeyNum2Key = "CANCEL"
Case vbKeyMButton: KeyNum2Key = "<22><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>"
Case 5: KeyNum2Key = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>1"
Case 6: KeyNum2Key = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>2"
Case vbKeyBack: KeyNum2Key = "<22>˸<EFBFBD><CBB8><EFBFBD>" '"BACKSPACE"
Case vbKeyTab: KeyNum2Key = "TAB"
Case vbKeyClear: KeyNum2Key = "CLEAR"
Case vbKeyReturn: KeyNum2Key = "ENTER"
Case vbKeyShift: KeyNum2Key = "SHIFT"
Case vbKeyControl: KeyNum2Key = "CTRL"
Case vbKeyMenu: KeyNum2Key = "MENU"
Case vbKeyPause: KeyNum2Key = "PAUSE"
Case vbKeyCapital: KeyNum2Key = "CAPS LOCK"
Case vbKeyEscape: KeyNum2Key = "ESC"
Case vbKeySpace: KeyNum2Key = "SPACEBAR"
Case vbKeyPageUp: KeyNum2Key = "PAGE UP"
Case vbKeyPageDown: KeyNum2Key = "PAGE DN"
Case vbKeyEnd: KeyNum2Key = "END"
Case vbKeyHome: KeyNum2Key = "HOME"
Case vbKeyLeft: KeyNum2Key = "<22><>" '"LEFT ARROW"
Case vbKeyUp: KeyNum2Key = "<22><>" '"UP ARROW"
Case vbKeyRight: KeyNum2Key = "<22><>" '"RIGHT ARROW"
Case vbKeyDown: KeyNum2Key = "<22><>" '"DOWN ARROW"
Case vbKeySelect: KeyNum2Key = "SELECT"
Case vbKeyPrint: KeyNum2Key = "PRINT SCREEN"
Case vbKeyExecute: KeyNum2Key = "EXECUTE"
Case vbKeySnapshot: KeyNum2Key = "SNAPSHOT"
Case vbKeyDelete: KeyNum2Key = "DELETE"
Case vbKeyHelp: KeyNum2Key = "HELP"
Case vbKeyNumlock: KeyNum2Key = "NUM LOCK"
Case vbKeyNumpad0: KeyNum2Key = "Num 0"
Case vbKeyNumpad1: KeyNum2Key = "Num 1"
Case vbKeyNumpad2: KeyNum2Key = "Num 2"
Case vbKeyNumpad3: KeyNum2Key = "Num 3"
Case vbKeyNumpad4: KeyNum2Key = "Num 4"
Case vbKeyNumpad5: KeyNum2Key = "Num 5"
Case vbKeyNumpad6: KeyNum2Key = "Num 6"
Case vbKeyNumpad7: KeyNum2Key = "Num 7"
Case vbKeyNumpad8: KeyNum2Key = "Num 8"
Case vbKeyNumpad9: KeyNum2Key = "Num 9"
Case vbKeyMultiply: KeyNum2Key = "MULTIPLICATIONSIGN(*)"
Case vbKeyAdd: KeyNum2Key = "PLUSSIGN(+)"
Case vbKeySeparator: KeyNum2Key = "ENTER"
Case vbKeySubtract: KeyNum2Key = "MINUSSIGN(-)"
Case vbKeyDecimal: KeyNum2Key = "DECIMALPOINT(.)"
Case vbKeyDivide: KeyNum2Key = "DIVISIONSIGN(/)"
Case vbKeyF1: KeyNum2Key = "F1"
Case vbKeyF2: KeyNum2Key = "F2"
Case vbKeyF3: KeyNum2Key = "F3"
Case vbKeyF4: KeyNum2Key = "F4"
Case vbKeyF5: KeyNum2Key = "F5"
Case vbKeyF6: KeyNum2Key = "F6"
Case vbKeyF7: KeyNum2Key = "F7"
Case vbKeyF8: KeyNum2Key = "F8"
Case vbKeyF9: KeyNum2Key = "F9"
Case vbKeyF10: KeyNum2Key = "F10"
Case vbKeyF11: KeyNum2Key = "F11"
Case vbKeyF12: KeyNum2Key = "F12"
Case 91: KeyNum2Key = "Win"
Case 93: KeyNum2Key = "Menu"
Case 160: KeyNum2Key = "<22><>SHIFT"
Case 161: KeyNum2Key = "<22><>SHIFT"
Case 162: KeyNum2Key = "<22><>CTRL"
Case 163: KeyNum2Key = "<22><>CTRL"
Case 164: KeyNum2Key = "<22><>AIT"
Case 165: KeyNum2Key = "<22><>AIT"
Case 186: KeyNum2Key = ";"
Case 187: KeyNum2Key = "="
Case 188: KeyNum2Key = ","
Case 189: KeyNum2Key = "-"
Case 190: KeyNum2Key = "."
Case 191: KeyNum2Key = "/"
Case 192: KeyNum2Key = "~"
Case 219: KeyNum2Key = "["
Case 220: KeyNum2Key = "\"
Case 221: KeyNum2Key = "]"
Case 222: KeyNum2Key = "'"
Case Else: KeyNum2Key = Chr(KeyNum)
End Select
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MakeKeyLparam
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As long,<2C><><EFBFBD><EFBFBD>ģʽ As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD> As String
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD>е<EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EBA3AC>Ȼ<EFBFBD><C8BB>Щ<EFBFBD><D0A9>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD><EFBFBD><EFBFBD>Ϣ
'**********************************************************************************************************
Private Function MakeKeyLparam(ByVal VirtualKey As Long, ByVal flag As Long) As Long
Dim S As String
Dim Firstbyte As String 'lparam<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>24-31λ
If flag = WM_KEYDOWN Then '<27><><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>¼<EFBFBD>
Firstbyte = "00"
Else
Firstbyte = "C0" '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷż<CDB7>
End If
Dim Scancode As Long
'<27><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>
'Debug.Print "========" & VirtualKey & "========="
Scancode = MapVirtualKey(VirtualKey, 0)
'Debug.Print Scancode
Dim Secondbyte As String 'lparam<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16-23λ<33><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD>
Secondbyte = Right("00" & Hex(Scancode), 2)
'Debug.Print Secondbyte
S = Firstbyte & Secondbyte & "0001" '0001Ϊlparam<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-15λ<35><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>Ϣ
'Debug.Print "&H" & s
MakeKeyLparam = Val("&H" & S)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>hWndKeyDown
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD>¼<EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><><EFBFBD><EFBFBD>ģʽ As KeyPressMode = Normal])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD>°<EFBFBD><C2B0><EFBFBD>
'**********************************************************************************************************
Public Sub hWndKeyDown(ByVal hWnd As Long, ByVal KeyCode As Long, Optional ByVal PressKeyMode As KeyPressMode = Normal)
Select Case PressKeyMode
Case Normal
PostMessage hWnd, WM_KEYDOWN, KeyCode, 0 '<27>ͷ<EFBFBD>A<EFBFBD><41>
Case System
PostMessage hWnd, WM_KEYDOWN, KeyCode, 0 '<27><><EFBFBD><EFBFBD>A<EFBFBD><41>
Case GameMode
PostMessage hWnd, WM_KEYDOWN, KeyCode, MakeKeyLparam(KeyCode, WM_KEYDOWN) '<27><><EFBFBD><EFBFBD>A<EFBFBD><41>
End Select
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>hWndKeyUp
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>̨<EFBFBD>ͷż<CDB7>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><><EFBFBD><EFBFBD>ģʽ As KeyPressMode = Normal])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>̨<EFBFBD>ͷŰ<CDB7><C5B0><EFBFBD>
'**********************************************************************************************************
Public Sub hWndKeyUp(ByVal hWnd As Long, ByVal KeyCode As Long, Optional ByVal PressKeyMode As KeyPressMode = Normal)
Select Case PressKeyMode
Case Normal
PostMessage hWnd, WM_KEYUP, KeyCode, 0 '<27>ͷ<EFBFBD>A<EFBFBD><41>
Case System
PostMessage hWnd, WM_KEYUP, KeyCode, 0 '<27>ͷ<EFBFBD>A<EFBFBD><41>
Case GameMode
PostMessage hWnd, WM_KEYUP, KeyCode, MakeKeyLparam(KeyCode, WM_KEYUP) '<27>ͷ<EFBFBD>A<EFBFBD><41>
End Select
End Sub
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>hWndKeyPress
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long, [<5B><><EFBFBD><EFBFBD>ģʽ As KeyPressMode = Normal])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Sub hWndKeyPress(ByVal hWnd As Long, ByVal KeyCode As Long, Optional ByVal PressKeyMode As KeyPressMode = Normal)
Select Case PressKeyMode
Case Normal
PostMessage hWnd, WM_CHAR, KeyCode, 0 '<27><>A<EFBFBD><41>
Case System
PostMessage hWnd, WM_KEYDOWN, KeyCode, 0
PostMessage hWnd, WM_KEYUP, KeyCode, 0
Case GameMode
PostMessage hWnd, WM_KEYDOWN, KeyCode, MakeKeyLparam(KeyCode, WM_KEYDOWN)
PostMessage hWnd, WM_KEYUP, KeyCode, MakeKeyLparam(KeyCode, WM_KEYUP)
End Select
End Sub
'##########################################<23><><EFBFBD>ھ<EFBFBD><DABE><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>#############################################
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetMouseWindowhWnd()
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GetMouseWindowhWnd() As Long
Dim Point As POINTAPI
GetCursorPos Point
GetMouseWindowhWnd = WindowFromPoint(Point.X, Point.Y)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetClassName()
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GetClassName(ByVal hWnd As Long) As String
Dim StrText As String * 256
Dim cch As Long
cch = GetClassNameh(hWnd, StrText, 256)
GetClassName = Left(StrText, cch)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetIconhWnd()
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GetIconhWnd(ByVal hWnd As Long) As Long
GetIconhWnd = GetClassLong(hWnd, -14)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GetWindowhWnd()
'***<2A><> <20><> <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ҵ<EFBFBD><D2B5>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD> As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GetWindowhWnd(ByVal Title As String, ByVal Class As String) As Long
GetWindowhWnd = FindWindow(Class, Title)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GethWndByTitle()
'***<2A><> <20><> <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ҵ<EFBFBD><D2B5>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD> As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GethWndByTitle(ByVal Title As String) As Long
GethWndByTitle = FindWindow(vbNullString, Title)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GethWndByTitleEx()
'***<2A><> <20><> <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ҵ<EFBFBD><D2B5>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
'Public Function GethWndByTitleEx(ByVal Title As String) As Long
' GethWndByTitleEx = FindWindowEx(0, 0, vbNullString, Title)
'End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GethWndByClass()
'***<2A><> <20><> <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ҵ<EFBFBD><D2B5>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD> As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GethWndByClass(ByVal Class As String) As Long
GethWndByClass = FindWindow(Class, vbNullString)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GethWndByClassEx()
'***<2A><> <20><> <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҵ<EFBFBD><D2B4><EFBFBD>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As String)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ҵ<EFBFBD><D2B5>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>As Long
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'**********************************************************************************************************
Public Function GethWndByClassEx(ByVal Class As String)
Dim hWnd As Long
Dim AllhWnd As String
hWnd = FindWindowEx(0, 0, Class, vbNullString)
Do While hWnd <> 0
AllhWnd = hWnd & "|" & AllhWnd
hWnd = FindWindowEx(0, 0, Class, vbNullString)
Loop
GethWndByClassEx = Split(AllhWnd, "|")
End Function
Public Function FindClassEx(ByVal hWnd As Long, ByVal Class As String)
FindClassEx = FindWindowEx(0, hWnd, Class, vbNullString)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GethWndByClassEx()
'***<2A><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long<6E><67>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> As Long)
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>δ֪
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
'**********************************************************************************************************
'''===========================<3D><><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>===========================
Public Function RGBAIcon(ByVal hWnd As Long, ByVal hIcon As Long) As Long
RGBAIcon = SendMessage(hWnd, WM_SETICON, 0, hIcon)
End Function
'**********************************************************************************************************
'***<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Sleep()
'***<2A><> <20><> <20><><EFBFBD><EFBFBD>ʱ
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>(<28><>ʱ<EFBFBD><CAB1>С As Long[<5B><><EFBFBD><EFBFBD>])
'***<2A><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>Null
'***˵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
'**********************************************************************************************************
Public Sub Sleep(n As Long)
Savetime = timeGetTime
While timeGetTime < Savetime + n
DoEvents
Wend
End Sub
'#############################################<23>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>#################################################