GetLocaleInfo获取信息

GetLocaleInfo函数用于获取指定区域设置的信息,如语言标识。本文提供了使用示例和函数详细说明,建议使用GetLocaleInfoEx以支持更多地区。返回值表示成功时返回的数据字符数,失败则为0,可能的错误包括缓冲区不足或参数无效。
摘要由CSDN通过智能技术生成

function mGetLanguage:string;
var
  mBuf: array[0..255] of char;
begin
  GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_ILANGUAGE,mBuf,256);
  Result:=StrPas(mBuf);
end;

使用示例:ShowMessage(mGetLanguage)

 

查看winapi.windows

{$EXTERNALSYM GetLocaleInfo}
function GetLocaleInfo(Locale: LCID; LCType: LCTYPE; lpLCData: LPWSTR; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfoA}
function GetLocaleInfoA(Locale: LCID; LCType: LCTYPE; lpLCData: LPSTR; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfoW}
function GetLocaleInfoW(Locale: LCID; LCType: LCTYPE; lpLCData: LPWSTR; cchData: Integer): Integer; stdcall;

实际引用GetLocaleInfoW函数

 

https://docs.microsoft.com/zh-cn/windows/desktop/api/winnls/nf-winnls-getlocaleinfow

GetLocaleInfoW function

  • 2018/12/05
  • 2 分钟阅读时长

Retrieves information about a locale specified by identifier.

Note  For interoperability reasons, the application should prefer the GetLocaleInfoEx function to GetLocaleInfo because Microsoft is migrating toward the use of locale names instead of locale identifiers for new locales. Any application that runs only o

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值