gpt4 book ai didi

Delphi - 获取Windows的默认非unicode字符集

转载 作者:行者123 更新时间:2023-12-03 15:50:26 25 4
gpt4 key购买 nike

我有一个 Delphi 7 应用程序。我需要能够获取非 unicode 程序的默认 Windows 字符集。我知道 DEFAULT_CHARSET 设置了它,但我需要确切地知道它是什么字符集,以便我可以将它与其他字符集进行比较。这可能吗?如何实现?

谢谢!

最佳答案

GetFontData 正在调用 GetObject 并使用 LogFont.lfCharSet 来确定字符集

GetObject called with HFONT将填充LogFont这里的定义是

DEFAULT_CHARSET is set to a value based on the current system locale. For example, when the system locale is English (United States), it is set as ANSI_CHARSET.

GetCPInfoEx with CP_ACP交付 CPINFOEX结构将提供系统默认Windows ANSI 代码页。

var
CPInfoEx:TCPInfoEx;
CD:Cardinal;
CharsetInfo:TCharSetInfo;
CSN:String;
begin
If GetCPInfoEx(CP_ACP,0,CPInfoEx) then
begin
CD := CPInfoEx.Codepage;
if TranslateCharsetInfo(CD,CharsetInfo,TCI_SRCCODEPAGE) then
begin
CharsetToIdent(CharsetInfo.ciCharset,CSN);
Showmessage(CPInfoEx.CodePageName+' - '+IntToStr(CharsetInfo.ciCharset)+' - '+CSN);
end;
end;
end;

关于Delphi - 获取Windows的默认非unicode字符集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15729116/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com