【发布时间】:2008-10-12 18:50:56
【问题描述】:
我想尽可能准确地将 Windows 操作系统上的系统光标捕获为位图。 据我所知,为此提供的 API 是 GetCursorInfo、DrawIconEx。
简单的动作链是:
- 使用 GetCursorInfo 获取光标
- 使用 DrawIconEx 在内存 DC 中绘制光标。
代码大致如下。
CURSORINFO CursorInfo;
(VOID)memset(&CursorInfo, 0, sizeof(CursorInfo));
CursorInfo.cbSize = sizeof(CursorInfo);
if (GetCursorInfo(&CursorInfo) &&
CursorInfo.hCursor)
{
// ... create here the memory DC, memory bitmap
boError |= !DrawIconEx(hCursorDC, // device context
0, // xLeft
0, // yTop
CursorInfo.hCursor, // cursor handle
0, // width, use system default
0, // height, use system default
0, // step of animated cursor !!!!!!!!!
NULL, // flicker free brush, don't use it now
DI_MASK | DI_DEFAULTSIZE); // flags
// ... do whatever we want with the cursor in our memory DC
}
现在,任何人都知道我如何获得正在绘制动画光标的哪一步(我需要可以传递给 DrawIconEx 的 istepIfAniCur 参数的值...)?目前,上面的代码显然总是只渲染动画光标的第一步。
我怀疑这不容易做到,但无论如何都值得一问。
【问题讨论】: