Original Post
I'm trying to run WinINet functions asynchronously within a class called FileDownloadManager. In the class declaration (FileDownload.h), I've got the following definition: In the class definition (FileDownload.cpp), I use the following: When I debug through the code, the m_hInternet handle gets set up just fine. However, when I make the call to InternetSetStatusCallback, the function always returns NULL. The docs say that a NULL returned from InternetSetStatusCallback means that the status callback function was not previously defined. I don't understand this--I've clearly defined s_internet_callback_func in the class declaration. Am I doing something wrong? Would appreciate any insight on how to fix this problem. Thanks in advance!
private:
//Handle to an internet session
HINTERNET m_hInternet;
public:
//Callback function for handling internet download messages
static void __stdcall s_internet_callback_func( HINTERNET hInternet,
DWORD_PTR dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength );
//Pointer to the callback function
INTERNET_STATUS_CALLBACK m_ISCallback;
//Start up an internet session
m_hInternet = InternetOpen("MyWinINet",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
INTERNET_FLAG_ASYNC);
m_ISCallback = InternetSetStatusCallback( m_hInternet,
(INTERNET_STATUS_CALLBACK)s_internet_callback_func );