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. Unicode support in CEdit

Unicode support in CEdit

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 4 Posters 1 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.
  • B Offline
    B Offline
    bhanu_reddy09
    wrote on last edited by
    #1

    Dear All, I want to disply the character ♠ in the CEdit but this only getting diplayed when I change the project settings to Unicode. But to display this single character, I need to change my entire project which seems a huge task for me. I planned to do some alternative for this. Is it possible to extend a CEdit class to display unicode characters and then to include that class to my main project without changing the existing settings of my main project. Please advice me. Many thanks in advance.

    A N R 3 Replies Last reply
    0
    • B bhanu_reddy09

      Dear All, I want to disply the character ♠ in the CEdit but this only getting diplayed when I change the project settings to Unicode. But to display this single character, I need to change my entire project which seems a huge task for me. I planned to do some alternative for this. Is it possible to extend a CEdit class to display unicode characters and then to include that class to my main project without changing the existing settings of my main project. Please advice me. Many thanks in advance.

      A Offline
      A Offline
      Adam Roderick J
      wrote on last edited by
      #2

      CDC *pDC = GetDC(); CFont m_Font; LOGFONT lFont; memset(&lFont, 0, sizeof(lFont)); lFont.lfHeight = MulDiv(20, ::GetDeviceCaps(pDC->m_hDC, LOGPIXELSY), 12 ); lFont.lfWeight = FW_NORMAL; lFont.lfOutPrecision = OUT_TT_ONLY_PRECIS; wcscpy( lFont.lfFaceName, _T("Lucida Sans Unicode")); // Set the Font m_Font.CreateFontIndirect(&lFont); // Set the specified font for the edit ctrl. m_edit.SetFont(&m_Font);

      Величие не Бога может быть недооценена.

      B 1 Reply Last reply
      0
      • A Adam Roderick J

        CDC *pDC = GetDC(); CFont m_Font; LOGFONT lFont; memset(&lFont, 0, sizeof(lFont)); lFont.lfHeight = MulDiv(20, ::GetDeviceCaps(pDC->m_hDC, LOGPIXELSY), 12 ); lFont.lfWeight = FW_NORMAL; lFont.lfOutPrecision = OUT_TT_ONLY_PRECIS; wcscpy( lFont.lfFaceName, _T("Lucida Sans Unicode")); // Set the Font m_Font.CreateFontIndirect(&lFont); // Set the specified font for the edit ctrl. m_edit.SetFont(&m_Font);

        Величие не Бога может быть недооценена.

        B Offline
        B Offline
        bhanu_reddy09
        wrote on last edited by
        #3

        Dear ARJ, Many thanks for your reply. The real problem is that the above code will work only if we set the project properties to Unicode otherwise the above won't work. I want to display those control characters in CEdit without changing my main project's project setting to Unicode.

        1 Reply Last reply
        0
        • B bhanu_reddy09

          Dear All, I want to disply the character ♠ in the CEdit but this only getting diplayed when I change the project settings to Unicode. But to display this single character, I need to change my entire project which seems a huge task for me. I planned to do some alternative for this. Is it possible to extend a CEdit class to display unicode characters and then to include that class to my main project without changing the existing settings of my main project. Please advice me. Many thanks in advance.

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          I am not sure but try creating the edit window as unicode. I mean you have to create the windows dynamically using the CreateWindowW ( the unicode version of CreateWindow ).

          nave [OpenedFileFinder] [My Blog]

          1 Reply Last reply
          0
          • B bhanu_reddy09

            Dear All, I want to disply the character ♠ in the CEdit but this only getting diplayed when I change the project settings to Unicode. But to display this single character, I need to change my entire project which seems a huge task for me. I planned to do some alternative for this. Is it possible to extend a CEdit class to display unicode characters and then to include that class to my main project without changing the existing settings of my main project. Please advice me. Many thanks in advance.

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            bhanu_reddy09 wrote:

            But to display this single character, I need to change my entire project which seems a huge task for me.

            I'll recommend that you convert your project to Unicode, and it is the ideal way of doing it. Unless your code uses some kind of a third party library that doesn't support Unicode, I don't see a reason why you should not do a fully Unicode build. You can always come here and ask questions if you run into trouble.

            It is a crappy thing, but it's life -^ Carlo Pallini

            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