How to make internet connection using "InternetConnect" api RRS feed

  • Question

  • Hi,


    In my app I need to make connection to address like that:


    I make the following calls:

    HINTERNET hIntConnectPost;
     hIntConnectPost = InternetConnect( hIntOpen,
      L"",    // username
      L"",    // password
      0,   // no flags
      NULL); // no context

     const TCHAR* lplpszAcceptTypes[] = {L"text/xml",L"application/xml",L"application/xhtml+xml",L"text/html;q=0.9",
      L"text/plain;q=0.8",L"image/png",L"*/*;q=0.5", NULL};

     unsigned short URL_CALL[200] = {L"/gts/gtapi"};
     HINTERNET hHttpOpenReq = HttpOpenRequest(
      (LPCTSTR *) lplpszAcceptTypes,

      L"Content-Type: application/x-www-form-urlencoded",

     char lpOptional[1000] = {'\0'};
     strcpy(lpOptional,   "<?xml version=\"1.0\" encoding=\"utf-8\"...xml request..<username>");

     int len= strlen(lpOptional);
     BOOL bRes = HttpSendRequest(hHttpOpenReq, NULL, 0, (LPVOID)lpOptional, len);  
     if (!bRes)
      DWORD conErr = GetLastError(); //Possible values are from format of INTERNET_ERROR_BASE + XXX


    I got failure after calling : "HttpSendRequest" api.

    my XML request & all other api's requests are valid.

    I got  error code: 12029 after calling: "GetLastError".

    What do I do wrong.

    How should I attach the port number to server address?



    Wednesday, July 28, 2010 12:53 PM

All replies

  • Hi,

    Firstly, please test the url in PIE and check whether the url is available in PIE.

    Please also close firewall and check it again.


    If you still can't solve it, please let me know.


    Best regards,
    Guang-Ming Bian - MSFT

    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Friday, July 30, 2010 6:24 AM