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.
LVL 2
danielssonAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MindphaserConnect With a Mentor Commented:
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0
 
danielssonAuthor Commented:
I found a solution myself. Anyone interested?
0
 
DanRollinsCommented:
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
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
danielssonAuthor Commented:
A solution can be found here:

http://www.experts-exchange.com/Community_Support/Q_20563401.html

How can I find the PAQs? Or do I have to be a paying member to view those?
0
 
DanRollinsCommented:
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
0
 
danielssonAuthor Commented:
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... :-)
0
All Courses

From novice to tech pro — start learning today.