modmain.bas
来自「四方图 用于股市走势分析」· BAS 代码 · 共 47 行
BAS
47 行
Attribute VB_Name = "ModMain"
Public Type SF
X As Long
Y As Long
LpStr As String
i选择 As Boolean
i角度 As Integer
Color As Long
End Type
Public Const LWA_COLORKEY = 1
Public Const LWA_ALPHA = 2
Public Const LWA_BOTH = 3
Public Const WS_EX_LAYERED = &H80000
Public Const GWL_EXSTYLE = -20
Public Const RGN_OR = 2
Public Const HWND_TOPMOST = -1
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWWINDOW = &H40
Public inBuff() As SF
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long '取得窗口消息
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long '设置窗口消息
Public 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 Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal Color As Long, ByVal X As Byte, ByVal alpha As Long) As Boolean
Public Declare Function BringWindowToTop Lib "user32" (ByVal hWnd As Long) As Long
Public 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
Public Sub SetTranslucent(ThehWnd As Long, Color As Long, nTrans As Byte, flag As Byte)
On Error GoTo ErrorRtn
'SetWindowLong and SetLayeredWindowAttributes are API functions, see MSDN for details
Dim attrib As Long
attrib = GetWindowLong(ThehWnd, GWL_EXSTYLE)
SetWindowLong ThehWnd, GWL_EXSTYLE, attrib Or WS_EX_LAYERED
'anything with color value color will completely disappear if flag = 1 or flag = 3
SetLayeredWindowAttributes ThehWnd, Color, nTrans, flag
Exit Sub
ErrorRtn:
MsgBox Err.Description & " Source : " & Err.Source
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?