You can do this with CreateIconFromResourceEx
You pass a pointer to CURSOR_RES_HDR as the first parameter. This is one of those structures you can find in the documentation, but it is not any header file that I can find. This is pretty simple, although mostly for 16-bit unsigned ints, followed by a BITMAPINFOHEADER containing cursor image data.
typedef struct { WORD xHot; // x hotspot WORD yHot; // y hotspot BITMAPINFOHEADER bih; } CURSOR_RES_HDR; ... CURSOR_RES_HDR * pImage; // Fill out pImage HCURSOR hcur = CreateIconFromREsourceEx((BYTE*)pImage, cbImage, // size of image data + hotspot (in bytes) FALSE, 0x00030000, // version: value mandated by windows 0, 0, // width & height, 0 means use default LR_DEFAULTSIZE | LR_DEFAULTCOLOR);
source share