Y
yxhua240
Unregistered / Unconfirmed
GUEST, unregistred user!
拼音/五笔码 转到 DELPHI2009{$R wbtext.res} //资源文件,必须 function get_hz_pywb(hzstr: string; pytype: integer): string; var I: Integer; allstr: string; hh: THandle; pp: pointer; ss: TStringList; function retturn_wbpy(tempstr: string; tqtype: integer): string; var outstr, str: string; i: integer; begin //################### 汉字查询电位 i := 0; while i <= ss.Count - 1 do begin str := ss.Strings; if (tempstr = trim(str[1] + str[2])) or (tempstr = trim(str[3] + str[4])) then begin str := ss.Strings; Break; end; i := i + 1; end; //################### outstr := ''; //提取编码 if tqtype = 1 then begin for i := pos('①', str) + 2 to pos('②', str) - 1 do if str <> '' then if outstr = '' then outstr := str else outstr := outstr + str; end; if tqtype = 2 then begin for i := pos('②', str) + 2 to pos('③', str) - 1 do if str <> '' then if outstr = '' then outstr := str else outstr := outstr + str; end; if tqtype = 3 then begin for i := pos('③', str) + 2 to pos('④', str) - 1 do if str <> '' then if outstr = '' then outstr := str else outstr := outstr + str; end; if tqtype = 4 then begin for i := pos('④', str) + 2 to length(str) do if str <> '' then if outstr = '' then outstr := str else outstr := outstr + str; end; Result := trim(outstr); end; begin //加载资源文件,将内容赋值给 s ss := TStringList.Create; hh := FindResource(hInstance, 'mywb', 'TXT'); hh := LoadResource(hInstance, hh); pp := LockResource(hh); ss.Text := pchar(pp); UnLockResource(hh); FreeResource(hh); allstr := ''; i := 0; while i <= length(hzstr) do //提取汉字字符 begin if (Ord(hzstr) > 127) then begin if allstr = '' then allstr := retturn_wbpy(hzstr + hzstr[I + 1], pytype) else allstr := allstr + retturn_wbpy(hzstr + hzstr[I + 1], pytype); i := i + 2; end else begin if allstr = '' then allstr := hzstr else allstr := allstr + hzstr; i := i + 1; end; end; ss.Free; Result := trim(allstr); end; 请教:怎么转为DELPHI2009 可以运行?需要改动哪些CODE?