1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Private 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 crKey As Long, _
ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Declare Function FindWindowA _
Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Sub Transparence(hWnd As Long, Alpha As Byte)
Dim LeStyle As Long
LeStyle = GetWindowLong(hWnd, -20)
SetWindowLong hWnd, -20, LeStyle Or &H80000
SetLayeredWindowAttributes hWnd, 0, Alpha, &H2
End Sub
Private Sub CommandButton1_Click()
Transparence FindWindowA(vbNullString, Me.Caption), 150 '0 totalement translucide, 255 totalement opaque
End Sub |
Partager