![]() |
Re: GetProxyInformation unter Delphi 2009
Macht es denn dann Sinn, die Unicode-Version von InternetQueryOption aufzurufen, um dann doch Ansi-Strings zurückzubekommen? Dann könnte man auch gleich InternetQueryOptionA verwenden, oder habe ich gerade einen Knick im Hirn?
|
Re: GetProxyInformation unter Delphi 2009
Hast natürlich recht, aber die Variante mit InternetQueryOption funktioniert so nicht, da das standardmäßig die Widestring-Variante ist.
Man muss den Code also explizit auf Ansi umstellen, also nicht nur InternetQueryOptionA, sondern auch PInternetProxyInfoA:
Delphi-Quellcode:
function GetProxyInformation: AnsiString;
var ProxyInfo: PInternetProxyInfoA; Len: LongWord; begin Result := ''; Len := 4096; GetMem(ProxyInfo, Len); try if InternetQueryOptionA(nil, INTERNET_OPTION_PROXY, ProxyInfo, Len) then begin if ProxyInfo^.dwAccessType = INTERNET_OPEN_TYPE_PROXY then begin Result := ProxyInfo^.lpszProxy; end; end; finally FreeMem(ProxyInfo); end; end; |
Re: GetProxyInformation unter Delphi 2009
OK, das ist einzusehen.
|
Re: GetProxyInformation unter Delphi 2009
Nochmal zur Vervollständigung:
In meiner Windows.pas (Delphi 2009, Update 2) ist LPCTSTR folgendermaßen definiert:
Delphi-Quellcode:
Das sollte also eigentlich sowohl mit D2007, als auch mit D2009 funktionieren.
LPCTSTR = {$IFDEF UNICODE}PWideChar{$ELSE}PAnsiChar{$ENDIF};
Tuts aber leider nicht, da bei Benutzen von PWideChars und InternetQueryOptionW das oben beschriebene Problem auftritt und unter D2009 nur Müll zurückgegeben wird. Der Fehler muss also noch irgendwo anders sein, aber egal, da mir die Ansi-Variante ausreicht. |
Re: GetProxyInformation unter Delphi 2009
Ich habe mal einen Report in Quality Central für die UNICODE-Variante unter Delphi 2009 erstellt, zu finden unter:
![]() |
Re: GetProxyInformation unter Delphi 2009
Der Issue wurde (angeblich) in D2010 gefixt:
Resolution Full Name Date Changed Build Fixed QC<->Raid Replicator Account 8/27/2009 5:14:37 PM 14.0.3448.21948 Comment: Status pulled automatically from the internal system Muss ich mal ausprobieren, wenn ich auf D2010 upgrade... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:24 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz