切换输入法的小程序,应用在触摸屏系统中,有诸多问题想请教,请高手们进来看看
我的触摸屏系统是ASP页面,下载了一个手写输入软件,由于200台触摸屏本身的问题,手写的功能几乎用不起来,我就用JS写了一个软键盘,所以现在需要能切换输入法的小程序,现在截面和切换的功能都出来了,就是不知道怎么实现切换好的输入法怎么应用在ASP的页面上,据说要调用API,我刚学DELPHI一天,嘿嘿,不会,望高手指点怎么实现,下面是我下载的代码,请多多指教:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,imm, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ComboBox1: TComboBox;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
function funOpenIME(PImeName:string):Boolean;
procedure pcdCloseIME;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{-----------------------------------------------------------------------------
Procedure: TForm1.Button1Click
Author: puha
Date: 2005-4-30
Arguments: Sender: TObject
Result: None
功能: 取得输入法
-----------------------------------------------------------------------------}
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
ComboBox1.Items.Clear;
for i:=0 to Screen.Imes.Count-1 do
begin
ComboBox1.Items.Add(Screen.Imes[i]);
end;
ComboBox1.ItemIndex:=0;
end;
{-----------------------------------------------------------------------------
Procedure: TForm1.Button2Click
Author: puha
Date: 2005-4-30
Arguments: Sender: TObject
Result: None
功能:
-----------------------------------------------------------------------------}
procedure TForm1.Button2Click(Sender: TObject);
begin
funOpenIME(ComboBox1.Text);
end;
{-----------------------------------------------------------------------------
Procedure: TForm1.Button3Click
Author: puha
Date: 2005-4-30
Arguments: Sender: TObject
Result: None
功能:
-----------------------------------------------------------------------------}
procedure TForm1.Button3Click(Sender: TObject);
begin
pcdCloseIME;
end;
{-----------------------------------------------------------------------------
Procedure: TForm1.funOpenIME
Author: puha
Date: 2005-4-30
Arguments: PImeName: string
Result: Boolean
功能: 打开指定名称的输入法
-----------------------------------------------------------------------------}
function TForm1.funOpenIME(PImeName: string): Boolean;
var
MyHKL:HKL;
i:integer;
begin
Result:=False;
if Trim(PImeName)='' then Exit;
if Screen.Imes.Count<=0 then Exit;
i:=Screen.Imes.IndexOf(PImeName);
if i<0 then
begin
ShowMessage('指定的"'+PImeName+'"输入法不存在');
Exit;
end;
MyHKL:=HKL(Screen.Imes.Objects[i]);
ActivateKeyboardLayout(MyHKL,KLF_ACTIVATE);
Result:=True;
end;
{-----------------------------------------------------------------------------
Procedure: TForm1.pcdCloseIME
Author: puha
Date: 2005-4-30
Arguments: None
Result: None
功能: //判断是否在中文状态,若是则关闭它
-----------------------------------------------------------------------------}
procedure TForm1.pcdCloseIME;
var
myhkl:hkl;
begin
myhkl:=GetKeyBoardLayOut(0);
if ImmIsIME(myhkl) then
immsimulateHotkey(handle,IME_CHotKey_IME_NonIME_Toggle);
end;
end.