Jump to content
  • Advertisement
Sign in to follow this  
M-374 LX

[C++/Win32] How to get caret position?

This topic is 3631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You need control-specific messages: Use EM_GETSEL to get the selection start and end index, then use EM_LINEFROMCHAR to get which line the start and end are on, then you can use EM_LINEINDEX to get the character at the start of the line to know how far on the line the index is.

I don't know of a way to know whether the caret is at the start or end of the selection, but I believe that for an edit control it is always at the start or end of the selection.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!