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
Private Declare Function SetLayeredWindowAttributes Lib "user32" _(ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Sub MakeWindowLayered(hWnd As Long)
Dim ExStyles As Long
ExStyles = GetWindowLong(hWnd, GWL_EXSTYLE)
ExStyles = ExStyles Or WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, ExStyles
End Sub
Public Sub SetOpacity(hWnd As Long, Opacity As Byte)
SetLayeredWindowAttributes hWnd, 0, Opacity, LWA_ALPHA
End Sub
Private Sub cmdStart_Click()
'SetOpacit의 Opacity의 값의 범위: 0 ~ 255
SetOpacity Me.hWnd, CByte(220)
End Sub
Private Sub Command1_Click()
SetOpacity Me.hWnd, CByte(255)
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
MakeWindowLayered Me.hWnd
SetOpacity Me.hWnd, 0
cmdStart_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmMain = Nothing
End Sub