Transparent window

Windows specific questions.
Post Reply
angros47
Posts: 1985
Joined: Jun 21, 2005 19:04

Transparent window

Post by angros47 »

I found the example on old QB64 forum, and adapted it:

Code: Select all

#include"windows.bi"

'Level: 0 = transparent  255=opaque

SUB SetWindowOpacity (h AS integer, Level as ubyte)

CONST G = -20

DIM Msg AS LONG
dim hWnd as any ptr=cast(any ptr, h)

Msg = GetWindowLong(hWnd, G)
Msg = Msg OR WS_EX_LAYERED
SetWindowLong(hWnd, G, Msg)
SetLayeredWindowAttributes(hWnd, 0, Level, LWA_ALPHA)

END SUB


screencontrol 103,"GDI"

screenres 640,480,32

print "Hello world"

dim h as integer
screencontrol 2,h

setwindowopacity h,128
sleep
Post Reply