Autor Beitrag
greenhorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 68


D5
BeitragVerfasst: Sa 04.11.06 16:55 
Hallo Zusammen,

weiss jemand wie man einen String nach pWideChar konvertieren kann, damit ein Aufruf in dieser Art funktioniert

ausblenden Delphi-Quelltext
1:
2:
//function GetUserFromWindows: string; //deklaration
 rc := NetUserGetInfo(NIL, PwideChar(GetUserFromWindows), 3,Pointer(ui3));


für euere Hilfe herzlichen Dank.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 04.11.06 16:59 
Ich würde es mal mit PWideChar(WideString(meinString)); probieren.

_________________
We are, we were and will not be.
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Sa 04.11.06 17:00 
ausblenden Delphi-Quelltext
1:
rc := NetUserGetInfo(NIL, PwideChar(WideString(GetUserFromWindows)), 3,Pointer(ui3));					
greenhorn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 68


D5
BeitragVerfasst: Sa 04.11.06 17:13 
danke, funktioniert prima :-)

:beer:
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 04.11.06 17:39 
Und ich würde sagen (wie im anderen Thread): PChar(); reicht.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Sa 04.11.06 17:48 
Kannst auch PAnsiChar nehmen - vom Prinzip her. Aber Delphi meckert normalerwiese rum, wenn man anstatt einem PWideChar nur ein PChar genommen hat (umgekehrt normalerweise nicht). Inhaltlich ist es das gleiche (wie LongInt, Handle, Cardinal, ..., wo Delphi auch meckert bei unterschieden)
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 04.11.06 17:54 
Bei der Funktion funktionierts aber auch mir PChar.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
greenhorn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 68


D5
BeitragVerfasst: Sa 04.11.06 17:55 
@gta-place: bei pChar bringt er 'ne meldung inkompatible typen. reicht also nicht ganz :-)

es geht ja darum 'n ansi string in ein array of widechar zu bringen... das klappt mit der lösung

ausblenden Delphi-Quelltext
1:
PWideChar(WideString(meinString))					


hervorragend und da möcht ich nicht noch weiter experimentieren...

noch mal danke für eure unterstützung.
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Sa 04.11.06 17:59 
user profile iconGTA-Place hat folgendes geschrieben:
Bei der Funktion funktionierts aber auch mir PChar.

Hängt IMHO von der Compiler-Einstellung ab.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 04.11.06 17:59 
Achso.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Sa 04.11.06 18:09 
Bei D6, D9 und D10 isses meiner Erfahrung nach, dass er da rummeckert (bei Standard-Configs).