VC 怎么获取到内存信息,内存的参数

VC 如何获取到内存信息,内存的参数!
C/C++ code
    
DIMM 3:    金士顿 DDR3 1333MHz 4GB
制造日期    2011 年 07 月
型号    7F98 99P5471-004.A01LF
序列号:    7A841636



这个是鲁大师获取的内存信息。。

请问编程如何才能实现 ,获取这些信息!!!

鲁大师又是怎么获取的哪??

还有其它的硬件信息,都是怎么获取的??真心请教大牛们!

------解决方案--------------------
Win32_PhysicalMemory

------解决方案--------------------
http://msdn.microsoft.com/en-us/library/Aa394349
------解决方案--------------------
参考
C/C++ code
bool CHardwareInfoDlg::GetProcessorInfo()
{
    SYSTEM_INFO sysInfo;
    char str [MAX_PATH];

    // Get the hardware information

    GetSystemInfo (&sysInfo);

    // Lets check the processor type first

    if (sysInfo.dwProcessorType  == PROCESSOR_INTEL_386) {
        m_stProcessorType = _T ("Intel 386");
    }
    else if (sysInfo.dwProcessorType  == PROCESSOR_INTEL_486) {
        m_stProcessorType = _T ("Intel 486");
    }
    else if (sysInfo.dwProcessorType  == PROCESSOR_INTEL_PENTIUM) {
        m_stProcessorType = _T ("Intel Pentium");
    }
    else if (sysInfo.dwProcessorType  == PROCESSOR_MIPS_R4000) {
        // only for NT
        m_stProcessorType = _T ("MIPS");
    }
    else if (sysInfo.dwProcessorType  == PROCESSOR_ALPHA_21064) {
        // only for NT
        m_stProcessorType = _T ("Alpha");
    }
    else {
        m_stProcessorType = _T ("Unknown");
    }

    // check number of processors

    itoa (sysInfo.dwNumberOfProcessors , str, 10);

    m_stNumProcessors = CString (str);

    // Check the architecture type and processor level

    // Windows 95 doesn't use processor level

    if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) {
        m_stArchitecture = _T ("Pentium");
        switch (sysInfo.wProcessorLevel) {
            case 3:
                m_stProcessorLevel = _T ("Intel 80386");
                break;
            case 4:
                m_stProcessorLevel = _T ("Intel 80486");
                break;
            case 5:
                m_stProcessorLevel = _T ("Pentium");
                // Check if the MMX instruction set is availbale or not.

                if (IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE)) {
                    m_stProcessorLevel += _T (" MMX");
                }
                break;
            case 6:
                m_stProcessorLevel = _T ("Pentium (II/Pro)");
                break;
        }
    }
    else if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_MIPS) {
        m_stArchitecture = _T ("MIPS");
        if (sysInfo.wProcessorLevel == 0004) {
            m_stProcessorLevel = _T ("MIPS R4000");
        }
        else {
            m_stProcessorLevel = _T ("Unknown");
        }
    }
    else if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ALPHA) {
        m_stArchitecture = _T ("Alpha");

        itoa (sysInfo.wProcessorLevel , str, 10);

        m_stProcessorLevel = m_stArchitecture + CString (str);
    }
    else if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_PPC) {
        m_stArchitecture = _T ("PPC");

        switch (sysInfo.wProcessorLevel) {
            case 1:
                m_stProcessorLevel = _T ("PPC 601");
                break;
            case 3:
                m_stProcessorLevel = _T ("PPC 603");
                break;
            case 4:
                m_stProcessorLevel = _T ("PPC 604");
                break;
            case 6:
                m_stProcessorLevel = _T ("PPC 603+");
                break;
            case 9:
                m_stProcessorLevel = _T ("PPC 604+");
                break;
            case 20:
                m_stProcessorLevel = _T ("PPC 620");
                break;
        }
    }
    else if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_UNKNOWN) {
        m_stArchitecture = _T ("Unknown");
    }


    // Check page size

    itoa (sysInfo.dwPageSize , str, 10);
    m_stPageSize = CString (str);

    // Application address

    TCHAR buffer [64];

    sprintf( buffer, "%p", sysInfo.lpMaximumApplicationAddress);

    m_stMaxAddress = _T ("0x") + CString (buffer);
    
    sprintf( buffer, "%p", sysInfo.lpMinimumApplicationAddress);

    m_stMinAdress = _T ("0x") + CString (buffer);

    // Get active processor mask
    // It represent how many processors are active (?? I am not sure)

    itoa (sysInfo.dwActiveProcessorMask , str, 10);
    m_stMask = CString (str);

    UpdateData (FALSE);

    return (true);
}

void CHardwareInfoDlg::GetMemory()
{
    CString memstr;
    ::GlobalMemoryStatus(&mem);
    memstr.Format("%d %s",mem.dwTotalPhys/(1024*1024),"M");
    m_memstr=memstr;
    UpdateData(FALSE);
}

bool CHardwareInfoDlg::GetMouseInfo()
{
    int mouseInfo[3];    // We need an array (size 3) of int for mouse information
    TCHAR str [32];
    BOOL stat;

    // Check if mouse is present or not.

    stat = GetSystemMetrics (SM_MOUSEPRESENT);

    if (!stat) {
        m_stMouse = _T ("Not installed");
    }
    else {
        m_stMouse = _T ("Installed");

        // Check if buttons are swapped

        stat = GetSystemMetrics (SM_SWAPBUTTON);

        m_stButtonsSwapped = (stat) ? _T ("Swapped") : _T ("Not swapped");
        
    }

    // Get mouse speed

    SystemParametersInfo (SPI_GETMOUSE, NULL, mouseInfo, NULL);
    
    // mouseInfo [0] & mouseInfo [1], give twp threshold values for mouse
    // mpuseInfo [2] gives the mouse speed.

    sprintf (str, "%d", mouseInfo[2]);

    m_stMouseSpeed = CString (str);

    UpdateData (FALSE);

    return (true);
}