编写一个应用程序以便其在 Windows 7 上正常运行...?

发布于 2024-08-31 23:03:13 字数 196 浏览 1 评论 0原文

我有一个闪存驱动器,其中有一个应用程序,其代码是用 VC++ 2008 编写的,该应用程序在 xp 中运行良好,但当我将驱动器插入 Windows 7 机器时出现问题,它无法正常运行。有什么方法可以通过编写代码使其与Windows兼容。

我不想在 Windows 7 中设置兼容性选项卡来运行该程序..

我想在程序中对其进行编码,更像是一个补丁。

I have a flash drive which has an application whose code is written VC++ 2008 , the application works fine in xp , but the problem arises when i plug in the drive to a windows 7 machine , it doesn't run properly. is there any way that i can make it compatible to windows by writing a code.

i dont want to set the compatibility tab in windows 7 to run the program..

i want to code it in the program , more like a patch.

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

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

发布评论

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

评论(3

一个人练习一个人 2024-09-07 23:03:14

您可以使用 Microsoft 应用程序兼容性工具包,当您在 Windows XP 模式下运行应用程序时,它将准确地告诉您代码使用了哪些 Windows XP 兼容性填充程序。

您只需运行您的应用程序并禁用各种填充程序,直到您的代码再次出现错误行为。您禁用的最后一个填充程序是导致错误行为的原因。然后,您可以研究每个填充程序的确切后果,以及您的代码必须执行哪些操作来修复它所存在的迫使其在 Windows XP 兼容模式下运行的错误。

You can use the Microsoft Application Compatibility Toolkit, which will tell you exactly which Windows XP compatibility shims are used by your code when you run your application under Windows XP mode.

You simply run your application and disable various shims until your code once again behaves incorrectly. The last shim you disabled is the cause of the incorrect behavior. You can then research the exact consequences of each shim as well as exactly what your code will have to do to fix the bugs it has that force it to run in Windows XP Compatibility Mode.

白云悠悠 2024-09-07 23:03:14

您可能需要将应用程序清单添加到您的应用程序中以请求适当的安全权限允许您的应用程序执行其需要执行的操作。

如果需要提升权限,这可能会导致向用户显示 UAC 提示,但随后您的代码将被允许执行 Windows 7 当前阻止的任何操作。

You probably need to add an Application Manifest to your application to request the appropriate security permissions to allow your application to do what it needs to do.

This may cause a UAC prompt to be shown to the user if elevated permissions are needed, but then your code will be allowed to do whatever Windows 7 is currently blocking.

亚希 2024-09-07 23:03:14

如果您知道问题存在并且知道 Win7 上的 UAC /etc.../Manifest 不能解决您的问题并且它与 32/64 位问题无关,请尝试不同的方法。

我想您知道您的应用程序在 Windows 7 上出了什么问题。如果您不确定,至少您应该知道问题所在的位置(哪个逻辑块)(例如 IO 块、磁盘读/写块、Gui等等。

现在坚持使用调试器。希望您的程序不会太大,以至于您无法分析它并找到问题的根源。您可能会因为某些功能未按预期工作或类似的情况而遇到问题。

然后,我想,您可以重新思考/重新管理您的代码并更改它在两个平台上的工作方式。如果没有通用解决方案,请使用#ifdef 来确定您当前的平台(最坏的情况)。实际上,因为不同的 Windows 版本必须有不同的二进制文件)。

If you know that the problem exists and know that UAC / etc ... / Manifest on Win7 don't solve your problem and that it's not connected with 32/64 bit issues, try a different approach.

I guess you know what goes wrong with your app on Windows 7. If you're not sure exactly, at least you should know where (in which logical block) your problem is located (e.g IO block, Disk read/write block, Gui, etc.

Now stick to the debugger. Hope your program isn't that big that you can't analyze it and find the source of your problem. You could have your problems because of some functions working not as expected or something like that.

Then, I guess, you could rethink / remanage your code and change it the way it works on both platform. If there is no universal solution, use #ifdefs to determine your current platform (the worst case actually, because you would have to have different binary files for different windows versions).

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