使用 VC++ 构建 XP 屏幕保护程序 2008年
我正在尝试在 Windows XP 上使用 Visual C++ 2008 Express Edition SP1 编译屏幕保护程序。 我收到运行时错误:“无法在动态链接库 USER32.dll 中找到过程入口点 ChangeWindowMessageFilter()
”。 据我所知,这是因为微软在 VS 2008 中包含的 scrnsave.lib 库调用了 Vista 特定的函数,但在 XP 上失败,因为该函数不存在。
定义 WINVER 似乎没有做任何事情。
我该如何解决这个问题?
I'm attempting to compile a screensaver using Visual C++ 2008 Express Edition SP1 on Windows XP. I get a runtime error: "The procedure entry point ChangeWindowMessageFilter()
could not be located in the dynamic link library USER32.dll." As far as I can tell, this is because Microsoft botched the scrnsave.lib library included in VS 2008 to call a Vista-specific function, which fails on XP because the function does not exist.
Defining WINVER
doesn't seem to do anything.
How can I work around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 MSDN 中查看“ChangeWindowMessageFilter”表示它是 Vista 特定的,并且是 User32.lib 的一部分,而 User32.lib 正是您要链接的内容,因为 Windows XP 在 User32.dll 中没有该功能...因此爆炸...建议遵循 Michael 的建议下载旧版本的 SDK...没有其他方法可以做到这一点...我想知道您可以同时安装不同的 SDK,一个用于 Vista 平台,另一个用于 Win XP 平台?
编辑:我在 blog...它讨论了完全相同的问题,从旧安装中获取 scrnsave.lib 的旧副本(VS 2005,如果您有权访问一个或询问朋友/同事?)说到上述特定于 Vista 的功能 - 这是一个有趣的意见 关于为什么不应该触摸它...
希望这会有所帮助,
此致,
汤姆.
Looking at this in MSDN for 'ChangeWindowMessageFilter' indicates that its a Vista Specific and is part of the User32.lib which is what you're linking with, as Windows XP does not have that function in the User32.dll....hence the blowup...recommended to follow Michael's suggestion to download an older version of the SDK...there is no other way to do it...I wonder can you install a different SDK side by side, one for Vista platforms and the other for Win XP platform?
Edit: I found an interesting link here about this here on a blog... It talks about the exact identical problem, grab an old copy of scrnsave.lib from an older installation (VS 2005 if you have access to one or ask a friend/colleague?) Speaking of the above function that is vista specific - here's an interesting opinion on it why it should not be touched...
Hope this helps,
Best regards,
Tom.
您可以尝试获取旧版本的 Platform SDK,并链接到其版本的 scrnsave.lib。
http://www.microsoft.com/downloads/details.aspx microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en 是 Windows Server 2003 SP1 Platform SDK 的下载链接。
You could try getting an older version of the Platform SDK, and link to its version of scrnsave.lib.
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en is the download link for the Windows Server 2003 SP1 Platform SDK.
编写一个存根函数(代码中省略了许多细节)
如果该函数所在的 obj 或 lib 位于链接行中的 user32.lib 之前,则链接器应该选择您的存根函数,而不是 user32.lib 中的存根函数。
你的存根函数可以在运行时检测到你在 Vista 或更高版本上,并调用真正的函数,否则就撒谎并返回 TRUE。
Write a stub function (many details left out of the code)
If the obj or lib that this function is in is before user32.lib in your link line, then the linker should pick your stub function rather than the one from user32.lib.
Your stub function can detect at runtime that you are on Vista or later and call the real function, otherwise just lie and return TRUE.