1,488
社区成员
发帖
与我相关
我的任务
分享Option Explicit
'在窗口结构中为指定的窗口设置信息
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 GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
'
Private Sub Form_Load()
Dim ret As Long
ret = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
If ret = 0 Then Debug.Print "error"
SetWindowLong Me.hwnd, GWL_EXSTYLE, ret Or WS_EX_LAYERED
SetLayeredWindowAttributes hwnd, 0, 200, LWA_ALPHA
End Sub