Page 2 of 2

Re: Aero effect

Posted: Wed Dec 18, 2013 9:31 pm
by meneale
I reviewed this and saw that if you change backcolor to black, without use SET WINDOW <window> TRANSPARENT TO....
You get a better visual result because all colors near to black will get diferent opacity

Code: Select all

#include "hmg.ch"

Function Main

   DEFINE WINDOW Form_1; 
      AT 0,0; 
      WIDTH 400; 
      HEIGHT 400 ;
      TITLE 'Minimum: Windows Vista';
	  BACKCOLOR {0,0,0};
      MAIN

      @ 150,150 BUTTON Button_1 CAPTION "Set 2" ACTION DwmExtendFrameIntoClientArea (Form_1.HANDLE, -1, 0, 0, 0)

   END WINDOW

// DwmExtendFrameIntoClientArea ( hWnd,          cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight)
   DwmExtendFrameIntoClientArea ( Form_1.HANDLE,          50,           50,         50,            50)

   CENTER WINDOW Form_1
   ACTIVATE WINDOW Form_1
Return Nil



#pragma BEGINDUMP

#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"


#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <Uxtheme.h>
#include "hbapi.h"


VOID *hDWMAPI = NULL;
typedef HRESULT (WINAPI * func_DwmExtendFrameIntoClientArea) (HWND, const MARGINS *);

BOOL HMG_DWMAPI ()
{
   if (hDWMAPI == NULL)
       hDWMAPI = LoadLibrary( _TEXT("Dwmapi.dll") );
   if (hDWMAPI)
      return TRUE;
   else
      return FALSE;
}

//        DwmExtendFrameIntoClientArea (hWnd, cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight)
HB_FUNC ( DWMEXTENDFRAMEINTOCLIENTAREA )
{
   HWND    hWnd = (HWND) hb_parnl (1);
   HRESULT nRet = ( HRESULT ) NULL;
   MARGINS MarInset;
   
   MarInset.cxLeftWidth    = (int) hb_parnl (2);
   MarInset.cxRightWidth   = (int) hb_parnl (3);
   MarInset.cyTopHeight    = (int) hb_parnl (4);
   MarInset.cyBottomHeight = (int) hb_parnl (5);
   
   if( HMG_DWMAPI() )
   {
      func_DwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = ( func_DwmExtendFrameIntoClientArea ) GetProcAddress( hDWMAPI, "DwmExtendFrameIntoClientArea" );
      if( pDwmExtendFrameIntoClientArea )
         nRet = ( HRESULT ) pDwmExtendFrameIntoClientArea ( hWnd, &MarInset );
   }
   hb_retl( ( nRet == S_OK ) );
} 

#pragma ENDDUMP

Re: Aero effect

Posted: Mon Dec 23, 2013 5:41 am
by Rathinagiri
It looks very nice.

My question is, will it anyway affect the speed of our application?

Re: Aero effect

Posted: Tue Dec 24, 2013 1:39 pm
by meneale
Hello Rathinagiri,
I've been creating projets with this function and so far there has been no decrease in performance of the program, especially because this function is from Desktop Window Manager (DWM) :P
The only problem until now, is with transparency and pictures :|, because all colors near black turns into transparent when placed up to window frame