Attribute VB_Name = "mdlTransparan"
Option Explicit
Public Transparan As Integer
Public Trans As Integer
Private Const LWA_COLORKEY = 1
Private Const LWA_ALPHA = 2
Private Const LWA_BOTH = 3
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = -20

Private Declare Function SetLayeredWindowAttributes _
    Lib "user32" (ByVal hWnd As Long, _
    ByVal color As Long, ByVal x As Byte, _
    ByVal alpha As Long) As Boolean
    
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 GetWindowLong _
    Lib "user32" Alias "GetWindowLongA" _
    (ByVal hWnd As Long, ByVal nIndex As Long) As Long

Sub SetTrans(hWnd As Long, Trans As Integer)
   Dim Tcall As Long
   Tcall = GetWindowLong(hWnd, GWL_EXSTYLE)
   SetWindowLong hWnd, GWL_EXSTYLE, Tcall _
            Or WS_EX_LAYERED
   SetLayeredWindowAttributes hWnd, RGB(255, 255, 0), _
            Trans, LWA_ALPHA
   Exit Sub
End Sub
    
Sub SetTransp(hWnd As Long, Trans As Integer)
   Dim Tcall As Long
   Tcall = GetWindowLong(hWnd, GWL_EXSTYLE)
   SetWindowLong hWnd, GWL_EXSTYLE, Tcall _
            Or WS_EX_LAYERED
   SetLayeredWindowAttributes hWnd, RGB(255, 255, 0), _
            Trans, LWA_ALPHA
   Exit Sub
End Sub

