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. How to getting the string of head position??

How to getting the string of head position??

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

    hi i have a promblem that i have a string "首YはYO二OK亜KM。M" i want get the & of head but i can't getting the right~ like this: CString m_str="首YはYO二OK亜KM。M"; wchar_t *m_T=(LPWSTR)_bstr_t(m_str); wchar_t m_tem=*m_T; fontOld=pDC->SelectObject(pFont); pDC->TextOut(rc.left+m_Width,rc.top+m_Depth,&m_tem); but it display 首???????? i only want 首 thank in advance very much.:confused::confused::confused::confused: nothing

    E R B 3 Replies Last reply
    0
    • E ebinaini

      hi i have a promblem that i have a string "首YはYO二OK亜KM。M" i want get the & of head but i can't getting the right~ like this: CString m_str="首YはYO二OK亜KM。M"; wchar_t *m_T=(LPWSTR)_bstr_t(m_str); wchar_t m_tem=*m_T; fontOld=pDC->SelectObject(pFont); pDC->TextOut(rc.left+m_Width,rc.top+m_Depth,&m_tem); but it display 首???????? i only want 首 thank in advance very much.:confused::confused::confused::confused: nothing

      E Offline
      E Offline
      Eytukan
      wrote on last edited by
      #2

      why not you try char array ? so that u can take the particular item .. m_tem[1];:~ thanx V

      1 Reply Last reply
      0
      • E ebinaini

        hi i have a promblem that i have a string "首YはYO二OK亜KM。M" i want get the & of head but i can't getting the right~ like this: CString m_str="首YはYO二OK亜KM。M"; wchar_t *m_T=(LPWSTR)_bstr_t(m_str); wchar_t m_tem=*m_T; fontOld=pDC->SelectObject(pFont); pDC->TextOut(rc.left+m_Width,rc.top+m_Depth,&m_tem); but it display 首???????? i only want 首 thank in advance very much.:confused::confused::confused::confused: nothing

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

        ebinaini wrote: wchar_t m_tem=*m_T;

        wchar_t m_tem=m_T[0];

        .. maybe, so that your m_tem is really only one char wide. BTW, there must be better ways (meaning safer ways) to do this : ebinaini wrote: wchar_t *m_T=(LPWSTR)_bstr_t(m_str); ~RaGE();

        1 Reply Last reply
        0
        • E ebinaini

          hi i have a promblem that i have a string "首YはYO二OK亜KM。M" i want get the & of head but i can't getting the right~ like this: CString m_str="首YはYO二OK亜KM。M"; wchar_t *m_T=(LPWSTR)_bstr_t(m_str); wchar_t m_tem=*m_T; fontOld=pDC->SelectObject(pFont); pDC->TextOut(rc.left+m_Width,rc.top+m_Depth,&m_tem); but it display 首???????? i only want 首 thank in advance very much.:confused::confused::confused::confused: nothing

          B Offline
          B Offline
          Bob Ciora
          wrote on last edited by
          #4

          TextOut displays a string, not a character. Passing &m_tem, TextOut still treats it as a string and, as such, is exactly the same as m_T. By the way, as has been alluded, CString doesn't like to be messed with internally like you might be trying. Use a char array instead, or you're going to blow something up later. Bob Ciora

          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