Mister Nages, in time: when changing the window color, this has a side effect in other applications. For example: the google chrome page is completely black. Its power is incredible, Mister Nages. See if you can avoid this by closing the program window, perhaps keeping the original colors and restoring on exit. Just an idea.
Regards, saludos.
Dark mode
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: Dark mode
Which version of Windows are you using?
You need not include individual COLOR_* defines in your program. Just include "wcolors.ch", which contains all these defines.
Assign your colors to COLOR_ACTIVECAPTION, COLOR_INACTIVECAPTION, COLOR_CAPTIONTEXT, COLOR_INACTIVECAPTIONTEXT.
Please note that these changes will work only with Windows XP to 8.1.
This does not work with Windows 10 and later.
So, if you write your applications to be used only on older OS like Windows XP to Windows 8.1, then you can use "SetSysColors" to set your own theme, Dark or something else. Your applications will not get the desired effect on Windows 10 and later.
The point I am trying to make is that if you read any articles or advices to use SetSysColors() to implement DarkTheme, they are all old and obsolete. If we proceed in this direction, we are only wasting our time.
You need not include individual COLOR_* defines in your program. Just include "wcolors.ch", which contains all these defines.
Now I need to Change the WINDOW TITLE COLOR. Where it is written:
Assign your colors to COLOR_ACTIVECAPTION, COLOR_INACTIVECAPTION, COLOR_CAPTIONTEXT, COLOR_INACTIVECAPTIONTEXT.
Please note that these changes will work only with Windows XP to 8.1.
This does not work with Windows 10 and later.
So, if you write your applications to be used only on older OS like Windows XP to Windows 8.1, then you can use "SetSysColors" to set your own theme, Dark or something else. Your applications will not get the desired effect on Windows 10 and later.
The point I am trying to make is that if you read any articles or advices to use SetSysColors() to implement DarkTheme, they are all old and obsolete. If we proceed in this direction, we are only wasting our time.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Dark mode
hi,
Color for Titlebar under Windows 10 /11 now called "Accent-Color"
you reach it under "personize" -> "Color"
you also need to enable Color for "Titlebar & Frame"
in Registry you will find it under
---
you can GetSysColor() and save Value before use SetSysColor()
i do load Information like Color from DBF or INI File at Start
Color for Titlebar under Windows 10 /11 now called "Accent-Color"
you reach it under "personize" -> "Color"
you also need to enable Color for "Titlebar & Frame"
in Registry you will find it under
Code: Select all | Expand
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM
AccentColor
---
you can GetSysColor() and save Value before use SetSysColor()
i do load Information like Color from DBF or INI File at Start
greeting,
Jimmy
Jimmy
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: Dark mode
you also need to enable Color for "Titlebar & Frame"
how can we do this?
For Windows 10 we need to know how to set these colors
COLOR_ACTIVECAPTION, COLOR_INACTIVECAPTION, COLOR_CAPTIONTEXT, COLOR_INACTIVECAPTIONTEXT, COLOR_SCROLLBAR
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- karinha
- Posts: 7951
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Dark mode
I give up. This is very complicated and may cause me a problem with customers. Even so, very obliging Mister Nages.
Regards, saludos.
Code: Select all | Expand
// \samples\DARKMODE.PRG - 17/11/2021 - Joao. Windows 7 32 Bits.
#Include "FiveWin.ch"
#Include "wColors.ch"
STATIC oWnd
FUNCTION Main()
LOCAL oBar, cTitle, nRet
cTitle := "RODRIGUES & AMORIM MECANICA LTDA" // WHITE NO FUNCIONA.
DEFINE WINDOW oWnd TITLE cTitle // MDI ?? NO FUNCIONA NORMAL.
DEFINE BUTTONBAR oBar _3D OF oWnd
DEFINE BUTTON OF oBar ACTION( Finaliza() )
SET MESSAGE OF oWnd TO cTitle NOINSET CLOCK DATE KEYBOARD
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT( SetSysColors( { COLOR_ACTIVECAPTION, COLOR_INACTIVECAPTION }, ;
{ COLOR_CAPTIONTEXT, COLOR_INACTIVECAPTIONTEXT } ) )
RETURN NIL
FUNCTION Finaliza()
oWnd:End()
RETURN NIL
#IFDEF __XHARBOUR__ // Modificado em: 16/11/2021 - Joao
// if xHarbour -> Nages:
// For xHarbour change hb_parvni as hb_parni and hb_parvnl as hb_parnl
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC( SETSYSCOLORS ) // ( aItems, aColors ) --> lSuccess
{
BOOL bRet = FALSE;
int iElements;
INT aElements[22];
COLORREF aRgbValues[22];
if ( ( iElements = hb_parinfa( 1, 0 ) ) == ( int ) hb_parinfa( 2, 0 ) )
{
int i;
for ( i = 1; i <= iElements; i++ )
{
aElements [ i - 1 ] = hb_parni( 1, i );
aRgbValues[ i - 1 ] = hb_parnl( 2, i );
bRet = SetSysColors( iElements, aElements, aRgbValues );
}
}
hb_retl( bRet );
}
#pragma ENDDUMP
#ELSE
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
// if harbour
HB_FUNC( SETSYSCOLORS ) // ( aItems, aColors ) --> lSuccess
{
BOOL bRet = FALSE;
int iElements;
INT aElements[22];
COLORREF aRgbValues[22];
if ( ( iElements = hb_parinfa( 1, 0 ) ) == ( int ) hb_parinfa( 2, 0 ) )
{
int i;
for ( i = 1; i <= iElements; i++ )
{
aElements [ i - 1 ] = hb_parvni( 1, i );
aRgbValues[ i - 1 ] = hb_parvnl( 2, i );
bRet = SetSysColors( iElements, aElements, aRgbValues );
}
}
hb_retl( bRet );
}
#pragma ENDDUMP
#ENDIF
// FIN / END
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: Dark mode
I give up. This is very complicated and may cause me a problem with customers. Even so, very obliging Mister Nages.
Yes.
I too would not use this approach in my applications.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India