知识大全 非常有用的操作Internet的API函数

Posted 函数

篇首语:人无常识,百事难成。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 非常有用的操作Internet的API函数相关的知识,希望对你有一定的参考价值。

非常有用的操作Internet的API函数  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

  必须安装有Winnet dll文件 功能比WINSOCK强大 但MSDN里的说明和例子都是C++的 连VB的都没有 我自己试探出这么一些功能   先贴出来供大家参考     *所有函数如果运行失败 返回 成功返回 或者句柄   *参数大部分是用默认的 参数具体内容 查帮助文件     检查INTERNET是否连通  DECLARE Integer InternetGetConnectedState IN wininet dll Integer Integer  InternetGetConnectedState( )     自动拨号 使用默认的拨号连接 (IE的INTERNET连接设置里必须设置拨号连接 另外还有个InternetDial函数 必须使用拨号连接名称)  DECLARE Integer InternetAutodial IN wininet dll Integer Integer  InternetAutodial ( )     自动中断拨号或者连接  DECLARE Integer InternetAutodialHangup IN wininet dll Integer  InternetAutodialHangup( )     获得一个连接句柄  Declare Integer InternetOpen IN wininet dll String Integer String String Integer  lnOpen= internetOpen( MyFtp null null )     连接到FTP SERVER  Declare Integer InternetConnect in wininet dll Integer String Integer String String Integer Integer Integer  lnConn=InternetConnect(lnOpen anonymous )     下载一个文件 还有不少FTP或者HTTP的操作文件或页面的函数 有兴趣者自己去试  Declare Integer FtpGetFile in wininet dll Integer String String Integer Integer Integer Integer  ? FtpGetFile(lnConn /bussys/readme txt c:\\Temp\\msreadme txt )     中断连接  Declare Integer InternetCloseHandle In wininet dll Integer  InternetCloseHandle(lnConn)    下面是WININET DLL里大部分的API函数 是用VB格式的声明:    Declare Function GetProcessHeap Lib kernel () As Long  Declare Function HeapAlloc Lib kernel (ByVal hHeap As Long ByVal dwFlags As Long ByVal dwBytes As Long) As Long  Declare Function HeapFree Lib kernel (ByVal hHeap As Long ByVal dwFlags As Long lpMem As Any) As Long    Declare Sub CopyMemory Lib kernel Alias RtlMoveMemory ( _  hpvDest As Any ByVal hpvSource As Long ByVal cbCopy As Long)  Declare Sub CopyMemory Lib kernel Alias RtlMoveMemory ( _  hpvDest As Long hpvSource As Any ByVal cbCopy As Long)    Public Const ERROR_NO_MORE_FILES =     Public Declare Function InternetFindNextFile Lib wininet dll Alias InternetFindNextFileA _  (ByVal hFind As Long lpvFindData As WIN _FIND_DATA) As Long    Public Declare Function FtpFindFirstFile Lib wininet dll Alias FtpFindFirstFileA _  (ByVal hFtpSession As Long ByVal lpszSearchFile As String _  lpFindFileData As WIN _FIND_DATA ByVal dwFlags As Long ByVal dwContent As Long) As Long    Public Declare Function FtpGetFile Lib wininet dll Alias FtpGetFileA _  (ByVal hFtpSession As Long ByVal lpszRemoteFile As String _  ByVal lpszNewFile As String ByVal fFailIfExists As Boolean ByVal dwFlagsAndAttributes As Long _  ByVal dwFlags As Long ByVal dwContext As Long) As Boolean    Public Declare Function FtpPutFile Lib wininet dll Alias FtpPutFileA _  (ByVal hFtpSession As Long ByVal lpszLocalFile As String _  ByVal lpszRemoteFile As String _  ByVal dwFlags As Long ByVal dwContext As Long) As Boolean    Public Declare Function FtpSetCurrentDirectory Lib wininet dll Alias FtpSetCurrentDirectoryA _  (ByVal hFtpSession As Long ByVal lpszDirectory As String) As Boolean  Public Declare Function FtpGetCurrentDirectory Lib wininet dll Alias FtpGetCurrentDirectoryA _  (ByVal hFtpSession As Long ByVal lpszDirectory As String ByRef lpdwCurrentDirectory As Long) As Boolean   Initializes an application s use of the Win Internet functions  Public Declare Function InternetOpen Lib wininet dll Alias InternetOpenA _  (ByVal sAgent As String ByVal lAccessType As Long ByVal sProxyName As String _  ByVal sProxyBypass As String ByVal lFlags As Long) As Long     Opens a HTTP session for a given site   Public Declare Function InternetConnect Lib wininet dll Alias InternetConnectA _  (ByVal hInternetSession As Long ByVal sServerName As String ByVal nServerPort As Integer _  ByVal sUsername As String ByVal sPassword As String ByVal lService As Long _  ByVal lFlags As Long ByVal lContext As Long) As Long    Public Declare Function InternetGetLastResponseInfo Lib wininet dll Alias InternetGetLastResponseInfoA ( _  lpdwError As Long _  ByVal lpszBuffer As String _  lpdwBufferLength As Long) As Boolean     Type of service to access      Opens an HTTP request handle   Public Declare Function HttpOpenRequest Lib wininet dll Alias HttpOpenRequestA _  (ByVal hHttpSession As Long ByVal sVerb As String ByVal sObjectName As String ByVal sVersion As String _  ByVal sReferer As String ByVal something As Long ByVal lFlags As Long ByVal lContext As Long) As Long     Sends the specified request to the HTTP server   Public Declare Function HttpSendRequest Lib wininet dll Alias HttpSendRequestA (ByVal _  hHttpRequest As Long ByVal sHeaders As String ByVal lHeadersLength As Long ByVal sOptional As _  String ByVal lOptionalLength As Long) As Integer       Queries for information about an HTTP request   Public Declare Function HttpQueryInfo Lib wininet dll Alias HttpQueryInfoA _  (ByVal hHttpRequest As Long ByVal lInfoLevel As Long ByRef sBuffer As Any _  ByRef lBufferLength As Long ByRef lIndex As Long) As Integer     InternetErrorDlg  Public Declare Function InternetErrorDlg Lib wininet dll _  (ByVal hWnd As Long ByVal hInternet As Long ByVal dwError As Long ByVal dwFlags As Long ByVal lppvData As Long) As Long    Public Declare Function GetDesktopWindow Lib user dll () As Long     The possible values for the lInfoLevel parameter include:     Reads data from a handle opened by the HttpOpenRequest function   Public Declare Function InternetReadFile Lib wininet dll _  (ByVal hFile As Long ByVal sBuffer As String ByVal lNumBytesToRead As Long _  lNumberOfBytesRead As Long) As Integer    Public Declare Function HttpSendRequestEx Lib wininet dll Alias HttpSendRequestExA _  (ByVal hHttpRequest As Long lpBuffersIn As INTERNET_BUFFERS ByVal lpBuffersOut As Long _  ByVal dwFlags As Long ByVal dwContext As Long) As Long    Public Declare Function HttpEndRequest Lib wininet dll Alias HttpEndRequestA _  (ByVal hHttpRequest As Long ByVal lpBuffersOut As Long _  ByVal dwFlags As Long ByVal dwContext As Long) As Long    Public Declare Function InternetWriteFile Lib wininet dll _  (ByVal hFile As Long ByVal sBuffer As String _  ByVal lNumberOfBytesToRead As Long _  lNumberOfBytesRead As Long) As Integer    Public Declare Function FtpOpenFile Lib wininet dll Alias _   FtpOpenFileA (ByVal hFtpSession As Long _  ByVal sFileName As String ByVal lAccess As Long _  ByVal lFlags As Long ByVal lContext As Long) As Long  Public Declare Function FtpDeleteFile Lib wininet dll _  Alias FtpDeleteFileA (ByVal hFtpSession As Long _  ByVal lpszFileName As String) As Boolean    Public Declare Function InternetSetOption Lib wininet dll Alias InternetSetOptionA _  (ByVal hInternet As Long ByVal lOption As Long ByRef sBuffer As Any ByVal lBufferLength As Long) As Integer    Public Declare Function InternetSetOptionStr Lib wininet dll Alias InternetSetOptionA _  (ByVal cha138/Article/program/Java/hx/201311/26323

相关参考

知识大全 C#调用Windows API函数

C#调用WindowsAPI函数  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  Api函数是构筑

知识大全 DELPHI中使用API函数的方法

DELPHI中使用API函数的方法  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  DELPHI的

知识大全 C#回调函数及API应用浅析

C#回调函数及API应用浅析  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  开发环境:WinXP

知识大全 SendMessage API函数在PowerBuilder中应用[2]

SendMessageAPI函数在PowerBuilder中应用[2]  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶

知识大全 SendMessage API函数在PowerBuilder中应用[1]

SendMessageAPI函数在PowerBuilder中应用[1]  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶

知识大全 用Visual C#调用Windows API函数

用VisualC#调用WindowsAPI函数  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  A

知识大全 几个很有用的javascript函数

函数Reset()按Reset按钮后对各字段的内容复位  函数submitForms()按submit按钮后对字段合法性检查后发送电子邮件  函数isName()对姓名字段进行合法性检查  函数isE

知识大全 关于字符串的几个有用函数

  测试字符串长度(中英文)  functionstrLen(s) varistrstrstrnLen; str=svalue; nLen=; for(i=;i

知识大全 在Oracle Developer/2000 中 调 用Windows API 函 数

在OracleDeveloper/2000中调用WindowsAPI函数  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们

知识大全 Asp文件操作函数集

Asp文件操作函数集  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  <%=========