Мутаген
15-07-2014, 22:43
Создаем проект Visual Basic, на форму кидаем кнопку и пишем код в эту форму:
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 Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(hwnd, GWL_EXSTYLE)
Ret = Ret Or &H80000
SetWindowLong hwnd, (-20), Ret
SetLayeredWindowAttributes hwnd, 0, 128, 2
End Sub
И наша форма становится прозразна на 50 процентов. Теперь немножко переделываем код для кнопки:
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 Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(Command1.hwnd, GWL_EXSTYLE)
Ret = Ret Or &H80000
SetWindowLong Command1.hwnd, (-20), Ret
SetLayeredWindowAttributes Command1.hwnd, 0, 128, 2 Or 1
End Sub
... и кнокпа почему то не становится на 50% прозрачнее :o Где ошибка?
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 Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(hwnd, GWL_EXSTYLE)
Ret = Ret Or &H80000
SetWindowLong hwnd, (-20), Ret
SetLayeredWindowAttributes hwnd, 0, 128, 2
End Sub
И наша форма становится прозразна на 50 процентов. Теперь немножко переделываем код для кнопки:
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 Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(Command1.hwnd, GWL_EXSTYLE)
Ret = Ret Or &H80000
SetWindowLong Command1.hwnd, (-20), Ret
SetLayeredWindowAttributes Command1.hwnd, 0, 128, 2 Or 1
End Sub
... и кнокпа почему то не становится на 50% прозрачнее :o Где ошибка?