Thread: How to retrieve video hardware info

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    3

    How to retrieve video hardware info

    Hello, I was hoping that someone could help me with a problem I have. How can I retrieve the size of the total local video memory? I can't seem to find any api calls that do it. The directX calls I found return the local + nonlocal memory. Where does windows get this information from? When you go to display properties/settings/advanced/adapter, it tells you the memory size and vendor, that's exactly what I need to do. Any help is appreciated tremendously. Thanks.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Windows actually pulls all of that info out of the registers. I was just looking at the registers and found info about my video card but no where does it list how much vram that I have. Did you already look through msdn? If not its worth a try.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Look up the Win32 Registry functions such as RegQueryValueEx().
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Look up the Win32 Registry functions such as RegQueryValueEx().
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  5. #5
    Registered User
    Join Date
    Jul 2002
    Posts
    3
    Thanks for the suggestions, but I still couldn't get the video memory from the registry. Also, from what master5001 said, I couldn't depend on that information being in the registry. I had already searched MSDN, but never found anything. Any other ideas?

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    It seems to me that the dx diagnostic tool determines the amount of video memory by filling it, and seeing how much memory it filled. Maybe you could do something like that.

  7. #7
    Registered User
    Join Date
    Aug 2001
    Posts
    223

    USING MFC

    Try this

    Code:
    MEMORYSTATUS mem_stat;
    
    GlobalMemoryStatus( &mem_stat );
    
    /*
    typedef struct _MEMORYSTATUS { // mst 
        DWORD dwLength;        // sizeof(MEMORYSTATUS) 
        DWORD dwMemoryLoad;    // percent of memory in use 
        DWORD dwTotalPhys;     // bytes of physical memory 
        DWORD dwAvailPhys;     // free physical memory bytes 
        DWORD dwTotalPageFile; // bytes of paging file 
        DWORD dwAvailPageFile; // free bytes of paging file 
        DWORD dwTotalVirtual;  // user bytes of address space 
        DWORD dwAvailVirtual;  // free user bytes 
    } MEMORYSTATUS, *LPMEMORYSTATUS; 
    */
    zMan

  8. #8
    Registered User
    Join Date
    Aug 2001
    Posts
    223
    remember to divide by 1024 to get them in Kilobytes...
    zMan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting Video Card info without WMI or DirectX
    By Mastadex in forum Windows Programming
    Replies: 4
    Last Post: 04-03-2008, 07:13 AM
  2. Problem With My Box
    By HaVoX in forum Tech Board
    Replies: 9
    Last Post: 10-15-2005, 07:38 AM
  3. Help doing an e-mail program in c...
    By Tyler_Durden in forum C Programming
    Replies: 88
    Last Post: 01-02-2005, 03:12 PM
  4. retrieve computer info
    By C_B in forum Windows Programming
    Replies: 2
    Last Post: 10-02-2003, 05:21 AM
  5. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM