' Window Style
Public Const GWL_STYLE = (-16)
Public Const WS_SYSMENU = &H80000
Public Const WS_MINIMIZEBOX = &H20000
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
' Transparency
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2
' Mouse Capture
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2
' Window Position
Private Const GW_HWNDNEXT = 2
Public hTaskBar As Long
Public Sub SetTrans(oForm As Form, Optional bytAlpha As Byte = 255, Optional lColor As Long = 0)
Dim lStyle As Long
lStyle = GetWindowLong(oForm.hWnd, GWL_EXSTYLE)
If Not (lStyle And WS_EX_LAYERED) = WS_EX_LAYERED Then _
SetWindowLong oForm.hWnd, GWL_EXSTYLE, lStyle Or WS_EX_LAYERED
SetLayeredWindowAttributes oForm.hWnd, lColor, bytAlpha, LWA_COLORKEY Or LWA_ALPHA
End Sub Private Sub Form_Load()
Set fEvents = frmBlank
' ShowInTaskBar
SetWindowLong Me.hWnd, GWL_STYLE, GetWindowLong(Me.hWnd, GWL_STYLE) Or WS_SYSMENU Or WS_MINIMIZEBOX
' Set Transparency Colour
Me.BackColor = vbCyan
SetChildColour Me.BackColor
' Set Transparency
SetTrans Me, , Me.BackColor
SetTrans fEvents, 1
' If the mouse-clicks are passing through then try increasing the number
' e.g. SetTrans fEvents, 5
'Center
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
PopulateControls
Me.Show
ltbID = GetAppsID(Me.Caption)
fEvents.Show
Me.ZOrder
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.Visible = False
fEvents.Visible = False
SetTrans Me
SetTrans fEvents
Unload fEvents
Set fEvents = Nothing
Set picUndo = Nothing
End Sub
' General
Public 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 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
' Process And Memory
Private Declare Function GetWindowThreadProcessId Lib "user32" ( _
ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" ( _
ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" ( _
ByVal hObject As Long) As Long
Private Declare Function VirtualFreeEx Lib "kernel32" ( _
ByVal hProcess As Long, lpAddress As Any, ByRef dwSize As Long, ByVal dwFreeType As Long) As Long
Private Declare Function VirtualAllocEx Lib "kernel32" ( _
ByVal hProcess As Long, lpAddress As Any, ByRef dwSize As Long, ByVal flAllocationType As Long, _
ByVal flProtect As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" ( _
ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, _
Optional lpNumberOfBytesWritten As Long) As Long
' Setting Window Style
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
' Transparency
Private Declare Function SetLayeredWindowAttributes Lib "user32" ( _
ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
' Control Position
Private Declare Function GetWindowRect Lib "user32" ( _
ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function ClientToScreen Lib "user32" ( _
ByVal hWnd As Long, lpPoint As POINTAPI) As Long
' Window Position
Private Declare Function GetWindow Lib "user32" ( _
ByVal hWnd As Long, ByVal wCmd As Long) As Long
' Mouse Capture
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long