Log in

View Full Version : SOLVED:- XP Screen color inversion


StainlessS
21st March 2015, 09:38
Anyone know how to get screen color inversion on XP ?
I sometimes use computer for extended periods and especially when using reading glasses, find myself 'snow blind' for several days. It would be nice if I could change to eg white text on black in web pages and compiler IDE at the flick of a switch.

I've tried the accessories Utility Manager stuff but that is rubbish, and when undone can leave everything 'out of whack', ie fonts stuck at wrong size and weird borders, ended up re-installing my m/c last time I tried that.

I know that W7 has facility to do this (dont need advice to change OS), but XP lacks anything suitable as far as I know.
You can change GammaRamp, but that is not really what I want.
On W7 there is a (EDIT: Shareware) util called PowerStrip but that only works for some video cards.

I have recently found an AutoIt script which I'm using to control GammaRamp [TinyBrightnessControl (https://www.google.co.uk/?gws_rd=ssl#q=tiny+brightness+control+autoit)]
and have tried modding to invert colors but there seems to be some kind of check on validity which dont like the inversion, and it does nothing.

Any suggestions ?

EDIT: Here some CPP source from NirSoft, Changing the screen brightness programmingly:-
http://www.nirsoft.net/vc/change_screen_brightness.html

GMJCZP
21st March 2015, 14:36
Investigate here:

Here (http://windows.microsoft.com/en-us/windows/xp-downloads#2TC=powertoys)
Power Toys does many things.

And Here (download.microsoft.com/download/f/c/a/fca6767b-9ed9-45a6-b352-839afb2a2679/TweakUiPowertoySetup.exe).
" TweakUI: Amp up Windows XP with a PowerToy that changes the default user interface. For advanced computer users only."

Perhaps an advanced user of files.reg can do something about it.

StainlessS
22nd March 2015, 03:15
GMJCZP, thanks for the links, downloaded pretty much anything I found and was working my way through them.
Had almost given up hope when I found a web page with a reg hack which had only been tried on W7.
I tried the hack without much expectation, and it did not work, as an afterthough I tried a reboot and again
retried a hacked version of the Nirsoft CPP code (link posted above), to my surprise, IT WORKED !
So, I'm gonna see if I can knock up a mod of the AutoIt TinyBrightnesscontrol to invert GammaRamp, should be able to get it to work.

Anyways, here is the fix

UnlockGammaRange.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM]
"GdiIcmGammaRange"=dword:00000100


From this link here: http://jonls.dk/2010/09/windows-gamma-adjustments/
which is an 'aside page' of the page: http://jonls.dk/redshift/

and the CPP hack of Nirsoft code, SetBrightness function, hack in blue

BOOL CGammaRamp::SetBrightness(HDC hDC, WORD wBrightness)
{
/*
Changes the brightness of the entire screen.
This function may not work properly in some video cards.

The wBrightness value should be a number between 0 and 255.
128 = Regular brightness
above 128 = brighter
below 128 = darker

If hDC is NULL, SetBrightness automatically load and release
the display device context for you.

*/
BOOL bReturn = FALSE;
HDC hGammaDC = hDC;

//Load the display device context of the entire screen if hDC is NULL.
if (hDC == NULL)
hGammaDC = GetDC(NULL);

if (hGammaDC != NULL)
{
//Generate the 256-colors array for the specified wBrightness value.
WORD GammaArray[3][256];

for (int iIndex = 0; iIndex < 256; iIndex++)
{
int iArrayValue = (255-iIndex)<<8;
// int iArrayValue = iIndex * (wBrightness + 128);

if (iArrayValue > 65535)
iArrayValue = 65535;

GammaArray[0][iIndex] =
GammaArray[1][iIndex] =
GammaArray[2][iIndex] = (WORD)iArrayValue;

}

//Set the GammaArray values into the display device context.
bReturn = SetDeviceGammaRamp(hGammaDC, GammaArray);
}

if (hDC == NULL)
ReleaseDC(NULL, hGammaDC);

return bReturn;
}


Again thanks :)

EDIT: Above Nirsoft CPP hack will ONLY invert, will not restore original settings, BEWARE !!! (Reboot will restore OK)

EDIT: To delete the ICM Gamma Unlock value inserted into the registry by earlier .reg file

LockGammaRange.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM]
"GdiIcmGammaRange"=-

GMJCZP
22nd March 2015, 03:28
I suspected it had something to do with the registry. This solution and as knowledge of PowerToys for XP should be useful for everyone.

StainlessS
22nd March 2015, 03:53
Just posted a request for screen invert util on NirSoft site (http://www.nirsoft.net), I'm sure he will do a better job of it than I. :)

StainlessS
22nd March 2015, 22:58
ScreenInverterXP-Readme.txt

ScreenInverterXP

Original thread, here:- http://forum.doom9.org/showthread.php?t=171949

Registry unlock/lock .reg scripts sourced from here:- http://jonls.dk/2010/09/windows-gamma-adjustments/

CPP code (slightly modified) to create Screen-Invert.exe/Screen-Restore.exe:- http://www.nirsoft.net/vc/change_screen_brightness.html


Two .exe files,
Screen-Invert.exe, Does photo-negative invert on screen. perhaps easier on the eyes at night.
Screen-Restore.exe, Restore back to normal.

Before you can use Screen-Invert.exe, need to run UnlockGammaRange.reg registry editing script otherwise it dont work.
May not work on all graphics cards, depends if GammRamp settings are supported by card.
Will require reboot after running registry editing scripts. EDIT: Probably need run as Admin.


To delete the registry setting and restore as before running UnlockGammaRange.reg, run LockGammaRange.reg.



As well as adding the GammaRamp.SetInvert() function to Brightness.cpp, we also modified main.cpp

To create (before renaming to) Screen-Invert.exe we used
>>>>>>>>>>>>>>>>>>>>>>>>>
#include <windows.h>
#include "gammaramp.h"

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
) {
CGammaRamp GammaRamp;
GammaRamp.SetInvert(NULL);
Sleep(1000); // wait a while till done
return 0;
}
<<<<<<<<<<<<<<<<<<<<<<<<<


And To create (before renaming to) Screen-Restore.exe we used
>>>>>>>>>>>>>>>>>>>>>>>>>
#include <windows.h>
#include "gammaramp.h"

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
) {
CGammaRamp GammaRamp;
GammaRamp.SetBrightness(NULL, 128); //Return back to normal:
Sleep(1000); // wait a while till done
return 0;
}
<<<<<<<<<<<<<<<<<<<<<<<<<

I'm putting both of mine on hot-keys.

StainlessS


Couple of small binaries and source in sig @MediaFire (below this post) in the UTILITY Folder.

GMJCZP
23rd March 2015, 13:12
We conclude that there is finally white smoke in this topic. Thank You StainlessS.

StainlessS
23rd March 2015, 19:27
Yep thanx, white smoke. I'm still hoping that Nir Sofer (NirSoft) will do a utility but consider problem solved either way. :)

wonkey_monkey
23rd March 2015, 20:59
We conclude that there is finally white smoke in this topic.

Given the topic itself, wouldn't it be black smoke?

StainlessS
24th March 2015, 17:43
Nope, white smoke (it just looks black).

By the way, I downloaded the RedShift (night vision) thing mentioned in earlier post, comes up as 'not a valid executable' or words to that effect,
so dont bother with it.