自己将她切换掉前的输入法机录下来,然后再放回去uses imm.代码自己写。类似于这样 procedure TForm1.Button1Click(Sender: TObject); var myhkl:hkl; begin myhkl:=GetKeyBoardLayOut(0); if ImmIsIME(myhkl) then //判断是否在中文状态,若是则关闭它 immsimulateHotkey(handle, IME_CHOTKEY_IME_NONIME_TOGGLE); end;
错了,是DELPHI有个BUG吧(也不知道是不是DELPHI的BUG), 在DBGrids.pas内procedure TCustomDBGrid.WMKillFocus(var Message: TMessage); begin if SysLocale.FarEast then inherited else begin ImeName := Screen.DefaultIme; ImeMode := imDontCare; inherited; if not ((InplaceEditor <> nil) and (HWND(Message.WParam) = InplaceEditor.Handle)) then ActivateKeyboardLayout(Screen.DefaultKbLayout, KLF_ACTIVATE); end; end;
procedure TForm1.Button1Click(Sender: TObject);
var
myhkl:hkl;
begin
myhkl:=GetKeyBoardLayOut(0);
if ImmIsIME(myhkl) then
//判断是否在中文状态,若是则关闭它
immsimulateHotkey(handle,
IME_CHOTKEY_IME_NONIME_TOGGLE);
end;
在DBGrids.pas内procedure TCustomDBGrid.WMKillFocus(var Message: TMessage);
begin
if SysLocale.FarEast then inherited
else
begin
ImeName := Screen.DefaultIme;
ImeMode := imDontCare;
inherited;
if not ((InplaceEditor <> nil) and
(HWND(Message.WParam) = InplaceEditor.Handle)) then
ActivateKeyboardLayout(Screen.DefaultKbLayout, KLF_ACTIVATE);
end;
end;
在指定的位置,也就是要输入中文的地方可以接其他的控件,如dbedit,edit等来实现所说的
在celldraw事件中