先看看CreateCursor的定义,如果需要彩色的话,需要设置*pvANDPlane和*pvXORPlane这<br>两个参数<br>HCURSOR CreateCursor(<br> HINSTANCE hInst, // handle to application instance<br> int xHotSpot, // x coordinate of hot spot<br> int yHotSpot, // y coordinate of hot spot<br> int nWidth, // cursor width<br> int nHeight, // cursor height<br> CONST VOID *pvANDPlane, // AND mask array<br> CONST VOID *pvXORPlane // XOR mask array<br>);<br>下面一段是摘自MSDN的一个应用实例<br><br> // Get only the bitmap's bits, and load into a BYTE array of<br> // correct size.<br> // In this example, the bitmap created happens to have the<br> // dimensions needed for a cursor or icon. This may not always be<br> // the case. It may be necessary to "stretch" or "compress" the<br> // bitmap to the correct size, using StretchDIBits or StretchBlt<br> // (depending at what point the change in size is done).<br><br> xsize = GetSystemMetrics(SM_CXCURSOR);<br> ysize = GetSystemMetrics(SM_CYCURSOR);<br> GetObject(hbmMono, sizeof(BITMAP), (LPSTR)&bm);<br> GetBitmapBits(hbmMono, (bm.bmWidthBytes * bm.bmHeight),<br> (LPSTR)XORbitPlane);<br><br> // The call above uses bm.bmWidthBytes instead of planes and<br> // bitsPixel because the former takes into account the fact that<br> // some drivers might pad scan lines for speed reasons.<br><br> hBitCursor = CreateCursor(ghInstance, 0, 0, xsize, ysize,<br> ANDbitPlane, XORbitPlane); <br>