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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get number of characters before the caret?

How to get number of characters before the caret?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
2 Posts 1 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
    Jignesh Patel 0
    wrote on last edited by
    #1

    Hi, I've been stumped by this (or am just too blind!) problem. I am trying to get the number of characters before the caret in a Rich Edit Control. Is this possible? If not all the characters before the caret, then even the number of characters before the caret in the particular line - i'm using a multiline rich edit control. Does anyone know how to do this? It's kind of similar to the col num value in most word processors, which wordpad or notepad don't have. Thanks in advance, Jignesh

    J 1 Reply Last reply
    0
    • J Jignesh Patel 0

      Hi, I've been stumped by this (or am just too blind!) problem. I am trying to get the number of characters before the caret in a Rich Edit Control. Is this possible? If not all the characters before the caret, then even the number of characters before the caret in the particular line - i'm using a multiline rich edit control. Does anyone know how to do this? It's kind of similar to the col num value in most word processors, which wordpad or notepad don't have. Thanks in advance, Jignesh

      J Offline
      J Offline
      Jignesh Patel 0
      wrote on last edited by
      #2

      D0H! I found out just incase anyone cares... The EM_EXGETSEL does the magic. I never called that as I thought it would return 0,0 if nothing is selected, but it does return the correct ranges. Jignesh

      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