none
Help Me! "HttpSendRequest"

    Question

  • I'm development application with visual stdio 2005.

    There is my code: 

    {

    m_hSession = InternetOpen(L"Microsoft Internet Explorer" , INTERNET_OPEN_TYPE_PRECONFIG , NULL ,  NULL , 0);
    m_hConnectInternet = InternetConnect(m_hSession , L"192.168.1.1",NULL , NULL , NULL , INTERNET_SERVICE_HTTP ,0 , NULL);

    hRequest = HttpOpenRequest(m_hConnectInternet , lpszVerb , lpszObjectName , L"HTTP/1.1" , NULL , NULL ,
        INTERNET_FLAG_RELOAD , (DWORD)m_hWndParent);

    HttpAddRequestHeaders(hRequest ,L"Content-Type:application/x-www-form-urlencoded\r\n" , -1 ,
      HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);

     bIsSucceed = HttpSendRequest(hRequest , NULL , 0 , NULL, 0);

    }

    HttpSendRequest return FALSE,I user GetLastError() to get error code, it is 12029,but after using Pocket IE,the HttpSendRequest return TRUE; Every Time I reset the OS , I can meet this.Is there any one meet the the same thing.

    My Msn is:jonason123@hotmail.com,Please contact me!!

    Monday, July 09, 2007 7:04 AM

Answers

All replies

  • Pocket IE automatically establishes a data connection for you. You need to do it yourself. Normally, you use ConnectionManager API to do this. Here is an article that refers to an SDK sample you might be interested in: http://www.pocketpcdn.com/articles/conn_mgr.html

     

     

    Monday, July 09, 2007 9:52 AM
  • Hi,I have used ConnMgrEstablishConnectionSync API to connect to Internet ,but it still hanppened.
    Thursday, July 12, 2007 12:43 AM
  • Did you use ConnMgrMapUrl to obtain the proper guid?
    Thursday, July 12, 2007 4:44 PM
  • Hi,Is that you mean,every time I want to connect some URL I should use ConnMgrMapUrl to obtain the proper guid.There is the code I connect the internet.

     

    BOOL ActiveInternet()
    {
     HRESULT hr = S_OK;
     CONNMGR_DESTINATION_INFO cDesInfo;
     CONNMGR_CONNECTIONINFO cConnectInfo;
     CString strNetName;
     DWORD   dwStatus = 0 ;

      for (int nIndex = 0 ; nIndex < 100 ; nIndex ++ )
     {
      hr = ConnMgrEnumDestinations(nIndex, &cDesInfo);
      if (hr != S_OK)
       break;
     }


     strNetName = cDesInfo.szDescription ;
     if(strNetName.Find(L"Internet") == 0)
      return FALSE ;

     memset(&cConnectInfo, 0, sizeof(cConnectInfo));
     cConnectInfo.cbSize = sizeof(cConnectInfo);
     cConnectInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
     cConnectInfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
     cConnectInfo.bExclusive = FALSE;
     cConnectInfo.bDisabled = FALSE;
     cConnectInfo.guidDestNet = cDesInfo.guid;
     cConnectInfo.hWnd = NULL;
     cConnectInfo.uMsg = 0;
     cConnectInfo.lParam = 0;
     cConnectInfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP| CONNMGR_FLAG_PROXY_WAP | CONNMGR_FLAG_PROXY_SOCKS4 | CONNMGR_FLAG_PROXY_SOCKS5;


     hr = ConnMgrEstablishConnectionSync(&cConnectInfo,&m_hConnectionSync, 30000, &dwStatus);
     if ( hr == S_OK &&dwStatus==CONNMGR_STATUS_CONNECTED )
      return TRUE;

     return FALSE;

    }

    Friday, July 13, 2007 12:17 AM
  • Please take a look at Samples\PocketPC\CPP\MFC\CMHelper sample (Windows Mobile 6 SDK). It is all in the Connection.h file.
    Friday, July 13, 2007 1:59 PM
  • Hey, I am having the same problem... Were you able to find a solution for it Thank you in advance
    Monday, February 07, 2011 12:51 PM