欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
How to write Unicode WIN32 applications with Delphi

How to write Unicode WIN32 applications with Delphi

This document describes the basic steps that you should perform if you want to change you application fully Unicode enabled.

You do not have to change you application to Unicode application if you plan to localize it to Asian languages. A standard Ansi Delphi application can be localized to Asian languages just fine. However if you want to run you application in Japanese on Western Windows it has to be a Unicode application. Otherwise all strings will show incorrectly as mojibake strings.

If you want to localize your application to a language that has not code page support such as Hindi you have to make you application Unicode enabled.

Before you start changing you application from Ansi to Unicode carefully think if you or your customers have a need to run your application on different languages than their Windows or you need to localize for language that has not code page support. Remember that most western languages use the same code page and are compatible to each other. This means that you can run German application on French or English Windows and vice versa.

Use inherited forms

When you write properly internationalized code you have to change the default behaviors of each form and frame. This is why you better derive an abstract form from TForm and derived all your forms from this form. Do same form frame. This makes it easy to initialize the form in the constructor of the base form.

Use an Unicode library

Current VCL components do not support Unicode. The reason is that every string property is type as String and not WideString. In order to make your application fully Unicode enabled you can not use the standard VCL components such as TLabel, TEdit, etc. Instead you have to use Unicode enabled controls. This will be changed in Delphi 2008. Currently there are two Unicode enabled component libraries. They are:

Library URL
TMS Unicode Component Pack http://www.tmssoftware.com/tmsuni.htm
LMD ElPack http://www.lmdinnovative.com/products/lmdelpack/

Both component libraries provide full set of Unicode enabled components. TMS components names and properties are almost identical to the original VCL components so it is easy to convert existing Ansi forms form Unicode forms. ElPack component names are a bit different so converting is little bit harder.

Convert you existing forms

In many cases you have an existing project that you want to convert to Unicode project. At first replacing all existing components may seem very complicated but it is actually very easy. This how it is done.

  1. Install the Unicode component library to Delphi's component palette.
  2. Open the form that you want to convert
  3. Change to text view. Right click the form and choose View as Text.
  4. Change the component type names from original VCL names to Unicode names. For example if you use TMS components change TLabel to TTntLabel, TEdit to TTntEdit and TButton to TTntButton.
  5. Change back to form view. Right click the form and choose View as Form.
  6. Move form a bit to make it dirty and save it. Delphi will show an error message telling the component type names in the form and source do not match.

    Press Yes to convert the type name in the source to match the form's type name. This error message is show once for each component you changed.

If you use TMS controls change the base form of each form from TForm to TTntForm. If you use ElPack add TElFormCaption to each form.

Change you internal string data from String to WideString

Keep all internal data in Unicode. This means use WideString instead of String whenever you handle strings.

Keep in mind that VCL automatically converts WideString to AnsiString. This will make some of all data to be corrupted if it contains above ASCII character and the system code page of your Windows does not match the default code page of the string data.

Sometimes you have to use Ansi string. Use AnsiString instead of String. This makes it easier to pinpoint the placed that have already been checked. Whenever you see String variable you have to decided if you change this to WideString or AnsiString.

Unicode file names

Handle all file names as WideString. Use the dialog components and system functions of your Unicode library instead of the standard VCL components and functions. For example if you had

if FileExists(fileName) thenbegin ...end;

Change it to (if you use TMS)

if WideFileExists(fileName) thenbegin ...end;

Use Unicode version WIN32 API

Whenever you call WIN32 API check if there is a Unicode version of the API. The Unicode version has the same name except its has W at the end of the function name. For example if you has the following code

function IsFileReadOnly(const fileName: String): Boolean;begin Result := FileExists(fileName) and ((GetFileAttributes(PChar(fileName)) and FILE_ATTRIBUTE_READONLY) <> 0);end;

Change it to

function IsFileReadOnly(const fileName: WideString): Boolean;begin Result := WideFileExists(fileName) and ((GetFileAttributesW(PWideChar(fileName)) and FILE_ATTRIBUTE_READONLY) <> 0);end;

Following these simple steps you can easily change you existing Ansi application into Unicode application.

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
使用Delphi自帶的TDockTabSet組件實(shí)現??抗δ埽↗eremy North) ...
Delphi中安裝和使用KOL和MCK
C#跨線(xiàn)程更改Form中控件的屬性
文件上傳自寫(xiě)代碼實(shí)現servlet3.0,part
Delphi XE7實(shí)現的登錄窗體的正確用法示例
delphi的UTF8相關(guān)函數
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久