Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

caret index in CRichEditCtrl

Posted on 2002-04-01
7
Medium Priority
?
502 Views
Last Modified: 2013-11-20
How can I get the current character index, i.e., the index of the caret in CRichEditCtrl? There are functions to get current line index, no of lines but I do not find one to get caret index. Any help?
0
Comment
Question by:chhakuli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6910904
Use GetSel:

long nStartPose, nEndPos;
m_ctlRichEd.void GetSel( nStartPos, nEndPos );

if ( nStartPos == nEndPos } {
        MessageBox("There no selection, only a caret");
} else {
        MessageBox("some text is selected");
}

-- Dan

0
 
LVL 4

Accepted Solution

by:
pagladasu earned 0 total points
ID: 6911246
Use
m_ctlRichEd.void GetSel( nStartPos, nEndPos );
if the values of nStartPos and nEndPos are both equal, then nStartPos or nEndPos will give you 'the index of the caret in CRichEditCtrl'.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6911278
Excellent observation pagladasu! I wish I'd said that!
-- Dan
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

Expert Comment

by:DanRollins
ID: 6911279
One typo.  Use:

m_ctlRichEd.GetSel( nStartPos, nEndPos );


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6913920
chhakuli,

Why did you accept pagladasus'c comment as the answer?  It is very obviously a copy of my comment.  It even has the exact same typographical error!

-- Dan
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 6913945
U are right, DanRollins. I just made an observation on your comment based on the question. I think u should get the points.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6914337
This was the result of a database error, and points may not have properly gone to you .  Can you check for us?

We may need to do this question again if you can't see the points.

Moondancer - EE Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question