i have made a Sample for FiveWin using DWM
i use DllCall , like Xbase++ , as i´m not a "C" Programmer
i "think" FiveWin have HB_FUNC() for it but i´m not sure how Function Name is
- Code: Select all Expand view
- *+--------------------------------------------------------------------
*+
*+ Source Module => c:\fwh\0\DWM\FWDWM.PRG
*+
*+ Copyright(C) 1983-2022 by Auge & Ohr
*+
*+ Functions: Procedure Main()
*+ Function DwmEnableBlurBehindWindow()
*+ Function DwmExtendFrameIntoClientArea()
*+ Function CreateRectRgn()
*+ Function CreateEllipticRgn()
*+ Function CreateRoundRectRgn()
*+ Function SetWindowRgn()
*+
*+ Reformatted by Click! 2.05.40 on Aug-26-2022 at 8:40 am
*+
*+--------------------------------------------------------------------
#include "fivewin.ch"
#require "hbxpp"
#include "common.ch"
#include "dll.ch"
#define DLL_CDECL 0x08
#define DLL_STDCALL 0x20
#define DLL_SYSTEM 0x04
#if defined( __PLATFORM__WINDOWS )
#define DLL_OSAPI DLL_STDCALL
#elif defined( __PLATFORM__OS2 )
#define DLL_OSAPI DLL_SYSTEM
#else
#define DLL_OSAPI DLL_CDECL
#endif
#define DWM_BB_ENABLE 0x00000001
#define DWM_BB_BLURREGION 0x00000002
#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004
STATIC cVar1 := "Name "
STATIC cVar2 := "Channel "
STATIC cVar3 := "TV ID "
STATIC cVar4 := "Logo "
STATIC cVar5 := "URL "
STATIC cVar6 := "Group "
STATIC oGet1
STATIC oGet2
STATIC oGet3
STATIC oGet4
STATIC oGet5
STATIC oGet6
STATIC oSay1
*+--------------------------------------------------------------------
*+
*+ Procedure Main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE Main()
LOCAL oDlg, oFont, oImage, oFont2
LOCAL Hwnd, hRgn, lhRgn
LOCAL nLeftRect, nTopRect, nRightRect, nBottomRect
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 18
#IFDEF __HMG__
END FONT
#ENDIF
DEFINE FONT oFont2 NAME "TAHOMA" SIZE 0, - 28
#IFDEF __HMG__
END FONT
#ENDIF
DEFINE WINDOW oDlg FROM 0, 0 TO 600, 800 + 16 PIXEL TITLE "DWM" COLOR RGB( 025, 254, 255 ), CLR_BLUE
@ 0, 0 SAY oSay1 PROMPT "Desktop Windows Manager" SIZE 798, 040 PIXEL OF oDlg FONT oFont2 CENTER COLOR RGB( 005, 005, 005 ), RGB( 076, 163, 254 )
@ 340, 010 SAY "Name " GET oGet1 VAR cVar1 SIZE 290, 026 PIXEL OF oDlg FONT oFont NOBORDER COLOR RGB( 005, 005, 005 ), CLR_WHITE
@ 374, 010 SAY "Channel " GET oGet2 VAR cVar2 SIZE 120, 026 PIXEL OF oDlg FONT oFont NOBORDER COLOR RGB( 025, 254, 255 ), CLR_GRAY
@ 410, 010 SAY "TV ID " GET oGet3 VAR cVar3 SIZE 370, 026 PIXEL OF oDlg FONT oFont NOBORDER COLOR RGB( 255, 000, 000 ), CLR_YELLOW
@ 444, 010 SAY "Logo " GET oGet4 VAR cVar4 SIZE 370, 026 PIXEL OF oDlg FONT oFont NOBORDER COLOR RGB( 025, 254, 255 ), CLR_GREEN
@ 478, 010 SAY "URL " GET oGet5 VAR cVar5 SIZE 370, 026 PIXEL OF oDlg FONT oFont NOBORDER COLOR RGB( 025, 254, 255 ), CLR_RED
@ 512, 010 SAY "Group " GET oGet6 VAR cVar6 SIZE 370, 026 PIXEL OF oDlg FONT oFont NOBORDER COLOR RGB( 025, 254, 255 ), CLR_BLACK
#IFDEF __HMG__
END WINDOW
#ENDIF
Hwnd := oDlg:hWnd
nLeftRect := 1
nTopRect := oDlg:nBottom
nRightRect := oDlg:nRight
nBottomRect := 1
// lhRgn := CreateRoundRectRgn( nLeftRect, nTopRect, nRightRect, nBottomRect, 20, 20 )
lhRgn := CreateRectRgn( nLeftRect, nTopRect, nRightRect, nBottomRect )
DwmEnableBlurBehindWindow( Hwnd, lhRgn )
Hwnd := oSay1:hWnd
SetWindowRgn( Hwnd, lhRgn )
DwmExtendFrameIntoClientArea( Hwnd, lhRgn )
ACTIVATE WINDOW oDlg CENTERED
RETURN
*+--------------------------------------------------------------------
*+
*+ Function DwmEnableBlurBehindWindow()
*+
*+ Called from ( fwdwm.prg ) 1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION DwmEnableBlurBehindWindow( hWnd, lhRgn )
LOCAL xRet, bb
LOCAL dwFlags := DWM_BB_ENABLE
LOCAL fEnable := 1 // .T.
LOCAL hRgnBlur := lhRgn
LOCAL fTransitionOnMaximized := 1 // .T.
bb := L2BIN( dwFlags ) + ;
L2BIN( fEnable ) + ;
L2BIN( hRgnBlur ) + ;
L2BIN( fTransitionOnMaximized )
xRet := DllCall( "dwmapi.dll", DLL_OSAPI, "DwmEnableBlurBehindWindow", hWnd, bb )
RETURN xRet
*+--------------------------------------------------------------------
*+
*+ Function DwmExtendFrameIntoClientArea()
*+
*+ Called from ( fwdwm.prg ) 1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION DwmExtendFrameIntoClientArea( nHwnd, sMargin )
LOCAL xRet
xRet := DllCall( "dwmapi.dll", DLL_OSAPI, "DwmExtendFrameIntoClientArea", nHwnd, @sMargin )
RETURN xRet
*+--------------------------------------------------------------------
*+
*+ Function CreateRectRgn()
*+
*+ Called from ( fwdwm.prg ) 1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION CreateRectRgn( nLeftRect, nTopRect, nRightRect, nBottomRect )
LOCAL lRet
lRet := DllCall( "GDI32.DLL", DLL_OSAPI, "CreateRectRgn", nLeftRect, nTopRect, nRightRect, nBottomRect )
RETURN lRet
*+--------------------------------------------------------------------
*+
*+ Function CreateEllipticRgn()
*+
*+--------------------------------------------------------------------
*+
FUNCTION CreateEllipticRgn( nLeftRect, nTopRect, nRightRect, nBottomRect )
LOCAL lRet
lRet := DllCall( "GDI32.DLL", DLL_OSAPI, "CreateEllipticRgn", nLeftRect, nTopRect, nRightRect, nBottomRect )
RETURN lRet
*+--------------------------------------------------------------------
*+
*+ Function CreateRoundRectRgn()
*+
*+--------------------------------------------------------------------
*+
FUNCTION CreateRoundRectRgn( nLeftRect, nTopRect, nRightRect, nBottomRect, x, y )
LOCAL lRet
lRet := DllCall( "GDI32.DLL", DLL_OSAPI, "CreateRoundRectRgn", nLeftRect, nTopRect, nRightRect, nBottomRect, x, y )
RETURN lRet
*+--------------------------------------------------------------------
*+
*+ Function SetWindowRgn()
*+
*+ Called from ( fwdwm.prg ) 1 - procedure main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION SetWindowRgn( Hwnd, lhRgn, lRedraw )
LOCAL lRet
DEFAULT lRedraw TO .T.
lRet := DllCall( "USER32.DLL", DLL_OSAPI, "SetWindowRgn", Hwnd, lhRgn, lRedraw )
RETURN lRet
//
//
//
*+ EOF: FWDWM.PRG