window transparency

BlitzMax Forums/BlitzMax Beginners Area/window transparency

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The following code turns the window frame transparent, but not the drawing area. Also when moved, the window leaves graphics where it was.

What am I missing to get the entire window transparent, and not having it leave graphics behind?

Extern "Win32"
	Function SetLayeredWindowAttributes(HWND:Int,COLORREF:Int,bAlpha:Byte,dwFLAGS:Int)
EndExtern

Const LWA_ALPHA=2

Graphics 320,240

Local alpha:Int = 192

Local hwnd:Int = GetForegroundWindow()
Local tmpStyle:Int = GetWindowLongW(hwnd, GWL_EXSTYLE)
If Not (tmpStyle & WS_EX_LAYERED) Then SetWindowLongW(hwnd, GWL_EXSTYLE, tmpStyle|WS_EX_LAYERED)
SetLayeredWindowAttributes(hwnd,0,Byte(alpha*255),LWA_ALPHA)

SetClsColor 192,192,192

While Not KeyHit(KEY_ESCAPE)
	Cls
		DrawText("Test",8,8)
	Flip
Wend
End