Windows 相关
来源:互联网 发布:美折促销软件 编辑:程序博客网 时间:2024/05/21 19:43
上位机兼容性
- IDE: Visual Studio 2013 or Visual Studio Community 2017
- Tools: eXeScope
问题说明: 上位机升级软件无法在 Windows XP 运行,运行提示为 不是有效的 WIN32 应用程序
;
解决过程: 用 eXeScope 查看 exe
信息
要求系统主版本 6
,查得对应的操作系统为 Windows Vista
List of Microsoft Windows versions
之后在 Visual Studio Community 2017 项目属性中作如下修改,使其对 Windows XP 兼容;
- 修改平台工具集: 使用兼容 XP 的工具链
- 静态编译: 避免目标电脑缺少动态链接库,否则可能会提示
缺少 ***.dll
;代价就是程序体积大一些,但对于简单的上位机软件来讲还是很方便,程序过大时可以考虑将程序和所缺失的DLL 一起打包安装到目标电脑。
之后运行仍然报错,提示 无法定位程序输入点 CoGetApartmentType 于动态链接库 ole32.dll
比较 Windows XP 和 Windows 10 的 ole32.dll,的确少了 CoGetApartmentType 函数
Object Linking and Embedding(OLE): 允许开发者嵌入或链接 Windows 文件和对象;这样看来系统版本的差异在此体现出来,这种情况只能在源代码中跟踪 CoGetApartmentType 调用点,将其稍微做一下修改,不要使用该函数;一般而言 Windows 系统版本的不会影响到基础接口的功能,只会做一些辅助性功能的补充,所以基本上可以通过修改代码达到兼容性。
然后再回过头来看看 CoGetApartmentType 的作用,官网有如下两句话:
Returns the current apartment type and type qualifier
In multithreaded scenarios, there is a race condition which can potentially cause an Access Violation within the process when executing the above sequence of operations. The CoGetApartmentType function is recommended as it does not potentially incur the Access Violation
具体意思不太清楚,不管好像不是关键性函数。
结论猜测
- 如果不行,尝试升级到 Windows XP SP3
- COM(Component Object Model) 组件必须动态链接,这也许可以解释为什么静态编译不能将 Ole32.dll,OLENUT32.dll 包括进去;(其实 kernel32.dll 也不行,有可能其作为系统的核心文件不允许这种操作)
- 如果上述方法还是解决不了,可以尝试让程序优先链接程序运行目录的 DLL(可行性尚不清楚,笔者未成功)
- Windows相关
- Windows相关
- windows 相关
- Windows相关
- Windows 相关
- Windows Rootkit相关链接
- windows 相关信息
- windows相关命令
- windows安全相关
- Windows PowerShell 1.0 相关
- Windows Mobile 相关
- Windows内存管理相关
- Windows相关问题总结
- windows程序设计相关思想
- windows 相关命令
- windows 图形相关函数
- Windows域相关命令
- Windows 8开发 相关
- Netty,Kafka,Muduo关于时间轮的一些思考 之Muduo时间轮
- SQL 优化
- 文章标题
- C#客户端发送Http请求与服务端通信
- 潜力
- Windows 相关
- 常用Sql
- JAVA的修饰符FINAL详解
- android隐藏标题栏/状态栏
- 人工智能时代的新“文盲”:学不懂Python,就看不到未来
- ES7 await/async
- Error:Failed to open zip file错误的解决方法
- 前端小白--web前端ajax请求
- 史上最全的架构师图谱