Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    InternetOpenUrl parameters are confusing

    gday,

    i've got the below code, which is me trying to get a website. i'm working up to a http client, but for now i'm learning a little about the wininet API calls.

    anyway, every time i compile i get an error from Visual C++ that there's too few parameters in InternetOpenUrlA. Any ideas on how to fix this?

    Code:
    #include <windows.h>
    #include <wininet.h>
    
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
        LPSTR lpCmdLine, int nCmdShow)
    {
    	//MessageBox(GetDesktopWindow(), "w00t!", "1337", MB_OK | MB_ICONINFORMATION);
    	char* buf = "";
    	HINTERNET hOpen;
    	HINTERNET hFile;
    	LPDWORD ret;
    	hOpen = InternetOpen("pat", INTERNET_OPEN_TYPE_DIRECT, " ", 0);
    	hFile = InternetOpenUrl(hOpen, "www.microsoft.com", NULL, 0, INTERNET_FLAG_RELOAD, 0);
    	InternetReadFile(hFile, buf, 1000, ret);
        InternetCloseHandle(hOpen);
        InternetCloseHandle(hFile);
    	MessageBox(GetDesktopWindow(), buf, "www.microsoft.com", MB_OK | MB_ICONINFORMATION);
        return 0;
    }
    thanks,
    -pcweirdo.
    life without death would get kinda monotonous after a while, eh?

  • #2
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    From MSDN:
    lpszUrl
    Address of a string that contains the URL to begin reading. Only URLs beginning with ftp:, gopher:, http:, or https: are supported.
    So maybe try passing "http://www.microsoft.com".

    shmoove

  • #3
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    apparently it's a problem with the number of arguments in InternetOpenUrlA. I've accquired some sample code from another site.

    thanks,
    -pcweirdo.
    life without death would get kinda monotonous after a while, eh?

  • #4
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Code:
    HINTERNET InternetOpenUrl(
        IN HINTERNET hInternetSession, 
        IN LPCSTR lpszUrl,
        IN LPCSTR lpszHeaders,
        IN DWORD dwHeadersLength,
        IN DWORD dwFlags,
        IN DWORD dwContext
    );
    I don't see how you have too few (or too many) arguments, that is the prototype definition from msdn ...
    Omnis mico antequam dominus Spookster!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •