InternetCreateUrl() = GOT_A_PROBLEM

This is a discussion on InternetCreateUrl() = GOT_A_PROBLEM within the Windows Programming forums, part of the Platform Specific Boards category; This doens't seem to work, which doesn't surprise me at all, but I don't know what needs fixing. Please help! ...

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Red face InternetCreateUrl() = GOT_A_PROBLEM

    This doens't seem to work, which doesn't surprise me at all, but I don't know what needs fixing. Please help!

    Code:
     
    			URL_COMPONENTS url;
    			url.lpszScheme = "2009test";
    			url.dwSchemeLength = _tcslen("2009test");
    			url.nScheme = INTERNET_SCHEME_FTP;
    			url.lpszHostName = "alpha";
    			url.dwHostNameLength = _tcslen("alpha");
    			url.nPort = INTERNET_INVALID_PORT_NUMBER;
    			url.lpszUserName = "test";
    			url.dwUserNameLength = _tcslen("test");
    			url.lpszPassword = "2009";
    			url.dwPasswordLength = _tcslen("2009");
    			url.lpszExtraInfo  = "?something";
    			url.dwExtraInfoLength  = _tcslen("?something");
    			url.dwStructSize = sizeof(url);
    			DWORD lpdwUrlLength = _tcslen("2tWeb");
    			InternetCreateUrl(&url, ICU_ESCAPE, "2tWeb", &lpdwUrlLength);

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,333
    Well that was brief.
    I see you're still continuing your habit of posting questions with ........-all information.

    Got any error messages to go along with that?

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    InternetCreateUrl(&url, ICU_ESCAPE, "2tWeb", &lpdwUrlLength);
    The third argument is meant to be a buffer where the created url is placed. If all the components are constant there is little use in using InternetCreateUrl, just use a string literal with the actual url. I am not sure if urls with username and password are supported anymore. You'll have to check.

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> Got any error messages to go along with that?

    I didn't get any.

    >> The third argument is meant to be a buffer where the created url is placed.

    You mean like: "http://"?

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    No, a buffer:
    Code:
    TCHAR buffer[1024];
    DWORD cchBuffer = 1024;
    InternetCreateUrl(&url, ICU_ESCAPE, buffer, &cchBuffer);
    MessageBox(NULL, buffer, TEXT("URL"), 0);

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21