procedure TForm1.FormCreate(Sender: TObject); var url:string; myhinternet:HINTERNET; hInternetFile:HINTERNET; buffer:array[2..1024] of char;
dwBytesRead:DWord; begin dwBytesRead:=1024; url:='http://club.mir3.com.cn/newmir3/gallary/show.asp? ID=16289&Action=poll'; myhinternet:=InternetOpen('Microsoft Internet Explorer',INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0); if myhinternet=NIL then exit; hInternetFile:=InternetOpenUrl(myhinternet,pchar(url), nil, 0, INTERNET_FLAG_TRANSFER_BINARY + INTERNET_FLAG_RELOAD + INTERNET_FLAG_DONT_CACHE, 0); if hInternetFile=NIL then exit; InternetReadFile(hInternetFile,@buffer,SizeOf(buffer),dwBytesRead);
procedure TForm1.Button1Click(Sender: TObject); var num,i:Integer; startinfo:TStartupInfo; processinfo:TProcessInformation; num1:string; begin
num1:=trim(Edit1.Text); num:=strtoint(num1); i:=0; while(i<num) do begin GetStartupInfo(startinfo); if not (CreateProcess(nil, 'vote.exe', nil, nil, TRUE, CREATE_NO_WINDOW, nil, nil, startinfo, processinfo)) then begin ShowMessage('Create process error!'); exit; end; Sleep(1000); i:=i+1; label2.Caption :=' inttostr(i); end; end;