This demo creates a window of varying degrees of transparency. Thanks to John Richardson for the code contained with LB Window Spier, a Libby Contest entry, 2004. The function for obtaining the OS Version was obtained at Alyce's Restaurant found at URL http://alycesrestaurant.com
Nomainwin
WindowWidth = 600
WindowHeight = 400
UpperLeftX = int((DisplayWidth-WindowWidth)/2)
UpperLeftY = int((DisplayHeight-WindowHeight)/2)
text$ = "Translucence here is initially set at 200. Try " + _
"setting to higher and lower numbers for desired " + _
"transparency. 0 will make your window complete " + _
"transparent. 255 is the maximum. This code was " + _
"taken from the Libby contest entry, LB Window Spier" + _
", by John Richardson. This demo will NOT work on " + _
"Windows 98 or Windows 95."
Statictext #transp.txt1, text$, 20, 20, 550, 200
Statictext #transp.txt2, "", 20, 250, 550, 100
Open"Transparent Window"for Window as #transp
#transp, "Trapclose EndDemo"
hTransp = hWnd(#transp)
#transp, "Font Verdana 12 Bold"If OSVersionFlag() ThenCall TransparentWindow hTransp, 200
#transp.txt2, "Success!"Else
#transp.txt2, "This demo will NOT work on Windows 98 " + _
"or Windows 95"EndIf
Wait
Sub EndDemo handle$
Close #transp
EndEndSubSub TransparentWindow handle, translucence
CallDLL #user32, "SetWindowLongA", _
handle asLong, _
-20 asLong, _
524544 asLong, _
layer asLong
CallDLL #user32, "SetLayeredWindowAttributes", _
handle asLong, _
0 asLong, _
translucence asLong, _
2 asLong, _
layer asLongEndSubFunction OSVersionFlag()
struct OSVERSIONINFO, _
dwOSVersionInfoSize asLong, _
dwMajorVersion asLong, _
dwMinorVersion asLong, _
dwBuildNumber asLong, _
dwPlatformId asLong, _
szCSDVersion as Char[128]
L = Len(OSVERSIONINFO.struct)
OSVERSIONINFO.dwOSVersionInfoSize.struct = L
CallDLL #kernel32, "GetVersionExA", _
OSVERSIONINFO as struct, _
result asBoolean
MajorVer = OSVERSIONINFO.dwMajorVersion.struct
If MajorVer < 5 Then
OSVersionFlag = 0
Else
OSVersionFlag = 1
EndIfEndFunction
Transparent Window
This demo creates a window of varying degrees of transparency. Thanks to John Richardson for the code contained with LB Window Spier, a Libby Contest entry, 2004. The function for obtaining the OS Version was obtained at Alyce's Restaurant found at URL http://alycesrestaurant.com