All pastes #580029 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-20 23:00 UTC
rendered paste body
rivate 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 crey As Byte, _
     ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long


 Private Const GWL_EXSTYLE = (-20)

 Private Const WS_EX_LAYERED = &H80000

 Private Const LWA_ALPHA = &H2&

Private Sub Form_Load()
    Dim bytOpacity As Byte
   
    'Set the transparency level
    bytOpacity = 128
    Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, _
            GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
    Call SetLayeredWindowAttributes(Me.hwnd, 0, bytOpacity, _
            LWA_ALPHA)
            
End Sub