procedure StringToMultiByte(s: string; var buf: array of word; bufstr: integer;
size: integer);
var
pos, len: integer;
low, high: word;
num: integer;
begin
num := bufstr;
pos := 1; // string start pos always is 1;
len := length(s);
while pos <= len do
begin
if num < (size - 1) then
begin
high := byte(s[pos]);
if high > 128 then // ºº×Ö
begin
low := byte(s[pos + 1]);
buf[num] := (high shl 8) + low;
inc(pos, 2);
end
else
begin // Ó¢ÎÄ
buf[num] := high;
inc(pos, 1);
end;
inc(num, 1);
end
else
begin
buf[num] := 0;
break;
end;
end;
buf[num] := 0;
end;