Thread: InternetOpenUrl() problem - why it opens NULL

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    3

    Arrow InternetOpenUrl() problem - why it opens NULL

    Hello everyone !

    Happy to join you boys and girls

    I have a C++ (Win32) question for you:
    I'm trying to download GIF file from URL and use InternetOpenUrl(); function. After this function call there are no errors and look's it's all OK, but returned handle is NULL. I pass InternetOpen() retuned handle to this function. InternetOpen() handle is also OK, but as I said [i]InternetOpenUrl() returns handle NULL. Have you any ideas on it ? Please help me solve this problem. Thank you.

    Here is some code:
    Code:
    hRootHandle = InternetOpen( 
       "GIFLinker", 
       INTERNET_OPEN_TYPE_PRECONFIG , 
       NULL,NULL, 
       INTERNET_FLAG_ASYNC); 
    
    hUrlDump = InternetOpenUrl( 
       hRootHandle, 
       "http://www.algirdas.com/fimg/online-merchants-index.gif", 
       NULL, NULL, INTERNET_FLAG_RAW_DATA, 0); 
    
    
    while (GetLastError() == ERROR_IO_PENDING) { 
      sprintf(szURL, "Waiting... (%d)",GetLastError()); 
      SetDlgItemText(prcContext->hWindow, prcContext->nResource,   szURL); 
    } 
    
    // After this code execution: 
    //  hRootHandle = 0x00cc0004 
    //  hUrlDump = NULL (0x00000000) 
    //  GetLastError() = 0 (no errors)

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    welcome to the boards

    here's the way I use the two functions and it seems to work:

    Code:
       HINTERNET hInternet=NULL;
       hInternet=InternetOpen("agent name",INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
       HINTERNET hOpenURL=InternetOpenUrl(hInternet,strURL,NULL,0, INTERNET_FLAG_DONT_CACHE,0);

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    3
    Hi

    I've tried this:
    Code:
    hINet = InternetOpen("Whatever", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 ); 
    hFile = InternetOpenUrl(hINet, "http://www.algirdas.com/fimg/online-merchants-index.gif", NULL, 0, 0, 0);
    And it seems works !

    Thanks jverkoey Have a nice day !

    P.S. By the way, I liked your website and especially this:
    http://www.thejefffiles.com/viewimag...size/room2.jpg Keep going !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 05:03 AM
  3. Why am I getting these errors??
    By maxthecat in forum Windows Programming
    Replies: 3
    Last Post: 02-03-2006, 01:00 PM
  4. Help with yacc/compiler design/seg fault
    By trippeer in forum C Programming
    Replies: 1
    Last Post: 04-08-2005, 03:43 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM