捕获动画系统光标的哪一步在Windows上显示(Capture which step of an animated system cursor is being shown on Windows)

编程入门 行业动态 更新时间:2024-10-25 02:20:42
捕获动画系统光标的哪一步在Windows上显示(Capture which step of an animated system cursor is being shown on Windows)

我想尽可能准确地捕获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参数...)? 目前,上面的代码显然总是只渲染动画光标的第一步。

我怀疑这不容易做到,但无论如何都值得问。

I want to capture as a bitmap the system cursor on Windows OSes as accurately as possible. The provided API for this is to my knowledge GetCursorInfo, DrawIconEx.

The simple chain of actions is:

Get cursor by using GetCursorInfo Paint the cursor in a memory DC by using DrawIconEx.

Here is how the code looks roughly.

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 }

Now, anyone knows how I could get which step of the animated cursor is being drawn (I need the value that can be then passed to the istepIfAniCur parameter of DrawIconEx...)? Currently the above code obviously always renders only the first step of an animated cursor.

I suspect this can not be easily done, but it's worth asking anyway.

最满意答案

不幸的是,我不认为有一个Windows API公开了光标动画的当前帧。 我假设你正在追求的是:你制作快照的瞬间光标的外观。

Unfortunately, I don't think there's a Windows API that discloses the current frame of the cursor animation. I assume that's what you're after: the look of the cursor at the instant you make the snapshot.

更多推荐

本文发布于:2023-07-15 19:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117701.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标的   动画   系统   Windows   Capture

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!