[Win2k + WinXP] Transparent Windows

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Win2k + WinXP] Transparent Windows

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

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
cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

:)

Getting better with a little help from my friends....thx Siggi
Post Reply