vinch81
asked on
detect the proxy adrress and port at the run time
hi all,
im using idHttp to get a file from the internet. Im using proxy server... so, i have to request from proxy address before I send the get request.
here is my code :
IdHTTP1.Request.ProxyServe r := ProxyAddress;
IdHttp1.Request.ProxyPort := ProxyPort;
HTMLContent := IdHTTP1.Get(IEAddress);
my question is, can I detect the proxy address and the port automatically at the run time ? so that the user doest need to key in the address and the port number ?
thanks :D
im using idHttp to get a file from the internet. Im using proxy server... so, i have to request from proxy address before I send the get request.
here is my code :
IdHTTP1.Request.ProxyServe
IdHttp1.Request.ProxyPort := ProxyPort;
HTMLContent := IdHTTP1.Get(IEAddress);
my question is, can I detect the proxy address and the port automatically at the run time ? so that the user doest need to key in the address and the port number ?
thanks :D
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
whoa.. what a big procedure there =p
okay, i think im going to try the second one first :D
anyway, i tried to use that but didn't work...
what should I put in the top uses list .?
i tried to put " registery " there. it wont run, it give me error : file not found : registry.dcu
humm... how can I solve this ?
thank yahh ^^
okay, i think im going to try the second one first :D
anyway, i tried to use that but didn't work...
what should I put in the top uses list .?
i tried to put " registery " there. it wont run, it give me error : file not found : registry.dcu
humm... how can I solve this ?
thank yahh ^^
For second one
uses registry in the uses clause,
It should work
You have used registery but it is registry
please try once more
uses registry in the uses clause,
It should work
You have used registery but it is registry
please try once more
ASKER
ooppppssss okok i'll try again than :D
ASKER
okayyy it's work just fine ;);)
thanks alot....
btw, if I run this procedure in the computer without proxy connection... what value will I get .??
thanks alot....
btw, if I run this procedure in the computer without proxy connection... what value will I get .??
You will not have any value in it
ASKER
okayy... Thanks alot for your help ;)
ASKER
uhmmm just courious, is there any way that I can manually open the registry file ?
cos I know nothing abt this and I have to write abt this =p
cos I know nothing abt this and I have to write abt this =p
For more help search "WinHttpGetIEProxyConfigFo
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls;
type
PWinHttpCurrentUserIeProxy
TWinHttpCurrentUserIeProxy
fAutoDetect : boolean;
lpszAutoConfigUrl : PWideChar;
lpszProxy : PWideChar;
lpszProxyBypass : PWideChar;
end;
TWinHttpGetIeProxyConfigFo
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
WinHttpGetIeProxyConfigFor
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
var
H: THandle;
Config: TWinHttpCurrentUserIeProxy
begin
H := LoadLibrary ('winhttp.dll');
if H <> 0 then
try
@WinHttpGetIeProxyConfigFo
if Assigned (WinHttpGetIeProxyConfigFo
WinHttpGetIeProxyConfigFor
ShowMEssage(Config.lpszPro
finally
FreeLibrary (H);
end;
end;
end.