How do I get some information about the machine my program runs on?

This is a discussion on How do I get some information about the machine my program runs on? within the C++ Programming forums, part of the General Programming Boards category; Is there an easy way, using the standard libraries or win32 api to get basic system information, for example, the ...

  1. #1
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195

    How do I get some information about the machine my program runs on?

    Is there an easy way, using the standard libraries or win32 api to get basic system information, for example, the CPU speed, the graphics card capabilities, the amount of ram and the screen refresh rate?

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    the graphics capabilites can all eb gotten through DirectX using GetDevCaps(), the CPU speed im not so sure of, i know there is a way, sicne windows and othe raplications do it, but im nto sure what api they use.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You almost certainly will have to use different API's for each of those types of information.

    Some of it can be found here:
    GetSystemInfo
    http://msdn.microsoft.com/en-us/libr...81(VS.85).aspx
    SYSTEM_INFO struct.
    http://msdn.microsoft.com/en-us/libr...58(VS.85).aspx

    GetDeviceCaps
    http://msdn.microsoft.com/en-us/libr...66(VS.85).aspx

    That will probably give you MOST of the info you where asking for.

    To get the name of the processor, you can use CPUID to get the name string from the processor. I'm not sure if Windows supplies an interface to do that - but it's easily done in a little bit of inline assembler.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can also look at WMI:
    http://msdn.microsoft.com/en-us/library/aa394373.aspx

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. Program runs choppy
    By Smartiepants586 in forum C Programming
    Replies: 11
    Last Post: 06-22-2005, 04:57 AM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 06:27 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21