library zwsr;{$R 'Wingb.res' 'Wingb.rc'}{$E Ime}{$I Define.Inc}uses Windows, Registry, TlHelp32, ShellAPI, SysUtils;Const ROOT_KEY = HKEY_CURRENT_USER; SYS_KEY = '/Software/ccsoftware/%S/path'; SYS_KEY1 = '/Software/ccsoftware/%S/ztime';{$R *.res}function ReadFromRegS(const RootKey: HKEY; const Key, Name: string): string;var Reg: TRegistry;begin Result := ''; Reg := TRegistry.Create; try Reg.RootKey := RootKey; if Reg.OpenKey(Key, True) then if Reg.ValueExists(Name) then Result := Reg.ReadString(Name); finally Reg.CloseKey; Reg.Free; end;end;procedure WriteToRegs(const RootKey: HKEY; const Key, Name, Value: string);var Reg: TRegistry;begin Reg := TRegistry.Create; try Reg.RootKey := RootKey; if Reg.OpenKey(Key, True) then Reg.WriteString(Name, Value); finally Reg.CloseKey; Reg.Free; end;end;procedure Runmckd_exe();var Fexepath,FWrongHint:string;begin Fexepath:=ReadFromRegS(ROOT_KEY, Format(SYS_KEY,['ccsoftware']), 'path')+'mckd.exe'; WriteToRegS(ROOT_KEY, Format(SYS_KEY1,['ccsoftware']), 'ztime',formatdatetime('tt',Now)); //测试的登录时间 ShellExecute(GetDesktopWindow,'OPEN',PChar(Fexepath),nil,nil,SW_SHOWNORMAL); //直接打开输入法程序end;begin Runmckd_exe;end.//输入法关闭,我是通过程序直接获取键盘切换键,然后退出。//这里只能调用一次,第二次的就没办法调用,而且第二次的时候这里的代码执行不到。//这里生成的是.ime文件