小问题,帮我看看 ( 积分: 0 )

  • 主题发起人 主题发起人 我要学
  • 开始时间 开始时间

我要学

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在程序里连接一个网页,但不要弹出IE.<br><br>没有窗口的程序,不能放置WebBrowser<br><br>其实就是想赚一点流量,
 
如何在程序里连接一个网页,但不要弹出IE.<br><br>没有窗口的程序,不能放置WebBrowser<br><br>其实就是想赚一点流量,
 
楼主做人不地道,连作技术也这么浮躁.<br>可以研究一下如何通过API连接Web服务,提示几个函数InternetOpen, InternetConnect HttpOpenRequest, HttpSendRequest.
 
谢谢dmzn<br><br>受人所托,难言.<br><br>不过真的说对了,我这个人很急性子,浮躁.<br><br><br>哈哈哈
 
有谁能写一下代码,我在论坛上看到几个例子,<br><br>我用这几个函数得到一个网页的原代码.但网页的流量并没有变化.<br><br>但我所要的是这个网页的计数器能刷一次.
 
那位大哥帮帮小弟<br><br><br>unit Unit1;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, StdCtrls,wininet;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;Button1: TButton;<br> &nbsp; &nbsp;procedure Button1Click(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br>function GetWebPage(const Url: string):string;<br>var<br> &nbsp;Session,<br> &nbsp;HttpFile:HINTERNET;<br> &nbsp;szSizeBuffer:Pointer;<br> &nbsp;dwLengthSizeBuffer:DWord;<br> &nbsp;dwReserved:DWord;<br> &nbsp;dwFileSize:DWord;<br> &nbsp;dwBytesRead:DWord;<br> &nbsp;Contents:PChar;<br>begin<br> &nbsp;Session:=InternetOpen('',0,niL,niL,0);<br> &nbsp;HttpFile:=InternetOpenUrl(Session,PChar(Url),niL,0,0,0);<br> &nbsp;dwLengthSizeBuffer:=1024;<br> &nbsp;HttpQueryInfo(HttpFile,5,szSizeBuffer,dwLengthSizeBuffer,dwReserved);<br> &nbsp;GetMem(Contents,dwFileSize);<br> &nbsp;InternetReadFile(HttpFile,Contents,dwFileSize,dwBytesRead);<br> &nbsp;InternetCloseHandle(HttpFile);<br> &nbsp;InternetCloseHandle(Session);<br> &nbsp;Result:=StrPas(Contents);<br> &nbsp;FreeMem(Contents);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> &nbsp;showmessage(GetWebPage('http://www.aaccaa.com'));<br>end;<br><br>end.
 
后退
顶部