witam wszytskich,
mam taki problem - chyba drobny ale już mnie wkurza.
chce sprawdzić czy istnieje plik w internecie
i robie tak
bool q;
int x, y;
HINTERNET hInet, hConn, hUrl;
q = true;
hInet = InternetOpen("HTTPGET", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
hConn = InternetConnect(hInet, "www.mojastrona.pl", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
hUrl = InternetOpenUrl(hConn, "http://www.mojastrona.pl/news.txt", NULL, 0, 0, 0);
if (hUrl == NULL) q = false;
i jak tak mam to za każdym razem hUrl jest NULL
z <ort>kolei</ort>:
jak pomine InternetConnect to za każdym razem mam hUrl != NULL nawet jak pliku fizycznie w internecie nie ma
hInet = InternetOpen("HTTPGET", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
hUrl = InternetOpenUrl(hInet, "http://www.mojastrona.pl/news.txt", NULL, 0, 0, 0);
if (hUrl == NULL) q = false;
a żeby było całkiem śmiesznie to jeśli w wariancie 1 dołoże GetLastErro to też hURL jest zawsze różne od NULL nawet jak pliku w necie nie ma.
= true;
hInet = InternetOpen("HTTPGET", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
hConn = InternetConnect(hInet, "www.mojastrona.pl", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
hUrl = InternetOpenUrl(hConn, "http://www.mojastrona.pl/news.txt", NULL, 0, 0, 0);
j = GetLastError();
wsprintf(p, "Unable To Process Internet Request; Connect Error: %i", j);
MessageBox(0, p,"Informacja", 0);
if (hUrl == NULL) q = false;
Błąd jest zawsze 12018 ale cudownie hUrl nie jest już NULL
szlag mnie trafia - gdzie tu robie źle ?
a może porsciej można sprawdzić czy jest plik w internecie na url czy nie ma ?