如何在整个VB 6.0应用程序中支持Unicode字符

我在VB 6.0应用程序中遇到了Unicode字符不支持的问题.我需要在我的应用程序中的记录集字段中设置中文字符 – (每个字段的大小是从程序本身设置的).如果我们将中文字符设置到记录集字段中,则会出现多步操作错误(因为保持字段大小不够).如果我们从服务器控制面板的区域设置中将语言设置为中文(控制面板>区域和语言设置>管理选项卡>更改系统区域设置…>到中文),则不会触发此错误

如果我们设置这个,那么我们的应用程序的时间设置将会改变.我需要一些帮助,从控制面板更改我们如何解决这个问题.

请帮忙.

提前致谢.

解决方法

Windows中,您可以将区域设置设置为中文,同时保留时间和日期格式. http://www.techpavan.com/2009/04/07/change-time-format-windows/

为了在Visual Basic 6应用程序中使用Unicode,这里有一篇文章,详尽的解释和示例:http://www.example-code.com/vb/vbUnicode1.asp

引用此链接:

Internally,VB6 stores strings as Unicode. Your VB6 program is capable of manipulating strings in any language containing any character — whether it’s Chinese,Japanese,Icelandic,Arabic,etc. It’s fully Unicode capable. A single string may contain characters in multiple languages. You can save these strings to databases,files,etc.,and there shouldn’t be a problem. Problems arise only when trying to display (i.e. render the glyphs) for foreign characters in the standard VB6 controls.

When displaying a string,the standard VB6 textbox and label controls do an implicit (and internal) conversion from Unicode to ANSI. This is the confounding behavior that causes all the trouble. Internal to VB6,the runtime is converting Unicode to the current Windows ANSI code page identifier for the operating system. There is no way to change this conversion short of changing the ANSI code page for the system.

The standard VB6 textbox and label controls display the ANSI bytes according to a character encoding that you can specify. After the Unicode-to-ANSI conversion,VB6 then attempts to display the character data according to the control’s Font.Charset property,which if left unchanged is equal to the ANSI charset. Changing the control’s Font.Charset changes the way VB6 interprets the “ANSI” bytes. In other words,you’re telling VB6 to treat the bytes as some other character encoding instead of “ANSI”. Note: VB6 is capable of displaying characters in all the major languages. It simply needs to be told to do so,and the correct bytes need to be in place internally for it to happen.

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...