Solved

How to change a mouse cursor in an ActiveX control?

Posted on 1998-08-10
2
506 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
Comment Utility
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
Comment Utility
Thank You very much Snoegler, it's working !!!
It is very good that there are people like YOU ;-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

744 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

13 Experts available now in Live!

Get 1:1 Help Now