hmg
Code: Select all
#define DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 19
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
Proc main
DEFINE WINDOW Form1
...
END WINDOW
// Do nothing
// Wrong API call used :-/
DwmSetWindowAttribute( GetFormHandle( 'Form1' ), DWMWA_USE_IMMERSIVE_DARK_MODE, .T., 0 )
Form1.Activate()
Code: Select all
#include <windows.h>
#include <shellapi.h>
#include <Uxtheme.h>
#include "hbapi.h"
VOID *hDWMAPI = NULL;
typedef HRESULT (WINAPI * func_DwmSetWindowAttribute) (HWND, HB_INT dwAttribute, HB_BOOL pvAttribute, HB_INT cbAttribute);
BOOL HMG_DWMAPI ()
{
if (hDWMAPI == NULL)
hDWMAPI = LoadLibrary( "Dwmapi.dll");
if (hDWMAPI)
return TRUE;
else
return FALSE;
}
// DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE dwAttribute, ref int pvAttribute, int cbAttribute);
HB_FUNC ( DWMSETWINDOWATTRIBUTE )
{
HWND hWnd = (HWND) hb_parnl (1);
HRESULT nRet = ( HRESULT ) NULL;
if (hWnd == NULL) hWnd = GetActiveWindow();
if( HMG_DWMAPI() )
{
func_DwmSetWindowAttribute pDwmSetWindowAttribute = ( func_DwmSetWindowAttribute ) GetProcAddress( hDWMAPI, "DwmSetWindowAttribute" );
if( pDwmSetWindowAttribute )
nRet = ( HRESULT ) pDwmSetWindowAttribute( hWnd, hb_parnl(2), hb_parnl(3), sizeof( hb_parnl(3) ) );
FreeLibrary( hDWMAPI );
}
hb_retl( ( nRet == S_OK ) );
}
https://stackoverflow.com/questions/571 ... windows-10
Thanks for help,
Regards
