如何在应用程序中更改windows ANSI apis的CP_ACP(0)? [英] How to change the CP_ACP(0) of windows ANSI apis in an application?
问题描述
我尝试使用一个dll库绘制文本,它只有ANSI版本封装的窗口ANSI API的接口,但我需要使用utf-8存储字符串数据。我不想使用MultiByte / WideChar函数转换字符串,因此我想要一种方法来更改我的应用程序中的CP_ACP,以便我可以输入字符串数据到ANSI apis。感谢。
I try to draw text using a dll library which has only interfaces of ANSI version encapsulated windows ANSI apis, but I need to store string data using utf-8. I don't want to convert strings using MultiByte/WideChar functions so I want an approach to change the CP_ACP in my application, so that I can input string data into ANSI apis. thanks.
ps:我不要更改系统默认代码页。
ps: I don't to change the system default codepage.
推荐答案
CP_ACP
表示系统Ansi代码页。您不能在每个进程或每个线程基础上更改它。它是一个系统范围的设置。如果DLL真的在内部依赖 CP_ACP
,那么你只有在与DLL交互时,才能将/从UTF-8转换为UTF-8。
CP_ACP
represents the system Ansi codepage. You cannot change that on a per-process or per-thread basis. It is a system-wide setting. If the DLL really is dependant on CP_ACP
internally, then you have no choice but to convert your from/to UTF-8 whenever you interact with the DLL.
这篇关于如何在应用程序中更改windows ANSI apis的CP_ACP(0)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!