Solved

From Mouse Position To Text Beneath - CRichEditCtrl

Posted on 2001-07-30
6
306 Views
Last Modified: 2013-11-20
I need to be able to grab the mouse move events while the user is moving over a CRichEditCtrl, and determine the character position of the mouse.  In other words, the OnMouseMove() method tells me a CPoint, where the mouse pointer is, and I need to convert this over to a
character position within the control.  

Anyone any ideas

Cheer

Rich
0
Comment
Question by:RichJackson
[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
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:migel
ID: 6333605
Hi!
there is message for this:
EM_CHARFROMPOS
0
 

Author Comment

by:RichJackson
ID: 6334775
Cheers, but I gotta a problem with EM_CHARFROMPOS, it just give me zero.

Code below, thanks

CResultsDlg::PreTranslateMessage(MSG* pMsg)
{
  if (NULL != m_pToolTip)
      m_pToolTip->RelayEvent(pMsg);
     
  if (pMsg->message==WM_MOUSEMOVE && 
     pMsg->hwnd==m_note.m_hWnd )
  {
     long res;
         
     res = m_note.SendMessage(EM_CHARFROMPOS,0,(long)
                                  &pMsg->pt);

         
     //RES ALWAYS ZERO!

0
 
LVL 12

Expert Comment

by:migel
ID: 6334788
Hi!
IMHO you must convert pt to the RichEdit client coords.
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!

 

Author Comment

by:RichJackson
ID: 6335046
I guess that would explain it, whats the best way of doing the conversion.
0
 
LVL 12

Accepted Solution

by:
migel earned 15 total points
ID: 6335280
hm

POINT pt;
GetCursorPos(&pt);
m_note.ScreenToClient(&pt);
0
 

Author Comment

by:RichJackson
ID: 6336990
Cheers, much appreciated
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

690 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