我根据
http://read.pudn.com/downloads13/sourcecode/internet/53239/自动分析网页中超级链接/winhttp/GetWeb.cpp__.htm修改了个源码,基本上没有太大的区别!
可是写到后尾的时候,就出现了问题在if(!session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 10000)||
!session.SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 1000)||
!session.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 3)||
!session.SetOption(INTERNET_OPTION_RECEIVE_TIMEOUT,60000)||
!session.EnableStatusCallback(TRUE))这个判断当中,!session.EnableStatusCallback(TRUE) 的判断将会使整个程序崩溃!
请问下各位,这到底是怎么回事?EnableStatusCallback()是做什么用的?去掉这个判断的话,会影响程序么?

解决方案 »

  1.   

    You can set a callback routine for synchronous operations; however, you must establish a callback routine for asynchronous operations because the asynchronous API makes a callback with INTERNET_STATUS_REQUEST_COMPLETE to indicate that the request has completed
    To handle any operations asynchronously, three conditions must be set: In the constructor, dwFlags must include INTERNET_FLAG_ASYNC. 
    In the constructor, dwContext must be set to one. 
    You must establish a call back function by calling EnableStatusCallback.