Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to change a mouse cursor in an ActiveX control?

Posted on 1998-08-10
2
Medium Priority
?
543 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 400 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

Industry Leaders: 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!

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 clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

670 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