Solved

How to change a mouse cursor in an ActiveX control?

Posted on 1998-08-10
2
527 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
[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
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.

710 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