VC program calls dxdiag to generate an XML file to obtain the System Configuration

Source: Internet
Author: User
/// It must be in stdafx. add // # import "msxml3.dll" // import the Type Library # define MSXML msxml2 // start dxdiag.exe and use it to generate an XML file // use javasdxdiag.exe /?] To view usage // startupinfo Si = {sizeof (SI), 0}; process_information Pi = {0}; tchar szcmdline [max_path] = _ T ("dxdiag.exe/WHQL: off/X dxdiag_output.xml "); // replace it with [/X], that is, if (CreateProcess (null, sz1_line, null, null, true, null, & Si, & PI) {waitforsingleobject (Pi. hprocess, infinite); // wait until dxdiag.exe finishes executing closehandle (Pi. hprocess); closehandle (Pi. hthread);} // load the XML file // MSXML: ixmldomdocumentptr m _ Pdoc; If (! M_pdoc-> load (_ bstr_t) "dxdiag_output.xml") {afxmessagebox ("loading dxdiag_output.xml failed"); Return-1 ;}/// parse the XML file, read the BIOS configuration in the same way. // MSXML: ixmldomelementptr pdocelement = m_pdoc-> getdocumentelement (); If (pdocelement) {MSXML :: ixmldomelementptr pelement = pdocelement-> selectsinglenode (_ bstr_t) "systeminformation/BIOS"); If (pelement) {afxmessagebox (lpcstr) (pelement-> gettext ());}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.