// First, check to see if we've set this window up to be layered yet
Const WS_EX_LAYERED = &H80000
Const LWA_ALPHA = 2
if not TestWindowStyleEx( w, WS_EX_LAYERED ) then
// The window isn't layered, so make it so
ChangeWindowStyleEx( w, WS_EX_LAYERED, true )
end
// Now we want to set the transparency of the window. The values range from 0 (totally
// transparent) to 255 (totally opaque).
Var value as Integer = 255 * alpha
Declare Sub SetLayeredWindowAttributes Lib "user32" ( hwnd As Integer, thecolor As Integer, bAlpha As integer, alpha As Integer )
SetLayeredWindowAttributes( w.Handle.Integer, 0 , value, LWA_ALPHA )
But with app. compiled for 64 bits that causes problems.
Var GWL_EXSTYLE As Integer = (-20)
Var WS_EX_RIGHT As Integer = &H1000
Var WS_EX_LEFTSCROLLBAR As Integer = &H4000
Var WS_EX_LAYERED As Integer = &H80000
Var LWA_ALPHA As Integer = &H2
Var LWA_COLORKEY As Integer =&H1
Soft Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA"(ByVal hwnd As Ptr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Soft Declare Function SetLayeredWindowAttributes Lib "User32"(windowRef As Ptr, ByVal crKey As Integer, ByVal Alpha As Byte, ByVal dwFlags As Integer) As Boolean
Var style As Integer
style = style Or WS_EX_LAYERED
Call SetWindowLong (self.handle, GWL_EXSTYLE, style)
Call SetLayeredWindowAttributes(self.handle, 0, 150, LWA_ALPHA)
No, the size of the pointer will change from 32 to 64 depending on the architecture so Integer is correct, but Ptr can also be used.
I’d adjust all those ByVal’s out of there Intrinsic types are passed byval anyway so its just clutter. Also some of those type are wrong so you might or might not end up with issues down the line.
See [LINK REMOVED PER OP REQUEST] for a lookup table and explanation.