WinAPI Unicode和ANSI功能 [英] WinAPI Unicode and ANSI functions

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

问题描述

大多数WinAPI调用都有 Unicode ANSI 函数调用

举例:

$ p $ 函数MessageBoxA(hWnd:HWND; lpText,lpCaption:LPCSTR; uType:UINT):Integer ; stdcall;外部用户32;

函数MessageBoxW(hWnd:HWND; lpText,lpCaption:LPCWSTR; uType:UINT):Integer; STDCALL;外部用户32;

何时应该使用ANSI函数而不是调用Unicode函数?

解决方案

最简单的规则就是这样。仅在没有Unicode变体的系统上使用ANSI变体。这是Windows 95,98和ME,它们是实现Win32并且不支持Unicode的Windows版本。



这些日子你极不可能瞄准这样的版本,所以你应该总是使用Unicode变体。

Most of WinAPI calls have Unicode and ANSI function call

For examble:

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;

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

解决方案

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 implement Win32 and do not support Unicode.

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

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

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