Solved

How can I have my Delphi 5 app able to let chinese characters be entered

Posted on 2002-05-31
6
438 Views
Last Modified: 2007-12-19
Hi,

How can I have my Delphi 5 app able to support users entering Chinese characters and other "difficult" languages?

I have heard about that Unicode components may be needed but I don't know of a good replacement set of replacement components (TEdit, TMemo, TLabel, etc).  I don't want to rewrite my app to make it able to do this.

However, I found something on the Borland web site which suggests that Delphi 6 can do this:

http://community.borland.com/article/0,1410,28189,00.html

If Delphi 5 can't display asian characters, what use would be the IMEMode, IMEName and BiDiMode?

Have had a lot of trouble finding useful information about this on the Internet.

Help!

Thanks,
MP
0
Comment
Question by:mikepj
6 Comments
 
LVL 22

Accepted Solution

by:
mnasman earned 200 total points
Comment Utility
0
 

Expert Comment

by:sunrains
Comment Utility
intersted,too!
r u chinese?
which city ?
0
 
LVL 2

Author Comment

by:mikepj
Comment Utility
Nope; not Chinese; we only speak English here!

Will look at the unicode address
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:pnh73
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from mnasman

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0
 
LVL 1

Expert Comment

by:pnh73
Comment Utility
Thank you for your response

Paul (pnh73)
EE Cleanup Volunteer
0
 
LVL 2

Author Comment

by:mikepj
Comment Utility
for sure this works with delphi 5 and later.  probably from delphi 3 onwards.  it seems to work famously!  have tried it with chinese windows.  if you use a copy of windows that is not on its primary language, it doesn't behave quite right.  haven't found a solution to that yet.

// added this to each form's .pas file:
uses
  ...., uLanguage;

called the following sometime before form is shown:

    FormLanguageInit(self);

// add this .pas file to your project
unit uLanguage;

interface

uses
  windows, forms, sysutils, graphics;

procedure FormLanguageInit(frm:TForm);
procedure FrameLanguageInit(fra:TFrame);

implementation

type
 TLanguage = 0..$FFFF;

// delphi-supplied api call header is supposedly incorrect
function TranslateCharsetInfo(lpSrc: Pointer; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall; external gdi32;

function CodePageFromLocale(Language: TLanguage): Integer;
var
  Buf: array[0..6] of Char;
begin
  GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6);
  Result:= StrToIntDef(Buf, GetACP);
end;

function CharSetFromLocale(Language: TLanguage): TFontCharSet;
var
  CP: Integer;
  CSI: TCharsetInfo;
begin
  CP:= CodePageFromLocale(Language);
  TranslateCharsetInfo(Pointer(CP), CSI, TCI_SRCCODEPAGE);
  Result:= CSI.ciCharset;
end;

procedure FormLanguageInit(frm:TForm);
begin
  frm.Font.Charset:=CharSetFromLocale(SysLocale.PriLangID);  
end;

procedure FrameLanguageInit(fra:TFrame);
begin
  fra.Font.Charset:=CharSetFromLocale(SysLocale.PriLangID);  end;

end.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now