|
|
От: |
Yola
|
|
| Дата: | 11.08.07 05:43 | ||
| Оценка: | |||
InternetOpen is the first WinINet function called by an application. It tells the Internet DLL to initialize internal data structures and prepare for future calls from the application. When the application finishes using the Internet functions, it should call InternetCloseHandle to free the handle and any associated resources. The application can make any number of calls to InternetOpen, though a single call is normally sufficient. The application might need to define separate behaviors for each InternetOpen instance, such as different proxy servers configured for each.
HINTERNET hOpen = InternetOpen("me", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET hConnect = InternetConnect(hOpen, "localhost", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
HINTERNET hOpenRequest1 = HttpOpenRequest(hConnect, "GET", "localhost.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_RELOAD, 0);
HINTERNET hOpenRequest2 = HttpOpenRequest(hConnect, "GET", "localhost.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_RELOAD, 0);
// HINTERNET hOpenRequest3 = HttpOpenRequest(hConnect, "GET", "localhost.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_RELOAD, 0);
if (!HttpSendRequest(hOpenRequest1, 0, 0, 0, 0)) {
MessageBox("All wrong 1");
return;
}
if (!HttpSendRequest(hOpenRequest2, 0, 0, 0, 0)) {
MessageBox("All wrong 2");
return;
}
// if (!HttpSendRequest(hOpenRequest3, 0, 0, 0, 0)) {
// MessageBox("All wrong 3");
// return;
} HINTERNET hOpen = InternetOpen("me", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET hConnect = InternetConnect(hOpen, "localhost", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
HINTERNET hOpenRequest1 = HttpOpenRequest(hConnect, "GET", "localhost.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_RELOAD, 0);
HINTERNET hOpenRequest2 = HttpOpenRequest(hConnect, "GET", "localhost.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_RELOAD, 0);
HINTERNET hOpenRequest3 = HttpOpenRequest(hConnect, "GET", "localhost.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_RELOAD, 0);
if (!HttpSendRequest(hOpenRequest1, 0, 0, 0, 0)) {
MessageBox("All wrong 1");
return;
}
if (!HttpSendRequest(hOpenRequest2, 0, 0, 0, 0)) {
MessageBox("All wrong 2");
return;
}
if (!HttpSendRequest(hOpenRequest3, 0, 0, 0, 0)) { // здесь виснем:)
MessageBox("All wrong 3");
return;
}