VBA调用user32.dll游标修改

发布于 2024-12-23 17:55:27 字数 1481 浏览 1 评论 0 原文

简短问题
是否可以使用 user32.dll 更改所选应用程序 (Visio 2010) 的系统光标?

背景
我试图强制光标仅显示为箭头,或者更好的是,将“沙漏”指针重新映射到箭头指针,以便当我的 Visio 应用程序“等待”时,它将始终显示箭头。到目前为止,我已经能够加载user32.dll并调用SetSystemCursorLoadCursorAShowCursor。在所有进行的调用中,只有 ShowCursor 按预期工作。

问题很可能是我不完全理解什么LoadCursorSetSystemCursor 实际上是这样做的。我已经链接了我能找到的最好的文档,而我认为这是最缺乏的。

结束语
除了使用 user32.dll API 之外,是否有更好的方法来实现此目的?请注意,据我所知,Visio 2010 根本无法控制鼠标指针。

跟进
查看这篇文章了解我试图解决的确切行为。请注意,我并不是试图隐藏应用程序以显示其正忙。每次以编程方式更改 Visio 形状数据时,我都试图消除沙漏闪烁。 这里是我在 VisioGuy 帖子中提到的 Visio 示例的链接,您必须是网站会员才能查看附件。

最初,我无意将 LoadCursorSetSystemCursor 一起使用,只是因为我在 Pinvoke.net 上找到的文档(针对 SetSystemCursor)而将它们关联起来。 。我还没有看到 SetSystemCursor 的 MSDN 文档。感谢 Pinvoke 上的提示...我不知道为什么我没有为他们两个找到 MSDN。

诚然,我对系统 DLL 的了解不多。我的主要知识库是嵌入式系统和独立于操作系统的语言(即 Python),因此有关 SetSystemCursor 导致全局系统错误的提示是我真正需要的信息。

Short Question
Is it possible to change the system cursor for a selected application (Visio 2010) using the user32.dll?

Background
I am trying to force a cursor to only show as an arrow, or better yet, remap the "hourglass" pointer to the arrow pointer so that when my Visio application is 'waiting' it will always show an arrow. Thus far I have been able to load the user32.dll and call the SetSystemCursor, LoadCursorA, and ShowCursor. Out of all of the calls made, only ShowCursor works as expected.

The issue may very well be that I don't fully understand what LoadCursor and SetSystemCursor actually do. I have linked the best documentation that I could find, which IMO is lacking at best.

Closing Thoughts
Is there a better way to accomplish this rather than using user32.dll the API? Note that Visio 2010 does not, that I can find, control over the Mouse Pointers at all.

Follow Up
Check out this post for the exact behavior I am trying to get around. Note that I am not trying to hide the application from showing it's busy. I am trying to get rid of the hourglass flickering every time I change Visio shape data programmatically. Here is a link to the Visio Example I mention in the VisioGuy post, you must be a member of site to view attachments.

Originally I had no intent of using LoadCursor with SetSystemCursor, I only associated them because of the documentation I found at Pinvoke.net (for SetSystemCursor). I had not seen the MSDN documentation for SetSystemCursor. Thanks for the tip on Pinvoke... and I don't know why I didn't pull up the MSDN for both of them.

Admittedly, I have not played with system DLLs much. My main knowledge base is in embedded systems, and OS independent languages (ie Python), so the tip about SetSystemCursor causing global system errors is the kind of information that I really need.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

濫情▎り 2024-12-30 17:55:27

虽然它没有严格回答“光标修改”问题,但我认为您应该能够使用 Visio 的应用程序对象属性:

至少,这将允许您在进行后台处理时隐藏光标。我已经用您在 visguy 上的示例对此进行了测试,它不再显示无痛的光标更改。

Although it does not strictly answer the 'cursor modification' question, I think you should be able to use Visio's Application object properties:

At least, this will allow you to hide the cursor while you're doing your background processing. I have tested this with your sample on visguy and it does not show painless cursor changes anymore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文