color mouse cursor

Hi,

Can someone explain how to set the mouse cursor from a color bitmap or ico file? I have the following so far:

BOOL CMyApp::OnInit()
{
    m_MyCursor = LoadCursor(IDC_MY_ICON_RES_ID);
}

BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
    ::SetCursor(theApp.m_MyCursor);
    return TRUE;
}

I'm not sure if loading from a 32x32 .ico file is appropriate. The above works with a .cur file. So how can I modify this to get some color in the cursor?

Thanks
LVL 7
minnirokAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

waysideCommented:
In Visual C++ .Net 2003:

- Open up the cursor resource in the resource editor
- Right-mouse in the editor window to bring up a large menu
- Near the bottom of the menu select "New Image Type", pick something that is not monochrome, such as 32x32, 16 colors
- Edit your cursor with fancy colors
- Right-mouse, select Current Cursor Image Types, drag across, select the monochrome bitmap. You should see your boring monochrome cursor again.
- Right-mouse, select "Delete Image Type", this deletes the monochrome bitmap
- When you save, your cursor will now contain only a color bitmap

Just rebuild and you will have it.

You can also import a cursor file with a color bitmap, that will work too.

The idea is similar in Visual C++ 6.0, although the resource editor is quite a bit different.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mahesh1402Commented:
You may also try LoadImage instead of LoadCursor.

However you need to delete the default monochrome device image like follows:

Open the cursor image, select monochrome device, click Image -> Delete Device Image.


Then you can add the WM_SETCURSOR handle, and modify the function as:

BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
              ::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));    
              return TRUE;      
}

Then you can use your colored cursor

More Information Refer : Q135047 HOWTO: Use Resource Editor for 16-Color 32x32 Mouse Pointers

http://support.microsoft.com/support/kb/articles/q135/0/47.asp <==


MAHESH


0
minnirokAuthor Commented:
Works perfectly, thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.