移植 C++应用程序从XP到Vista/7
我有一个为 Windows XP 编写的 C++ 应用程序,我想将其移植到 Windows Vista/7 上使用。它使用一些 MFC(用于串行 I/O)和 ATL(用于 WMI),但它主要使用良好的老式 Windows API。移植应用程序时我应该记住哪些注意事项?谢谢。
I have a C++ application that I have written for Windows XP, and I would like to port it for use on Windows Vista/7. It uses some MFC (for serial I/O) and ATL (for WMI), but it primarily uses the good ol' fashioned Windows API. What are some of the got-yas I should keep in mind when porting my application? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能根本不需要做任何事情。一般来说,为 XP 编写的应用程序在 Vista 和 Windows 7 上运行良好。(设备驱动程序和其他此类低级代码可能是另一回事。)
您在 Vista 或 Windows 7 上运行它时遇到问题吗?你尝试过吗?
一些可能的问题:
You probably don't need to do anything at all. In general, applications written for XP run fine on Vista and Windows 7. (Device drivers and other such low-level code may be a different story.)
Are you having problems running it on Vista or Windows 7? Have you even tried?
Some possible gotchas:
应用程序兼容性工具包将帮助您发现应用程序移植到 Vista/Win 7 时可能遇到的问题:
http://www.microsoft.com/downloads/en/details.aspx?familyid=c4a25ab9-649d-4a1b-b4a7-c9d8b095df18&displaylang=en
The Application Compatibility Toolkit will help you spot issues your application might have porting to Vista/Win 7:
http://www.microsoft.com/downloads/en/details.aspx?familyid=c4a25ab9-649d-4a1b-b4a7-c9d8b095df18&displaylang=en
我赞同 Michael Burr 的建议,即使用 AppCompat 工具包,因为这会发现大多数可能的问题。一些一般经验规则:
c:\windows
、c:\program files
等。如果确实需要写入必须可供所有用户使用的数据,请使用CSIDL_COMMON_APPDATA
(默认情况下c:\ProgramData
)假设您无论如何都正确执行了大部分这些操作,那么我认为您支持 Vista/Win7 不会有任何重大问题。
I'd second Michael Burr's suggestion to use the AppCompat toolkit, as that will spot most of the likely problems. Some general rules of thumb:
c:\windows
,c:\program files
, etc. If you do need to write data that has to be available to all users, useCSIDL_COMMON_APPDATA
(c:\ProgramData
by default)Assuming that you do most of these things right anyway then I would think you won't have any major issues supporting Vista/Win7.