cs_EBArtSoft
Messages postés4525Date d'inscriptiondimanche 29 septembre 2002StatutModérateurDernière intervention22 avril 20199 30 janv. 2006 à 19:13
voici une fonction :
Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2
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 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 SetTransparency(ByVal whWnd As Long, ByVal wAlpha As Byte)
Dim Style As Long
Dim Ver As Long
If (wAlpha = 255) Then
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style And Not WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
Else
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style Or WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
SetLayeredWindowAttributes whWnd, 0, wAlpha, LWA_ALPHA
End If
End Sub
cs_EBArtSoft
Messages postés4525Date d'inscriptiondimanche 29 septembre 2002StatutModérateurDernière intervention22 avril 20199 30 janv. 2006 à 19:13
voici une fonction :
Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2
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 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 SetTransparency(ByVal whWnd As Long, ByVal wAlpha As Byte)
Dim Style As Long
Dim Ver As Long
If (wAlpha = 255) Then
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style And Not WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
Else
Style = GetWindowLong(whWnd, GWL_EXSTYLE)
Style = Style Or WS_EX_LAYERED
SetWindowLong whWnd, GWL_EXSTYLE, Style
SetLayeredWindowAttributes whWnd, 0, wAlpha, LWA_ALPHA
End If
End Sub