WinAPI Unicode 和 ANSI 函数 [英] WinAPI Unicode and ANSI functions

查看:37
本文介绍了WinAPI Unicode 和 ANSI 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数WinAPI调用都有UnicodeANSI函数调用

Most of WinAPI calls have Unicode and ANSI function call

例如:

function MessageBoxA(hWnd: HWND; lpText, lpCaption: LPCSTR; uType: UINT): Integer; stdcall;external user32;

function MessageBoxW(hWnd: HWND; lpText, lpCaption: LPCWSTR; uType: UINT): Integer; stdcall; external user32;

我什么时候应该使用 ANSI 函数而不是调用 Unicode 函数?

When should i use the ANSI function rather than calling the Unicode function ?

推荐答案

要遵循的最简单的规则是:仅在没有 Unicode 变体的系统上使用 ANSI 变体.那是在 Windows 95、98 和 ME 上,它们是不支持 Unicode 的 Windows 版本.

The simplest rule to follow is this: Only use the ANSI variants on systems that do not have the Unicode variant. That is on Windows 95, 98 and ME, which are the versions of Windows that do not support Unicode.

如今,您极不可能以此类版本为目标,因此您应该始终只使用 Unicode 变体.

These days, it is exceptionally unlikely that you will be targeting such versions, and so in all probability you should always just use the Unicode variants.

这篇关于WinAPI Unicode 和 ANSI 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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