[blue]Option Explicit
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.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Const LWA_COLORKEY = &H1&
Private Sub Form_Load()
Dim StyleEx As Long
Dim MaskColour As Long
MaskColour = RGB(255, 255, 255) [green]' Colour that will be transparent, in this example white[/green]
BackColor = MaskColour
StyleEx = GetWindowLong(hWnd, GWL_EXSTYLE)
StyleEx = StyleEx Or WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, StyleEx
SetLayeredWindowAttributes hWnd, MaskColour, 0, LWA_COLORKEY
End Sub
Private Sub Command1_Click()
Unload Me
End Sub[/blue]