Solved

How to change a mouse cursor in an ActiveX control?

Posted on 1998-08-10
2
510 Views
Last Modified: 2008-02-20
How to change a mouse cursor in specific region of my ActiveX control?
When I chane cursor shape by using SetCursor() in OnMouseMove function I can see my new changed mouse cursor when it is motionless. During mouse move cusor is blinking.

0
Comment
Question by:bartczak
2 Comments
 
LVL 6

Accepted Solution

by:
snoegler earned 100 total points
ID: 1169838
Use the OnSetCursor function - which is the MFC function corresponding to
WM_SETCURSOR. Everytime the mouse is moved - like OnMouseMove - this function is
called. In this function, you can use the SetCursor() with the handle to the cursor you want.
A small example:

BOOL CMyWindow::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
  // TODO: Add your message handler code here and/or call default
  POINT      here;

  GetCursorPos(&here);
  ScreenToClient(&here);

  if( IsCursorInTheRightBox(here) && nHitTest==HTCLIENT) {
    HCURSOR hCur=AfxGetApp()->LoadCursor(IDC_MYCURSOR);
    SetCursor(hCur);
    return TRUE;
  }

  return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
I hope that helped :)
0
 

Author Comment

by:bartczak
ID: 1169839
Thank You very much Snoegler, it's working !!!
It is very good that there are people like YOU ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now