Solved

How to change a mouse cursor in an ActiveX control?

Posted on 1998-08-10
2
521 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

713 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