Friday, October 2, 2009

How to change nVidia GeForce desktop settings with shortcut or hot key (or, how to substitute the now gone "Custom Color Settings")

Note for Vista/Windows 7 users: I see on the Net that nVidia changed or discontinued the "NvCpl.dll,dtcfg" API after XP. I didn't have the chance to look into it so far (no Vista around, etc.). The workaround described here is possibly for Windows XP only.

Sometimes you need to change contrast/brightness/gamma, or change other settings (rotate, resolution, refresh rate, etc.) often, or to a specific value that you tend to forget. The nVidia control panel is not very helpful in this right now, to say the least. Actually, it just become worse during time... like, earlier you had a "Custom Color Settings" under the nVidia Settings tray icon where you could immediately chose profile. (I also have a distant memory of hot keys, but I'm not sure.) In the recent ForceWare releases this feature is gone (on XP at least), which is a real pain for some. Surely you can create profiles (I'm not talking about the profiles for games here), but activating them is needlessly painful... digging through menus and confirmations, etc. I can't understand for my life why nVidia can't provide some quick way to access them (like hot keys). Anyway... what to do?

Let's say you often need to set brightness to 50%, contrast to 50%, and gamma to 1.2, all this at once (like a profile). Then create a file with bat extension (e.g. myporfile.bat) and with this content:

@echo off

rem  SET BRIGHTNESS:
rem  -125 means 0%, 0 means 50%, 125 means 100%. Integers only!
rundll32.exe NvCpl.dll,dtcfg setbrightness 1 all 0

rem  SET CONTRAST:
rem  -82 means 0%, 0 means 50%, 82 means 100%. Integers only!
rundll32.exe NvCpl.dll,dtcfg setcontrast 1 all 0

rem  SET GAMMA:
rem  Just use the same value as in the control panel.
rundll32.exe NvCpl.dll,dtcfg setgamma 1 all 1.2

Running this bat file will set up the monitor accordingly (at least here... XP, 7300GS and 7600GS). Of course, you can create more such bat files, each corresponds to a "profile". Also, there are many more commands that you could use, like rotating (e.g. rundll32.exe nvcpl.dll,dtcfg rotate 1 90, which rotates with 90 counter-clockwise) or setting resolution (e.g. rundll32.exe NvCpl.dll,dtcfg setmode 1 1280 1024 32 60, means 1024x768, 32 bit color, 60 Hz refresh rate) and so on. Google for nvcpl.dll dtcfg, and you should find the "NVCPL.DLL API Manual", that has a chapter about them.

Some random notes:

  • Just like the nVidia control panel, the above will adjust your video card, not your monitor. In principle, you should set the contrast/brightness/gamma on the monitor instead. But in reality it's not always desirable or possible. Like, most monitors have no gamma setting.

  • The above bat assumes that you adjust display #1; If you want to adjust on a secondary display (the 2nd monitor attached), use 2-s instead of the 1-s above.

  • the all in the bat meant "set all channels". You could also use red, green or blue instead.

  • The rem lines are just comments, they are ignored.

  • For those who are bad in math, an example: to set brightness to 33%, the value is ((125 * 2 / 100) * 33) - 125 = -42.5, so use -42 or -43. The formula is the same for the contrast, but there use 82 instead of 125.

For easily running the bat files there are several tricks:

  • First and most obviously, you can create shortcuts to them on the desktop or in the start menu.

  • Furthermore, shortcuts can have hot keys associated (right click, properties, and there you will find it). As far as I remember, hot keys work only if the shortcuts are in the start menu or on the desktop, and even then you possibly need to restart so explorer will re-read them.

  • A less known Windows trick: If you collect the bat-s into a folder, at least on XP, you can drag-and-drop the folder to the area just left to the notification area (the notification area is where the clock and the speaker icon used to be), and that will create a drop-down menu from which you can chose the bat to run.

  • Last not least I'm sure there are plenty of utilities available for quickly starting programs (and bat-s are programs) on various ways, like even with a remote.