HTTP请求时的进度显示
frysc 2004-05-11 04:02:56 请问各位用过InternetSetStatusCallback吗?
我想自已写回调来实现HTTP请求时的进度显示。
怎么我老设置不起回调呢?
请看如下代码:
VOID CALLBACK AmHttpStatusCallback
(
HINTERNET hInternet,
DWORD dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength)
{
AfxMessageBox(strTemp);
}
//***********************************************************
...
hIO = InternetOpen(AgentName, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
if(InternetSetStatusCallback(hIO,AmHttpStatusCallback) ==INTERNET_INVALID_STATUS_CALLBACK)
{
AfxMessageBox("回调出错");
return false;
}
if(!HttpSendRequestEx( hRequest, &BufferIn, NULL, HSR_INITIATE, 0))
{
CString strError;
strError.Format("Error on HttpSendRequestEx % lu\n",GetLastError() );
AfxMessageBox(strError);
return FALSE;
}
...