Link to home
Start Free TrialLog in
Avatar of danielsson
danielssonFlag for Germany

asked on

Programmatically setting/checking video hardware acceleration level on Windows 2000/XP

I have the following problem: I want to be able to check and set the video hardware acceleration level (graphics acceleration) under Windows 2000 and Windows XP. Windows 95/98/ME/NT are not an issue (see solution by 'glim').

Does anybody know how to accomplish this *programmatically*, preferrably in VC++ 6.0. I have tried observing the changes in the registry, but I can't figure out the correct things to change to make it work each time and on arbitrary graphics adapters.
Avatar of danielsson
danielsson
Flag of Germany image

ASKER

I found a solution myself. Anyone interested?
Avatar of DanRollins
Yes.  Please post your solution (that will improve the EE "PAQ" database), then request a refund.  Info on closing questions is here:
    http://www.apollois.com/EE/Help/Closing_Questions.htm#Refund
-- Dan
A solution can be found here:

https://www.experts-exchange.com/questions/20563401/Programmatically-setting-checking-video-hardware-acceleration-level-on-Windows-2000-XP.html

How can I find the PAQs? Or do I have to be a paying member to view those?
You just need to register.  There should be a link in the top right corner near the search button.  Also many questions are indexed by google.  This link pre-sets google to search just the EE site:

    http://www.google.com/advanced_search?&as_sitesearch=experts-exchange.com

-- Dan
Now for the solution I spoke of. I'm sorry that I'm not yet used to the EE customs here... :)

I have tested the solution to work on Windows 2000 with a Matrox G450 DH and on Windows XP with some ATI graphics adapter. No warranty, but it looks like it is a general solution for XP/2K.

It works as follows:

(1) Find out the position of the current video device, information on this may be found in the registry, here:
   \\HKLM\HARDWARE\DEVICEMAP\VIDEO\Device\Video0
   There you will find a LPSTR type of entry, pointing to a registry key for the current video device, e.g.
   "\Registry\Machine\System\ControlSet001\Services\G400\Device0"
(2) Parse that string, replacing "\Registry\Machine" with HKLM (HKEY_LOCAL_MACHINE) and open the corresponding registry key,
(3) Look for a DWORD value "Acceleration.Level". If the value does not exists, hardware acceleration is set to "Full". Otherwise, "Acceleration.Level" may be one of 0x1 to 0x5, 0x5 meaning "No Acceleration", and 0x1 meaning "All but cursor acceleration" (see "Extended Display Settings").
(4) Set the desired acceleration level, or delete the entry to set "Full" acceleration mode.
(5) Let Windows reload the display settings by using the following code:

  DEVMODE devMode;
  BOOL success = ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
  if (success == TRUE)
  {
     LONG result = ::ChangeDisplaySettings(&devMode, CDS_RESET);
     printf("ChangeDisplaySettings() returned: %d\n", result);
  }

  First, the current display settings are loaded into the devMode variable, and then, the displayed is forced to perform a reset; at this occasion, the "Acceleration.Level" value is read out from the registry and the new acceleration level is set.

Enjoy, have fun, or do whatever you want to... :-)
ASKER CERTIFIED SOLUTION
Avatar of Mindphaser
Mindphaser

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial