Registriert seit: 6. Nov 2009
493 Beiträge
FreePascal / Lazarus
|
AW: Suche Unicode ersatz für AnsiSameText?
4. Aug 2010, 20:58
Also es geht um eine Drag & Drop Funktion. Vllt poste ich den danzen Code.
Ich kann die .crp* Datei nicht laden wenn sie kyrillischen Namen hat. Weiß jetzt nicht genau woran es liegt.
Delphi-Quellcode:
procedure TForm1.WMDROPFILES(var Msg: TMessage);
var j, zaehler: Cardinal;
Buffer, Extension: String;
i: Integer;
List, List2 : TTntStringList;
begin
inherited;
Buffer := '';
zaehler := DragQueryFile(Msg.WParam, $FFFFFFFF, nil, 0);
for j := 0 to zaehler - 1 do
begin
SetLength(Buffer, DragQueryFile(Msg.WParam, j, nil, 0) + 1);
DragQueryFile(Msg.WParam, j, @Buffer[1], Length(Buffer));
Extension := ExtractFileExt(Buffer);
end;
DragFinish(Msg.WParam);
//Laden
wideshowmessage(ExtractFileExt(Buffer));
if WideSameText(Trim(ExtractFileExt(Buffer)), '.crpu') or WideSameText(Trim(ExtractFileExt(Buffer)), '.crp') or WideSameText(Trim(ExtractFileExt(Buffer)), '.ccr') then
begin
List:=TTntStringList.Create;
try
List.LoadFromFile(Buffer);
if ListBox1.Count<>0 then
begin
if WideMessageDlg(_('Retain existing stations list?'), mtConfirmation, [mbYes, mbNo], 0) = mrNo then
begin
ListBox1.Clear;
ListBox2.Clear;
ListBox3.Clear;
ListBox4.Clear;
end;
end;
if WideSameText(Trim(ExtractFileExt(Buffer)), '.crpu') or WideSameText(Trim(ExtractFileExt(Buffer)), '.crp') then
begin
for i:=0 to List.Count-1 do
begin
List2:=Explode('<>', List[i]);
ListBox1.Items.Insert(i, List2[1]);
ListBox2.Items.Insert(i, List2[2]);
ListBox3.Items.Insert(i, List2[3]);
ListBox4.Items.Insert(i, List2[4]);
List2.Free;
end;
end else
begin
for i:=0 to List.Count-1 do
begin
List2:=Explode('=', List[i]);
ListBox1.Items.Insert(i, List2[1]);
ListBox2.Items.Insert(i, List2[2]);
ListBox3.Items.Insert(i, List2[3]);
ListBox4.Items.Insert(i, List2[4]);
List2.Free;
end;
end;
finally
List.Free;
end;
end;
end;
|
|
Zitat
|