What is the difference between CreateProcess and CreateProcessA?
what is the difference between CreateProcess and CreateProcessA, also are there any alternatives to these in VC++ 2008 ?
I have als开发者_运维问答o a problem, that i use the CreateProcessA function, this works well in one system but fails in other systems.
Also when i use CreateProcess i get the error cannot convert 2 parameter from 'CHAR[40]' to 'LPWSTR' i am in unicode mode
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.
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
is identical to either CreateProcessA
("ANSI") or to CreateProcessW
("Wide characters"), depending on whether you're compiling your code without or with the unicode option enabled.
The difference is whether the string which you pass as a parameter should be an ANSI (8-bit character) or a unicode (16-bit character) string.
There are also alternatives, like ShellExecuteEx
.
精彩评论