| '---------------------------Paste
this code into a module
Option Explicit
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const WS_EX_TRANSPARENT = &H20&
Public Const LWA_ALPHA = &H2&
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 SetLayeredWindowAttributes Lib "user32"
(ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte,
ByVal dwFlags As Long) As Long
'---------------------------Paste this
code into a form
Dim NormalWindowStyle As Long
Private Sub Form_Load()
'Get the normal window style to or layered
property to
NormalWindowStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
'Make windows 200 recognize window as layered
window
SetWindowLong frmMain.hwnd, GWL_EXSTYLE, NormalWindowStyle Or
WS_EX_LAYERED
'Make windows 200 change transparency level
SetLayeredWindowAttributes frmMain.hwnd, 0, 255, LWA_ALPHA
End Sub
Private Sub Slider_Scroll()
Dim Transparency As Byte '0-255 255 being
100% visible
'Get new trnasparency level
Transparency = (255 * Slider.Value) / 100
'Set the new transparency level
SetLayeredWindowAttributes frmMain.hwnd, 0, Transparency, LWA_ALPHA
'Change the caption of the label
lblTransLevel.Caption = CStr(CInt((Transparency / 255) * 100))
& "%"
End Sub
|