S
scottrayn
Unregistered / Unconfirmed
GUEST, unregistred user!
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, WinInet, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
//type
// buffer=array [2..1024] of char;
var
url:string;
myhinternet:HINTERNET;
hInternetFile:HINTERNET;
buffer:array[2..1024] of char;
dwBytesReadWord;
// myfile:Textfile;
s:string;
// i,j:integer;
sl:TStringList;
begin
dwBytesRead:=1024;
// url:='http://club.mir3.com.cn/newmir3/gallary/show.asp?ID=16289&Action=poll';
sl:=TStringList.Create;
//try
sl.LoadFromFile('voteurl.txt');
// for i:=0 to sl.Count-1 do
s:=sl.strings[1];
// ShowMessage(s);
url:=s;
//finally
//end;
myhinternet:=InternetOpen('Microsoft Internet Explorer',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
if myhinternet=NIL then
begin
showmessage('出错了');
exit;
end;
hInternetFile:=InternetOpenUrl(myhinternet,pchar(url), nil, 0, INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_TRANSFER_BINARY or INTERNET_FLAG_DONT_CACHE, 0);
if hInternetFile=NIL then
begin
showmessage('又错了');
exit;
end;
InternetReadFile(hInternetFile,@buffer,SizeOf(buffer),dwBytesRead);
InternetCloseHandle(myhinternet);
// sl.Free;
showmessage(url);
Application.Terminate;
end;
end.
//*******************************************
实际测试时:郁闷,同样的环境http://club.mir3.com.cn/newmir3/gallary/show.asp?ID=17056&Action=poll用程序就刷不了而http://club.mir3.com.cn/newmir3/gallary/show.asp?ID=16289&Action=poll缺可以,手工的话两个都可以,为啥? 知道的高喊一声哦
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, WinInet, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
//type
// buffer=array [2..1024] of char;
var
url:string;
myhinternet:HINTERNET;
hInternetFile:HINTERNET;
buffer:array[2..1024] of char;
dwBytesReadWord;
// myfile:Textfile;
s:string;
// i,j:integer;
sl:TStringList;
begin
dwBytesRead:=1024;
// url:='http://club.mir3.com.cn/newmir3/gallary/show.asp?ID=16289&Action=poll';
sl:=TStringList.Create;
//try
sl.LoadFromFile('voteurl.txt');
// for i:=0 to sl.Count-1 do
s:=sl.strings[1];
// ShowMessage(s);
url:=s;
//finally
//end;
myhinternet:=InternetOpen('Microsoft Internet Explorer',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
if myhinternet=NIL then
begin
showmessage('出错了');
exit;
end;
hInternetFile:=InternetOpenUrl(myhinternet,pchar(url), nil, 0, INTERNET_FLAG_NO_CACHE_WRITE or INTERNET_FLAG_TRANSFER_BINARY or INTERNET_FLAG_DONT_CACHE, 0);
if hInternetFile=NIL then
begin
showmessage('又错了');
exit;
end;
InternetReadFile(hInternetFile,@buffer,SizeOf(buffer),dwBytesRead);
InternetCloseHandle(myhinternet);
// sl.Free;
showmessage(url);
Application.Terminate;
end;
end.
//*******************************************
实际测试时:郁闷,同样的环境http://club.mir3.com.cn/newmir3/gallary/show.asp?ID=17056&Action=poll用程序就刷不了而http://club.mir3.com.cn/newmir3/gallary/show.asp?ID=16289&Action=poll缺可以,手工的话两个都可以,为啥? 知道的高喊一声哦