Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Windows XP Problems since updating from VS2005 to VS2008

Windows XP Problems since updating from VS2005 to VS2008

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpvisual-studioquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joschwenk666
    wrote on last edited by
    #1

    Hallo, I upgraded from Visual Studio 2005 to Visual Studio 2008, and converted my Project from from VS2005 to VS2008. But now I get an Error in the following lines:

    // Get the current font
    LOGFONT lFont;
    NONCLIENTMETRICS ncm;
    ncm.cbSize = sizeof(NONCLIENTMETRICS);
    VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
    sizeof(NONCLIENTMETRICS), &ncm, 0));
    lFont = ncm.lfMessageFont;

    In Windows XP SystemParametersInfo() returns false, and there are the following Values in ncm after executing the SystemParametersInfo() Function: Screenshot When I open my Project in Windows 7, it works without problem. In XP I get an access exeption in msvcr90d.dll when I ignore the failed execution of SystemParametersInfo. Can someone help me? Thank you!

    I 1 Reply Last reply
    0
    • J Joschwenk666

      Hallo, I upgraded from Visual Studio 2005 to Visual Studio 2008, and converted my Project from from VS2005 to VS2008. But now I get an Error in the following lines:

      // Get the current font
      LOGFONT lFont;
      NONCLIENTMETRICS ncm;
      ncm.cbSize = sizeof(NONCLIENTMETRICS);
      VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
      sizeof(NONCLIENTMETRICS), &ncm, 0));
      lFont = ncm.lfMessageFont;

      In Windows XP SystemParametersInfo() returns false, and there are the following Values in ncm after executing the SystemParametersInfo() Function: Screenshot When I open my Project in Windows 7, it works without problem. In XP I get an access exeption in msvcr90d.dll when I ignore the failed execution of SystemParametersInfo. Can someone help me? Thank you!

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      I would guess NONCLIENTMETRICS has grown... And VS2008 will default WINVER to a later (higher) value, so the size you have compiled is the "bigger" one. You pass the size of the structure to SystemParametersInfo - and the later OS can handle the earlier structure. But the earlier OS can't handle the later structure. Doing a little digging... http://msdn.microsoft.com/en-us/library/ms724506%28VS.85%29.aspx[^]

      typedef struct tagNONCLIENTMETRICS {
      UINT cbSize;
      int iBorderWidth;
      ...
      LOGFONT lfMessageFont;
      #if (WINVER >= 0x0600)
      int iPaddedBorderWidth;
      #endif
      } NONCLIENTMETRICS, *LPNONCLIENTMETRICS;

      You can see my theory is probably right. XP has no idea what to do with the oversized structure you're giving it... If you want to be compatible with XP, define WINVER to an appropriate value (0x501 I thiiiink) before including the header files. Good luck, Iain.

      I have now moved to Sweden for love (awwww).

      J 1 Reply Last reply
      0
      • I Iain Clarke Warrior Programmer

        I would guess NONCLIENTMETRICS has grown... And VS2008 will default WINVER to a later (higher) value, so the size you have compiled is the "bigger" one. You pass the size of the structure to SystemParametersInfo - and the later OS can handle the earlier structure. But the earlier OS can't handle the later structure. Doing a little digging... http://msdn.microsoft.com/en-us/library/ms724506%28VS.85%29.aspx[^]

        typedef struct tagNONCLIENTMETRICS {
        UINT cbSize;
        int iBorderWidth;
        ...
        LOGFONT lfMessageFont;
        #if (WINVER >= 0x0600)
        int iPaddedBorderWidth;
        #endif
        } NONCLIENTMETRICS, *LPNONCLIENTMETRICS;

        You can see my theory is probably right. XP has no idea what to do with the oversized structure you're giving it... If you want to be compatible with XP, define WINVER to an appropriate value (0x501 I thiiiink) before including the header files. Good luck, Iain.

        I have now moved to Sweden for love (awwww).

        J Offline
        J Offline
        Joschwenk666
        wrote on last edited by
        #3

        Thank you, VS2008 sets WINVER to Windows Vista. I now set WINVER in the stdafx.h files of my DLLs to WinXP and now it works. This is the greatest forum in the world! :)

        I 1 Reply Last reply
        0
        • J Joschwenk666

          Thank you, VS2008 sets WINVER to Windows Vista. I now set WINVER in the stdafx.h files of my DLLs to WinXP and now it works. This is the greatest forum in the world! :)

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          Joschwenk666 wrote:

          This is the greatest forum in the world!

          This is just a tribute! (you're welcome, glad I helped) Iain.

          I have now moved to Sweden for love (awwww).

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups