vc 中,CInternetSession OpenURL 如何设置在超时时不d出“ *** 作超时”对话框

vc 中,CInternetSession OpenURL 如何设置在超时时不d出“ *** 作超时”对话框,第1张

OnTimer(UINT nIDEvent)

{

char buff[1024*20+1]

typedef int (WINAPI ICEPUB_OPENURL)(char *currentUrlString,char *strHtmlText,int textMaxLen,char *strProxy)

ICEPUB_OPENURL *icePub_openUrl = 0

HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll")

if(hDLLDrv)

{

icePub_openUrl =(ICEPUB_OPENURL *)GetProcAddress(hDLLDrv,"icePub_openUrl")

}

if(icePub_openUrl)

{

icePub_openUrl(Url,buff,1024*20,"")

}

if(hDLLDrv)

FreeLibrary(hDLLDrv)

//AfxMessageBox(buff)

}

帮你加上注释吧,晕倒... On Error Resume Next '发生错误时继续下一步Inet1.AccessType = 2 '访问类型

Inet1.RequestTimeout = 60 '请求超时

Inet1.Proxy = "HTTP=" &"59.74.42.152" &":" &"8080" '代理

Inet1.OpenURL (" http://www.baidu.com/") '打开的网址

MsgBox Val(Mid(Trim(Inet1.GetHeader), 10, 3))

If Err Then

If Err.Number = 35756 Then MsgBox "代理不可用"

MsgBox Err.Number &":" &Err.Description

End If

End Sub

3.60 icePub_openUrl

l 函数原型:

int WINAPI icePub_openUrl(char *currentUrlString,char *strHtmlText,int textMaxLen,char *strProxy)

输入:currentUrlString http地址

textMaxLen strHtmlText的最大长度

strProxy 代理服务器地址

输出:strHtmlText 返回的页面代码

l VC连接Lib方式声明

__declspec(dllexport)

int WINAPI icePub_openUrl(char *currentUrlString,char *strHtmlText,int textMaxLen,char *strProxy)

l 动态调用例程

VC sample代码:

char buff[1024*20+1]

typedef int (WINAPI ICEPUB_OPENURL)(char *currentUrlString,char *strHtmlText,int textMaxLen,char *strProxy)

ICEPUB_OPENURL *icePub_openUrl = 0

HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll")

if(hDLLDrv)

{

icePub_openUrl =(ICEPUB_OPENURL *)GetProcAddress(hDLLDrv,"icePub_openUrl")

}

if(icePub_openUrl)

{

icePub_openUrl("http://www.baidu.com",buff,1024*20,"")

}

if(hDLLDrv)

FreeLibrary(hDLLDrv)

AfxMessageBox(buff)

VB sample 代码:

Private Declare Function icePub_openUrl Lib "icePubDll.dll" (ByVal currentUrlString As String, ByVal strHtmlText As String, ByVal TextMaxLen As Integer) As Integer

Dim a2 As Integer

a2=icePub_openUrl("http://www.baidu.com",buff,1024*20,"")


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11237637.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存