DECLARE integer GetFocus in User32
Declare Long SetWindowRgn IN WIN32API Long hWnd, Long hRgn, String bRedraw
Declare Long CreateRectRgn IN WIN32API Long X1, Long Y1, Long X2, Long Y2
DECLARE INTEGER SetLayeredWindowAttributes IN win32api INTEGER HWND, INTEGER crKey, INTEGER bAlpha, INTEGER dwFlags
DECLARE INTEGER SetWindowLong IN user32.DLL INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong
DECLARE INTEGER GetWindowLong IN user32.DLL INTEGER hWnd, INTEGER nIndex
#DEFINE LWA_COLORKEY 1
#DEFINE LWA_ALPHA 2
#DEFINE GWL_EXSTYLE -20
#DEFINE WS_EX_LAYERED 0x00080000
PUBLIC ofrm
ofrm = CREATEOBJECT("MyForm")
ofrm.show()
DEFINE CLASS myform as Form
backcolor = RGB(128,255,255)
showwindow = 2
nflags = 0
hwnd = 0
caption = ''
ADD OBJECT shp as shape with curvature = 20
PROCEDURE Activate
Thisform.hwnd = getfocus()
This.shp.width = This.width
This.shp.height = This.height
Thisform.Makeirr(Thisform.HWnd,Thisform.BackColor,1) && transparent
ENDPROC
PROCEDURE makeirr
LPARAMETERS nHWND, nColor, nAction
LOCAL lnFlags
SetWindowRgn(thisform.hwnd, CreateRectRgn(SYSMETRIC(3),SYSMETRIC(4)+SYSMETRIC(9),This.width+SYSMETRIC(3),This.height+SYSMETRIC(4)+SYSMETRIC(9)), "True")
do case
case nAction = 1 && Make Transparent
lnFlags = GetWindowLong(nHWND, GWL_EXSTYLE) &&Gets the existing flags from the window
thisform.nFlags = lnFlags
lnFlags = BITOR(lnFlags, WS_EX_LAYERED) &&Appends the Layered flag to the existing ones
SetWindowLong(nHWND, GWL_EXSTYLE, lnFlags) &&Sets the new flags to the window
SetLayeredWindowAttributes(nHWND, nColor, 0, LWA_COLORKEY)
case nAction = 2 && Make Opaque
SetWindowLong(nHWND, GWL_EXSTYLE, thisform.nFlags) &&Sets the original flags to the window
SetLayeredWindowAttributes(nHWND, nColor, 0, 0)
endcase
ENDPROC
ENDDEF