Autor Beitrag
JayK
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Mi 24.05.06 18:39 
Hallo,

wie sicherlich jeder weiß, gibt ExtractFilePath einen Ansi-String zurück.
Jetzt suche ich eine Möglichkeit das sicher in einen WideString umzuwandeln, oder eine WideString-kompatible Ersatzmethode für ExtractFilePath (so wie ShellExecute -> ShellExecuteW, wie es uns bei Killprocess neulich geholfen hat).

Die Warnmeldung, die er mir momentan ausspuckt lautet:
[Warnung] bak.dpr(62): W1044 Bedenkliche Typumwandlung von string in PWideChar
bei
ausblenden Delphi-Quelltext
1:
2:
3:
4:
ShellExecuteW(0, 'open', PWideChar(SevenZipPath),
      PWideChar('u -mx=9 -ms=off -x!thumbs.db "' + ParamStr(2) + '" "' +
        TempDir + '\*"'),
      PWideChar(ExtractFilePath(ParamStr(0))), SW_SHOWNORMAL);


Danke für eventuelle Antworten, ich hoffe ich war nicht wieder blind beim suchen :lupe:
JayK

Moderiert von user profile iconGausi: URL-Tags korrigiert.
Ydobon
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 42



BeitragVerfasst: Mi 24.05.06 20:08 
Mach vorher einen WideString daraus: PWideChar(WideString(Extra..., dann meckert der Compiler nicht mehr.
Eine Funktion WideExtractFilePath gibt es z.B. bei den Tnt Unicode Controls.
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Mi 24.05.06 20:11 
Ah super Danke :)
Da ich ne (relativ) schmale konsolenanwendung schreiben will, lass ich die TNTs lieber raus.