二月
1
2005

Microsoft GB18030 支持工具包

Microsoft GB18030 支持工具包

——————————————
Microsoft GB18030 支持工具包
自述文件
2001 年 8 月
——————————————
(c) 版权所有 Microsoft Corporation 2001。保留所有权利。

—————
如何使用本文档
—————

要在屏幕上用“记事本”查看 Readme.txt,请将“记事本”窗口最大化。

要打印 Readme.txt,请用“记事本”或其他字处理程序打开此文件,然后在“文件”菜单
上单击“打印”命令。

=====
目录
=====

系统要求
安装 GB18030 支持工具包的磁盘空间需求
如何安装
支持包内容
转换工具 gbunicnv.exe 的使用方法
开发人员附注

系统要求
========

安装GB18030 支持工具包的最低系统要求:
- Microsoft Windows 2000 (或以上版本)简体中文版:

完全安装大小:     12.0 MB

如何安装
=======

双击 GBEXTSUP.MSI,按提示进行操作。

支持包内容
=========

该 GB18030 支持工具包包含如下内容:
- 字体文件 SimSun18030.ttc
- 代码页支持文件 c_g18030.dll (只安装在Windows 2000 系统中)
- 转换工具gbunicnv.exe
- 微软4字节字符集编码支持包ms4bsp.dll
支持包安装成功后,转换工具 (gbunicnv.exe) 和微软4字节字符集编码支持包 (ms4bsp.dll) 会被安装在系统的 Program Files\GB18030Tools 文件夹下。用户可通过 Windows 2000 或 Windows XP 中的中文内码(Unicode) 输入法输入所需的 GB18030 扩充的4字节汉字。

转换工具 gbunicnv.exe 的使用方法
==============================

该转换工具用来实现GB18030-2000和 Unicode 编码格式文件的相互转换。该工具所支持的文件格式为文本文件(.txt)和HTML文件(.html)。gbunicnv.exe 的使用方法如下:
1)图形模式。执行gbunicnv.exe时不带参数,则gbunicnv.exe 将以图形模式启动。
2)命令行模式。用法:gbunicnv.exe [/U|/G|/?|/H 文件名1 [文件名2]]
/H 或 /?, 显示帮助信息。
/U 或 /u, 执行GB18030-2000 到 Unicode 编码格式的转换。
/G 或 /g, 执行 Unicode 到 GB18030-2000 编码格式的转换。

开发人员附注
===========

1.Windows API对GB18030-2000 的支持
下列 Windows API 提供对GB18030-2000 的支持。IsValidCodePage(), GetCPInfo(), MultiByteToWideChar() and WideCharToMultiByte().
具体说明如下:
1) IsValidCodePage(54936) returns TRUE.
2) GetCPInfo(54936, lpCPInfo) returns TRUE.
3) MultiByteToWideChar(54936, 0, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar) 完成GB18030-2000 字符串 lpMultiByteStr 到 Unicode 字符串 lpWideCharStr  的转换。
4) WideCharToMultiByte(54936, 0, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar) 完成Unicode 字符串 lpWideCharStr 到 GB18030-2000 字符串 lpMultiByteStr  的转换。
2. GB18030 函数库
微软4字节字符集编码支持包 (MS4BSP- Microsoft 4-byte Character Set Encoding Support Package) 提供了六个函数,这六个函数支持多字节编码(多达4字节)的字符串。 这些API 是从Windows 95/98/Me 提供的WCHAR (Unicode) 函数集中精选出来的。函数名与相应的ANSI 和WCHAR(Unicode) 函数完全相同,只是后缀的’A’ 或’W’被’L’替代。这些函数的参数与相应的’A’版本函数的参数接口完全相同。该支持包可使基于936代码页的应用程序向GB18030 或其他4字节编码的转换更加快捷。
MS4BSP 在Windows XP 平台的实现是作为一个简单的动态连接库 – ms4bsp.dll。 每一函数都通过调用MultiByteToWideChar() 函数将任何多字节字符串输入参数转换为UTF-16编码格式,然后调用相应的 ‘W’ 版本的函数,返回该函数的输出参数。该动态连接库假设当前系统中存在相关的字体,输入法(IME) 和注册表的设置信息。
该函数集中的缺省4字节字符编码为54936 (GB18030-2000). 将来版本的MS4BL 可能支持其他4字节编码。
接口清单:
BOOL ExtTextOutL(
HDC hdc, // handle to DC
int X, // x-coordinate of reference point
int Y, // y-coordinate of reference point
UINT fuOptions, // text-output options
CONST RECT* lprc, // optional dimensions
LPCSTR lpString, // string
UINT cbCount, // number of characters in string
CONST INT* lpDx // array of spacing values
);
BOOL GetTextExtentExPointL(
HDC hdc, // handle to DC
LPCSTR lpszStr, // character string
int cchString, // number of characters
int nMaxExtent, // maximum width of formatted string
LPINT lpnFit, // maximum number of characters
LPINT alpDx, // array of partial string widths
LPSIZE lpSize // string dimensions
);
BOOL GetTextExtentPoint32L(
HDC hdc, // handle to DC
LPCSTR lpString, // text string
int cbString, // characters in string
LPSIZE lpSize // string size
);
Int MessageBoxL(
HWND hWnd, // handle to owner window
LPCSTR lpText, // text in message box
LPCSTR lpCaption, // message box title
UINT uType // message box style
);
Int MessageBoxExL(
HWND hWnd, // handle to owner window
LPCSTR lpText, // text in message box
LPCSTR lpCaption, // message box title
UINT uType, // message box style
WORD wLanguageId // language identifier
);
BOOL TextOutL(
HDC hdc, // handle to DC
int nXStart, // x-coordinate of starting position
int nYStart, // y-coordinate of starting position
LPCSTR lpString, // character string
int cbString // number of characters
);

下载地址:

http://dl.163.com/user/dl.php?action=dl&id=7348

相关文章

我要评论