It is currently Sun Mar 07, 2021 9:56 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Get high contrast mode for colors
PostPosted: Sun Sep 20, 2020 12:43 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 779
Location: Okazaki, JAPAN
I tried to check the contrast settings in Windows 10,
as using the API to check the contrast settings feels bad.

My software users are aging and some are in their 70s and older,
so I'm looking for setup high contrast screens.

Code:
Procedure.i GetHighContrastMode()
  ; Windows 10
  Protected GetColor.i, Result.i
  GetColor = GetSysColor_(#COLOR_HOTLIGHT)
  Select GetColor
      ; Case 13395456
      ; result = 0
    Case 65535, 16744576, 10420224
      Result + 1
  EndSelect
  GetColor = GetSysColor_(#COLOR_MENUHILIGHT)
  Select GetColor
      ;Case 14120960
      ; result = 0
    Case 0, 32768, 8388736, 16711680
      Result + 1
  EndSelect
  ProcedureReturn Result
EndProcedure

Debug GetHighContrastMode()
CallDebugger


Top
 Profile  
Reply with quote  
 Post subject: Re: Get high contrast mode for colors
PostPosted: Sun Sep 20, 2020 12:54 am 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 1334
Code:
Case 65535, 16744576, 10420224

You can't check hard-coded values like that, because the results of GetSysColor_() can be different for different people. This is because high contrast mode can be personalised by the user (#COLOR_HOTLIGHT and #COLOR_MENUHILIGHT on your PC will be different to mine).


Top
 Profile  
Reply with quote  
 Post subject: Re: Get high contrast mode for colors
PostPosted: Sun Sep 20, 2020 6:11 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 779
Location: Okazaki, JAPAN
I see.

Code:
Procedure.b GetHighContrast()
  Structure HIGHCONTRAST
    cbsize.l
    dwFlags.l
    *lpszDefaultScheme
  EndStructure
 
  HC.HIGHCONTRAST
  SystemParametersInfo_(#SPI_GETHIGHCONTRAST, SizeOf(HIGHCONTRAST), @HC, 0)
  If HC\dwFlags & $2
    ProcedureReturn #True
  EndIf
EndProcedure

Debug GetHighContrast() ; can not get


Just another tips, do you know?


Top
 Profile  
Reply with quote  
 Post subject: Re: Get high contrast mode for colors
PostPosted: Sun Sep 20, 2020 7:36 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3888
Windows 10 HIGHCONTRAST ON/OFF
Code:
#HCF_HIGHCONTRASTOFF = $00000000
#HCF_HIGHCONTRASTON = $00000001
#SPIF_SENDCHANGE = $2

Structure HIGHCONTRAST
  cbSize.l
  dwFlags.i
  *lpszDefaultScheme
EndStructure

hc.HIGHCONTRAST
hc\cbSize = SizeOf(hc)
hc\dwFlags = #HCF_HIGHCONTRASTON ;Use #HCF_HIGHCONTRASTOFF for off
SystemParametersInfo_(#SPI_SETHIGHCONTRAST, 0, @hc, #SPIF_SENDCHANGE)

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Get high contrast mode for colors
PostPosted: Sun Sep 20, 2020 10:57 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 779
Location: Okazaki, JAPAN
RASHAD wrote:
Windows 10 HIGHCONTRAST ON/OFF


This corner is Windows 9x OS only. :(
SPI_SETHIGHCONTRAST, SPI_GETHIGHCONTRAST

I will write at documents 'Let's use manual switching.'


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye