Systemparametersinfo call failure

Source: Internet
Author: User

I downloaded the Excel file reading program from pudn. The compilation failed at the beginning, mainly because of the location definition of the loop variable, which is a good solution!

 

However, after compilation, an error occurs when you run the program:

An unhandled exception occurs in 0x1026ed6a (msvcr90d. dll) in excelaccess.exe: 0xc0000005: Access conflict when the read location is 0x00000000.

The error code is as follows:

[CPP]
View plaincopy
  1. Lplogfont cpptooltip: getsystemtooltipfont () const
  2. {
  3. Static logfont;
  4. Nonclientmetrics NCM;
  5. Zeromemory (& NCM, sizeof (nonclientmetrics ));
  6. NCM. cbsize = sizeof (nonclientmetrics );
  7. If (0 = systemparametersinfo (spi_getnonclientmetrics, sizeof (nonclientmetrics), & NCM, 0 ))
  8. {
  9. Trace ("error of systemparametersinfo is % d/R/N", getlasterror ());
  10. Return false;
  11. }
  12. Memcpy (& logfont, & (NCM. lfstatusfont), sizeof (logfont ));
  13. Return & logfont;
  14. }

If the systemparametersinfo () function fails to run, zero is returned. getlasterror () also returns zero.


Modification method:

NCM. cbsize = sizeof (nonclientmetrics)-sizeof (NCM. ipaddedborderwidth );


Cause:


Since Vista and Windows Server 2008, nonclientmetrics adds the ipaddedborderwidth field at the end.

If the program plans to support both Vista and XP, Windows 2000, and Windows Server 2003, call getversionex () to check the Windows version and then determine whether to subtract sizeof (NCMS. ipaddedborderwidth ).

I downloaded the Excel file reading program from pudn. The compilation failed at the beginning, mainly because of the location definition of the loop variable, which is a good solution!

 

However, after compilation, an error occurs when you run the program:

An unhandled exception occurs in 0x1026ed6a (msvcr90d. dll) in excelaccess.exe: 0xc0000005: Access conflict when the read location is 0x00000000.

The error code is as follows:

[CPP]
View plaincopy
  1. Lplogfont cpptooltip: getsystemtooltipfont () const
  2. {
  3. Static logfont;
  4. Nonclientmetrics NCM;
  5. Zeromemory (& NCM, sizeof (nonclientmetrics ));
  6. NCM. cbsize = sizeof (nonclientmetrics );
  7. If (0 = systemparametersinfo (spi_getnonclientmetrics, sizeof (nonclientmetrics), & NCM, 0 ))
  8. {
  9. Trace ("error of systemparametersinfo is % d/R/N", getlasterror ());
  10. Return false;
  11. }
  12. Memcpy (& logfont, & (NCM. lfstatusfont), sizeof (logfont ));
  13. Return & logfont;
  14. }

If the systemparametersinfo () function fails to run, zero is returned. getlasterror () also returns zero.


Modification method:

NCM. cbsize = sizeof (nonclientmetrics)-sizeof (NCM. ipaddedborderwidth );


Cause:


Since Vista and Windows Server 2008, nonclientmetrics adds the ipaddedborderwidth field at the end.

If the program plans to support both Vista and XP, Windows 2000, and Windows Server 2003, call getversionex () to check the Windows version and then determine whether to subtract sizeof (NCMS. ipaddedborderwidth ).

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.