> I'm trying to create cursors "on the fly" as it were, by creating an
> in-memory bitmap, painting on a graphics object derived from the bitmap, and
> obtaining an Icon handle from the bitmap which is then used to create the
> This gives me a 32x32 pixel cursor showing a blue box with a nice shadow.
> The problem is that I haven't been able to set the hotspot on the cursor in
> any way.
> So if anybody knows how to set the hotspot on a cursor, I'd be good to go.
> Just keep in mind that I need to create the cursor images on the fly...
I don't see anything in the Cursor class information in the MSDN about how to set the hotspot of a cursor, so here's the GDI method:
1) Call GetIconInfo() on the cursor handle (h) to fill an ICONINFO structure
2) Set the xHotspot and yHotspot members of this structure
3) Call CreateIconIndirect() passing back in the ICONINFO structure
4) Call DeleteObject() on the original cursor handle to clean up the GDI resources.
Hope this helps,