Aero effect

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
meneale
Posts: 51
Joined: Sat Jan 12, 2013 2:05 am
Location: Campinas -SP, Brasil

Re: Aero effect

Post by meneale » Wed Dec 18, 2013 9:31 pm

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
AMD Phenom II X6 1090T 3.2GHz (OverClock 3.9GHz) | Windows 8.1 Pro 64-bit
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35

User avatar
Rathinagiri
Posts: 5173
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 136 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Mon Dec 23, 2013 5:41 am

It looks very nice.

My question is, will it anyway affect the speed of our application?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
meneale
Posts: 51
Joined: Sat Jan 12, 2013 2:05 am
Location: Campinas -SP, Brasil

Post by meneale » Tue Dec 24, 2013 1:39 pm

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
Attachments
dwmextendinto.png
dwmextendinto.png (126.18 KiB) Viewed 492 times
AMD Phenom II X6 1090T 3.2GHz (OverClock 3.9GHz) | Windows 8.1 Pro 64-bit
4GB DDR3 | GTX 550 Ti 1GB | MSI 880GMA-E35

Post Reply