Autor Beitrag
W4yne
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 50



BeitragVerfasst: Sa 19.05.12 18:29 
Hallo,
ich stehe vor dem Problem, dass ich ein Programm starten möchte, welches Unicode Zeichen im Namen hat.

Mit einem normalen ShellExecute bzw ShellExecuteW wollte es nicht funktionieren.

Was muss ich bei Unicode alles beachten?

mfg W4yne


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Sa 19.05.2012 um 23:52
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19273
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 19.05.12 18:38 
Da ist die wichtigste Frage erst einmal welche Delphiversion du nutzt. Und dann natürlich wie dein Quelltext aussieht. Bei mir funktioniert das mit Delphi XE so problemlos:
Zitat:
ShellExecute(Handle, 'open', PChar(ExtractFilePath(ParamStr(0)) + '北京.exe'), nil, nil, SW_SHOWNORMAL);
(auf deutsch Peking.exe ;-))
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 19.05.12 20:32 
user profile iconW4yne hat folgendes geschrieben Zum zitierten Posting springen:
Mit einem normalen ShellExecute bzw ShellExecuteW wollte es nicht funktionieren.
Muss aber. Einen WideString übergeben hast du dann aber?

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
W4yne Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 50



BeitragVerfasst: So 20.05.12 15:44 
Version ist Delphi 2007.
Den Pfad extrahiere ich aus einem Text Feld, dass ich dann ShellexecuteW mit PWideChar (Glaub so heißt die Funktion)
übergeben.
Zum Testen hab ich gleich ein Programm verwendet, dass im Dateinamen dieses UniCodeZeichen verwendet, dass den Dateinamen verdreht. (U+202E)
Allerdings wollte das Programm nicht starten, im Explorer per Doppelklick ging es ohne Probleme.

mfg W4yne
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19273
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 20.05.12 16:53 
Normale Textfelder sind unter Delphi 2007 nicht unicodefähig.
Vor Delphi 2009 würde ich wenn irgend möglich auf Unicodeunterstützung verzichten. Mit den TNT-Controls ist das zwar möglich, aber ein enormer Aufwand und später bei einem Upgrade der Delphiversion noch einmal extrem viel Aufwand. Zumindest beruflich lohnt sich das wohl kaum...

Aber wenn du Unicode-Komonenten nutzt:
Wie sieht der Quelltext denn aus?
W4yne Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 50



BeitragVerfasst: Mo 21.05.12 11:05 
Danke mal für die vielen Antworten.

Quellcode besteht wie gesagt nur aus einem Textfeld, einen Button der bei OnClick ShellExecuteW ausführt, mehr nicht.

Beruflich ist es nicht, es ist nur für mich zum Spaß^^

Das Upgrade Problem ist kein Thema, habe nur Delphi 2007. Hättest du ein paar Informationen bezüglich TNT-Controls, oder wäre es besser C++ zu verwenden?

mfg W4yne
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19273
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 21.05.12 11:28 
Wenn da Unicode so wichtig ist, würde ich in der Tat zu C# raten, wenn das ohnehin nur wenig Quelltext ist (und dementsprechend kaum Portierungsaufwand).

Zu den TNTs gibt es nicht viel zu sagen, die verwendet man einfach statt der Standardkomponenten, aber es ist halt oft nervig. Bei so kleinen Progrämmchen sollte das aber egal sein...