CreateProcess 和 CreateProcessA 之间有什么区别? [英] What is the difference between CreateProcess and CreateProcessA?

查看:34
本文介绍了CreateProcess 和 CreateProcessA 之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CreateProcess 和 CreateProcessA 之间有什么区别,在 VC++ 2008 中还有其他替代方法吗?

what is the difference between CreateProcess and CreateProcessA, also are there any alternatives to these in VC++ 2008 ?

我还有一个问题,我使用 CreateProcessA 函数,这在一个系统中运行良好,但在其他系统中失败.

I have also a problem, that i use the CreateProcessA function, this works well in one system but fails in other systems.

此外,当我使用 CreateProcess 时,我收到错误无法将 2 个参数从 'CHAR[40]' 转换为 'LPWSTR' 我处于 unicode 模式

Also when i use CreateProcess i get the error cannot convert 2 parameter from 'CHAR[40]' to 'LPWSTR' i am in unicode mode

推荐答案

首先,CreateProcess 是一个在 CreateProcessA 和 CreateProcessW 之间切换的宏,它们分别采用 ANSI 或 Unicode 中的字符串.这取决于您的项目构建设置(字符集项目属性)、Unicode 与多字节.通常,您希望使用 Unicode,因为这样可以实现全球化并添加允许更多受支持语言的选项.

First, CreateProcess is a macro that switches between CreateProcessA and CreateProcessW, which take strings in ANSI or Unicode, respectively. This depends on your project build settings (the character set project property), Unicode vs Multi-Byte. Generally, you want things to be in Unicode, as this allows for globalization and adds the option of allowing more supported languages.

从 char 转换为 LPCWSTR 的抱怨表明它需要一种 WSTR,或宽字符串或 unicode 字符串.一种解决方法是使用 _T("blahblah") 宏声明您的字符.

The complaint in converting from char to LPCWSTR shows that it's expecting a type of WSTR, or wide string, or unicode string. A workaround is to declare your chars using the _T("blahblah") macro.

这篇关于CreateProcess 和 CreateProcessA 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆