如何为 CreateProcess() 启动的进程设置语言环境 [英] How to set the locale for a process launched by CreateProcess()

查看:33
本文介绍了如何为 CreateProcess() 启动的进程设置语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 CreateProcessW() 启动进程时,是否可以使用不同的 MBCP 语言环境/代码页创建进程,然后是配置为系统范围默认代码页的?在目标进程中,这应该与调用 _setmbcp() 具有相同的效果.

When launching a process with CreateProcessW(), is it possible to have the process created with a different MBCP locale/codepage then the one that is configured as the system-wide default code page? In the target process, this should have the same effect as calling _setmbcp().

目标进程不是启用 unicode 的,而是使用普通的 main(int argc, char **argv) 入口点.我希望能够选择将传递给 CreateProcessW() 的 unicode 参数转换到的代码页,以便与非 unicode 程序的系统默认代码页不同.

The target process is not a unicode-enabled and uses a plain main(int argc, char **argv) entry point. I would like to be able to select the code page to which unicode arguments passed to CreateProcessW() are converted to be different from the system's default codepage for non-unicode programs.

推荐答案

我相信(自从我不得不知道这一点已经很长时间了)子进程继承了父进程(或其中的线程)的语言环境-- 您是否尝试过切换线程区域设置、启动您的进程(然后切换回来)?

I believe (and it's been a long time since I've had to know this) the child process inherits the locale of the parent process (or thread therein) -- have you tried switching the thread locale, launching your process (and switching back)?

这篇关于如何为 CreateProcess() 启动的进程设置语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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