Code: Select all
; idea by cfr
; code by Danilo
;
; Simply use " SetWinTransparency (WinHandle.l, Transparency_Level.l) "
; Transparency_Level:
; 0 = transparent
; 255 = non-transparent
;
Procedure SetWinTransparency (WinHandle.l, Transparency_Level.l)
SetWindowLong_(WinHandle,#GWL_EXSTYLE,$00080000)
SetLayeredWindowAttributes_(WinHandle,0,Transparency_Level,2) ;
EndProcedure
;
;
hWnd = OpenWindow(0, (GetSystemMetrics_(#SM_CXSCREEN)-200)/2,(GetSystemMetrics_(#SM_CYSCREEN)-277)/2, 400, 360, #PB_Window_SystemMenu|#PB_Window_SizeGadget, "Layered Window by Danilo")
a = 255
Repeat
EventID.l=WaitWindowEvent()
; IF LeftMouseButton pressed...
If EventID = #WM_LBUTTONDOWN
ReleaseCapture_()
SendMessage_(hWnd.l,#WM_NCLBUTTONDOWN, #HTCAPTION,0)
EndIf
; pressed CloseButton or ALT+F4 ??
If EventID = #PB_EventCloseWindow
Quit = 1
EndIf
a-1:SetWinTransparency(hWnd,a)
If a = 10: Quit = 1 :EndIf
Until Quit = 1
...Danilo
(registered PureBasic user)