Click here to Skip to main content
13,087,566 members (93,331 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 4 Jan 2011

Create a cursor from an ICON

, 5 Jan 2011
Rate this:
Please Sign up or sign in to vote.
This tip is about creating a cursor from an icon
HICON hIcon = AfxGetApp()->LoadStandardIcon(IDI_INFORMATION);
ICONINFO iconinfo;				
GetIconInfo(hIcon, &iconinfo);
ICONINFO cursorinfo;
cursorinfo = iconinfo;
cursorinfo.fIcon = FALSE;
if(m_hCursor) // make sure m_hCursor the class member variable is initialzed to NULL 
m_hCursor = ::CreateIconIndirect(&cursorinfo);			
// must delete the created bitmaps due to GetIconInfo call
// Don't forget to destroy this cursor before application exiting


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mukit, Ataul
Chief Technology Officer Rational Technologies
Bangladesh Bangladesh
If you are not in - you are out !
- Chapter 1

You may also be interested in...


Comments and Discussions

GeneralIf you don't want the cursor hotspot to be at [x,y] == [0,0]... Pin
slposey11-Jan-11 11:53
memberslposey11-Jan-11 11:53 
GeneralTrivial for someone as talented as you maybe, who has the wh... Pin
Mukit, Ataul10-Jan-11 18:39
memberMukit, Ataul10-Jan-11 18:39 
GeneralReason for my vote of 1 It's trivial! Why reprint the MSDN h... Pin
Carc10-Jan-11 10:35
memberCarc10-Jan-11 10:35 
GeneralRe: Does this code snippet exist on MSDN? Do you have a link? Pin
AspDotNetDev1-Sep-11 8:00
protectorAspDotNetDev1-Sep-11 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 5 Jan 2011
Article Copyright 2011 by Mukit, Ataul
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid