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. Mobile Development
  3. Mobile
  4. lfFaceName compiler error

lfFaceName compiler error

Scheduled Pinned Locked Moved Mobile
helpquestion
5 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.
  • R Offline
    R Offline
    rodent
    wrote on last edited by
    #1

    using ppc2k2 sdk and getting "cannot convert from 'unsigned short [7]' to 'unsigned short [32]" compiler error on the following snippet...sdk doc's say lfFaceName member should be a null terminated string specifying typeface name of desired font LOGFONT* lplf; memset(lplf, 0, sizeof(LOGFONT)); lplf->lfFaceName = _T("Tahoma"); any ideas?.....thanks

    D 1 Reply Last reply
    0
    • R rodent

      using ppc2k2 sdk and getting "cannot convert from 'unsigned short [7]' to 'unsigned short [32]" compiler error on the following snippet...sdk doc's say lfFaceName member should be a null terminated string specifying typeface name of desired font LOGFONT* lplf; memset(lplf, 0, sizeof(LOGFONT)); lplf->lfFaceName = _T("Tahoma"); any ideas?.....thanks

      D Offline
      D Offline
      Daniel Strigl
      wrote on last edited by
      #2

      Try the following: _tcscpy(lplf->lfFaceName, _T("Tahoma")); Daniel ;) --------------------------- Never change a running system!

      R 1 Reply Last reply
      0
      • D Daniel Strigl

        Try the following: _tcscpy(lplf->lfFaceName, _T("Tahoma")); Daniel ;) --------------------------- Never change a running system!

        R Offline
        R Offline
        rodent
        wrote on last edited by
        #3

        after making the change, i now get the following C2440 compiler error:

        cannot convert from 'unsigned short *' to 'unsigned short [32]'
        There are no conversions to array types, although there are conversions to references or pointers to arrays

        D 1 Reply Last reply
        0
        • R rodent

          after making the change, i now get the following C2440 compiler error:

          cannot convert from 'unsigned short *' to 'unsigned short [32]'
          There are no conversions to array types, although there are conversions to references or pointers to arrays

          D Offline
          D Offline
          Daniel Strigl
          wrote on last edited by
          #4

          Take a look on João Paulo's "A font chooser dialog for the Pocket PC" article. He also uses the LOGFONT struct and it works:

          ...
          LOGFONT lf;
          ...
          //
          // Create the bold font
          //
          lf.lfHeight = -11;
          lf.lfWidth = 0;
          lf.lfEscapement = 0;
          lf.lfOrientation = 0;
          lf.lfWeight = FW_BOLD;
          lf.lfItalic = FALSE;
          lf.lfUnderline = FALSE;
          lf.lfStrikeOut = 0;
          lf.lfCharSet = ANSI_CHARSET;
          lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
          lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
          lf.lfQuality = DEFAULT_QUALITY;
          lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
          _tcscpy(lf.lfFaceName, TEXT("Tahoma"));
          m_fontBold.CreateFontIndirect(&lf);
          ...

          Daniel ;) --------------------------- Never change a running system!

          R 1 Reply Last reply
          0
          • D Daniel Strigl

            Take a look on João Paulo's "A font chooser dialog for the Pocket PC" article. He also uses the LOGFONT struct and it works:

            ...
            LOGFONT lf;
            ...
            //
            // Create the bold font
            //
            lf.lfHeight = -11;
            lf.lfWidth = 0;
            lf.lfEscapement = 0;
            lf.lfOrientation = 0;
            lf.lfWeight = FW_BOLD;
            lf.lfItalic = FALSE;
            lf.lfUnderline = FALSE;
            lf.lfStrikeOut = 0;
            lf.lfCharSet = ANSI_CHARSET;
            lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
            lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
            lf.lfQuality = DEFAULT_QUALITY;
            lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
            _tcscpy(lf.lfFaceName, TEXT("Tahoma"));
            m_fontBold.CreateFontIndirect(&lf);
            ...

            Daniel ;) --------------------------- Never change a running system!

            R Offline
            R Offline
            rodent
            wrote on last edited by
            #5

            thanks daniel and i'll check out his article! actually, your code worked perfectly once i had a cup of coffee and corrected how i had cut & pasted it into my code.:doh:

            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