Exemplo n.º 1
0
void CMobileOpalDlg::OnMenuOptionsGeneral()
{
  COptionsGeneral dlg;
  dlg.m_strUsername = GetOptionString(UserNameKey);
  dlg.m_strDisplayName = GetOptionString(DisplayNameKey);
  dlg.m_strStunServer = GetOptionString(STUNServerKey);
  if (dlg.DoModal() == IDOK) {
    SetOptionString(UserNameKey, dlg.m_strUsername);
    SetOptionString(DisplayNameKey, dlg.m_strDisplayName);
    SetOptionString(STUNServerKey, dlg.m_strStunServer);
    InitialiseOPAL();
  }
}
Exemplo n.º 2
0
void CMobileOpalDlg::OnMenuOptionsSIP()
{
  COptionsSIP dlg;
  dlg.m_strAddressOfRecord = GetOptionString(RegistrarAorKey);
  dlg.m_strHostName = GetOptionString(RegistrarHostKey);
  dlg.m_strAuthUser = GetOptionString(RegistrarUserKey);
  dlg.m_strPassword = GetOptionString(RegistrarPassKey);
  dlg.m_strRealm = GetOptionString(RegistrarRealmKey);
  if (dlg.DoModal() == IDOK) {
    SetOptionString(RegistrarAorKey, dlg.m_strAddressOfRecord);
    SetOptionString(RegistrarHostKey, dlg.m_strHostName);
    SetOptionString(RegistrarUserKey, dlg.m_strAuthUser);
    SetOptionString(RegistrarPassKey, dlg.m_strPassword);
    SetOptionString(RegistrarRealmKey, dlg.m_strRealm);
    InitialiseOPAL();
  }
}
Exemplo n.º 3
0
void CMobileOpalDlg::OnMenuOptionsGeneral()
{
  COptionsGeneral dlg;
  dlg.m_strUsername = GetOptionString(UserNameKey);
  dlg.m_strDisplayName = GetOptionString(DisplayNameKey);
  dlg.m_strStunServer = GetOptionString(STUNServerKey);
  dlg.m_interfaceAddress = GetOptionString(InterfaceAddressKey, L"*");
  dlg.m_AutoStartTxVideo = GetOptionInt(AutoStartTxVideoKey, true) != 0;

  if (dlg.DoModal() == IDOK) {
    SetOptionString(UserNameKey, dlg.m_strUsername);
    SetOptionString(DisplayNameKey, dlg.m_strDisplayName);
    SetOptionString(STUNServerKey, dlg.m_strStunServer);
    SetOptionString(InterfaceAddressKey, dlg.m_interfaceAddress);
    SetOptionInt(AutoStartTxVideoKey, dlg.m_AutoStartTxVideo);
    InitialiseOPAL();
  }
}
Exemplo n.º 4
0
void CMobileOpalDlg::OnMenuOptionsH323()
{
  COptionsH323 dlg;
  dlg.m_uiGatekeeperType = GetOptionInt(GkTypeKey);
  dlg.m_strGkId = GetOptionString(GkIdKey);
  dlg.m_strGkHost = GetOptionString(GkHostKey);
  dlg.m_strAlias = GetOptionString(GkAliasKey);
  dlg.m_strAuthUser = GetOptionString(GkAuthUserKey);
  dlg.m_strPassword = GetOptionString(GkPasswordKey);
  if (dlg.DoModal() == IDOK) {
    SetOptionInt(GkTypeKey, dlg.m_uiGatekeeperType);
    SetOptionString(GkIdKey, dlg.m_strGkId);
    SetOptionString(GkHostKey, dlg.m_strGkHost);
    SetOptionString(GkAliasKey, dlg.m_strAlias);
    SetOptionString(GkAuthUserKey, dlg.m_strAuthUser);
    SetOptionString(GkPasswordKey, dlg.m_strPassword);
    InitialiseOPAL();
  }
}
Exemplo n.º 5
0
void CGroupAssignToDoDlg::SetFon(HBITMAP hFon)
{
/*
	if(pFonBmp)
		pFonBmp->DeleteObject();
    else
		pFonBmp = new CBitmap;
	
	pFonBmp->Attach(hFon);
	
	BITMAP hb;
	pFonBmp->GetBitmap(&hb);
	sFon = CSize(hb.bmWidth ,hb.bmHeight);
	
	//SetMinTrackSize(sFon);
	//SetWindowPos(NULL,-1,-1,sFon.cx,sFon.cy ,SWP_NOZORDER|SWP_NOMOVE);

	CPictureHolder	tmpImage;
	tmpImage.CreateFromBitmap(pFonBmp);
	m_ResizeFon.Destroy();
	m_ResizeFon.Create(tmpImage.m_pPict);

	m_ResizeFon.AddAnchor(CRect(0,0,223,100),CSize(0,0),CSize(0,0));
	m_ResizeFon.AddAnchor(CRect(223,0,277,100),CSize(0,0),CSize(100,0),CResizableImage::DUPLICATE);
	m_ResizeFon.AddAnchor(CRect(277,0,299,166),CSize(100,0),CSize(100,0));

	m_ResizeFon.AddAnchor(CRect(0,100,223,165),CSize(0,0),CSize(0,100),CResizableImage::DUPLICATE);
	m_ResizeFon.AddAnchor(CRect(223,100,277,165),CSize(0,0),CSize(100,100),CResizableImage::DUPLICATE);
	m_ResizeFon.AddAnchor(CRect(277,100,299,165),CSize(100,0),CSize(100,100),CResizableImage::DUPLICATE);

	m_ResizeFon.AddAnchor(CRect(0,165,223,199),CSize(0,100),CSize(0,100));
	m_ResizeFon.AddAnchor(CRect(223,165,277,199),CSize(0,100),CSize(100,100),CResizableImage::DUPLICATE);
	m_ResizeFon.AddAnchor(CRect(277,165,299,199),CSize(100,100),CSize(100,100));

	CRect rgnRect;
	GetWindowRect(&rgnRect);
	CRgn	WinRgn;
	WinRgn.CreateRoundRectRgn(0,0,rgnRect.Width(),rgnRect.Height(),20,20);
	SetWindowRgn(WinRgn,TRUE);
*/
	
	CString strRect = GetOptionString(IDS_OFSMESSENGER, IDS_GROUPASSIGNTODO, _T(""));
	if(!strRect.IsEmpty())
	{
		CRect rWindow = StringToRect(strRect);
		FitRectToWindow(rWindow);
		SetWindowPos(NULL,rWindow.left,rWindow.top,rWindow.Width(),rWindow.Height(),SWP_NOZORDER|SWP_NOACTIVATE);
	}
	
}
Exemplo n.º 6
0
BOOL CInviteChatDlg::OnInitDialog() 
{
	CResizableDialog::OnInitDialog();
	
	HRESULT hr = m_pWebCustomizer.CreateInstance(CLSID_MpaWebCustomizer);
	
	LPUNKNOWN pDispatch = m_edit.GetControlUnknown();
	m_pWebCustomizer->PutRefWebBrowser((LPDISPATCH)pDispatch);
	
	InitMpaWebEvent();
	
	pSession = theNet2.GetSession();
	ASSERT(pSession!=NULL);

	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),FALSE);
	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),TRUE);

	CRect winRect;
	GetWindowRect(&winRect);

	CRect rTmp(15,70,winRect.Width()-15,winRect.Height()-50);

	CRect r;

	AddAnchor(m_Nick.GetSafeHwnd(), CSize(0,0), CSize(0,0));
	AddAnchor(m_edit.GetSafeHwnd(), CSize(0,0), CSize(100,100));
	AddAnchor(m_Deny.GetSafeHwnd(), CSize(100,100), CSize(100,100));
	AddAnchor(m_Accept.GetSafeHwnd(), CSize(100,100), CSize(100,100));
	AddAnchor(m_Details.GetSafeHwnd(), CSize(0,100), CSize(0,100));
	AddAnchor(m_ChatDetails.GetSafeHwnd(), CSize(0,100), CSize(0,100));
	
	CString strRect = GetOptionString(IDS_OFSMESSENGER, IDS_INVITE_CHAT, _T(""));
	if(!strRect.IsEmpty())
	{
		CRect rWindow = StringToRect(strRect);
		FitRectToWindow(rWindow);
		SetWindowPos(NULL,rWindow.left,rWindow.top,rWindow.Width(),rWindow.Height(),SWP_NOZORDER|SWP_NOACTIVATE);
	}

	m_Nick.Invalidate(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 7
0
BOOL CFileDescriptioDlg::OnInitDialog()
{
    CResizableDialog::OnInitDialog();

    m_ctrlDescription.SetReadOnly(m_bReadOnlyMode);

    if(m_bReadOnlyMode)
    {
        m_btnSend.SetWindowText(GetString(IDS_CLOSE_BTN_NAME));
    }

    ShowSizeGrip(TRUE);

//	m_Close.SetAutoPressed(TRUE);
//	m_Close.SetCanStayPressed(FALSE);

//	m_Ok.SetAutoPressed(TRUE);
//	m_Ok.SetCanStayPressed(FALSE);

//	m_FileName.SetTextColor(0xffffff);
//	m_FileName.SetTransparent(TRUE);

//	CRect winRect;
//	GetClientRect(&winRect);

//	m_FileName.SetWindowPos(NULL,18,43,winRect.Width()-36,16,SWP_NOZORDER|SWP_NOACTIVATE);

//	LoadSkin();
    AddAnchor(m_FileName.GetSafeHwnd(), CSize(0, 0), CSize(100, 0));
    AddAnchor(m_ctrlDescription.GetSafeHwnd(), CSize(0, 0), CSize(100, 100));
    AddAnchor(m_btnSend.GetSafeHwnd(), CSize(100, 100), CSize(100, 100));

    CString strRect = GetOptionString(IDS_OFSMESSENGER, IDS_FILE_DESCRIPTION, _T(""));
    if(!strRect.IsEmpty())
    {
        CRect rWindow = StringToRect(strRect);
        FitRectToWindow(rWindow);
        SetWindowPos(NULL,rWindow.left,rWindow.top,rWindow.Width(),rWindow.Height(),SWP_NOZORDER|SWP_NOACTIVATE);
    }

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 8
0
CHttpDownloader::CHttpDownloader()
{
	m_hInternet = 0;
	m_hConnect = 0;
	m_hRequest = 0;
	m_longAbort = FALSE;
	m_pStream = NULL;
	m_hWnd = NULL;
	m_nMessage = 0;
	m_dwTotalSize = 0;
	m_dwDownloaded = 0;

	m_dwTimeout = 60000;
	m_dwConnectRetryCount = 3;

    m_ProxyType = GetOptionInt(IDS_NETOPTIONS, IDS_ACCESSTYPE, INTERNET_OPEN_TYPE_PRECONFIG);
	m_ProxyName.Format(_T("http=http://%s:%s"), GetOptionString(IDS_NETOPTIONS, IDS_PROXYNAME, _T("")), GetOptionString(IDS_NETOPTIONS, IDS_PROXYPORT, _T("")));
	
//	m_UseFireWall = GetOptionInt(IDS_NETOPTIONS, IDS_USEFIREWALL, FALSE);
//	m_FireWallUser = GetOptionString(IDS_NETOPTIONS, IDS_FIREWALLUSER, "");
//	m_FireWallPass = GetOptionString(IDS_NETOPTIONS, IDS_FIREWALLPASS, "");

	m_hEvent = ::CreateEvent(NULL, TRUE, TRUE, NULL);
}
Exemplo n.º 9
0
BOOL CLoginDlg::OnInitDialog()
{
    COFSNcDlg2::OnInitDialog();

    //////////////////////////////////////////////////////////////////////////
    // McToolTipAddon
    m_ToolTip.AddTool(&m_btnX,IDS_TIP_CLOSE);
    //////////////////////////////////////////////////////////////////////////

    m_title.SetText(GetString(IDS_IBN_LOGIN_TITLE));
    SetWindowText(GetString(IDS_IBN_LOGIN_TITLE));

    //////////////////////////////////////////////////////////////////////////

    BOOL bRememberLogin = GetOptionInt(IDS_LOGIN,IDS_REMEMBER,TRUE);

#ifndef RADIUS
#define		CRYPT_PROV_CONTAINER_NAME	_T("Mediachase")
#else
#define		CRYPT_PROV_CONTAINER_NAME	_T("Radius-Soft")
#endif

#define		CRYPT_KEYLENGTH				0x00280000L

#define		ENCRYPT_ALGORITHM			CALG_RC4
#define		ENCRYPT_BLOCK_SIZE			1

    if(strCommandLineLogin.GetLength()==0)
    {
        if(bRememberLogin)
        {
            CString strHashData	   = GetOptionString(IDS_LOGIN, IDS_NICKNAME, _T(""));

            CCryptProv				m_hCryptProv;
            CCryptDerivedKey		m_hKey;

            HRESULT m_CryptInitErrorCode = m_hCryptProv.Initialize(PROV_RSA_FULL,CRYPT_PROV_CONTAINER_NAME,MS_DEF_PROV,NULL);
            if(m_CryptInitErrorCode==0x80090016)
            {
                m_CryptInitErrorCode = m_hCryptProv.Initialize(PROV_RSA_FULL,CRYPT_PROV_CONTAINER_NAME,MS_DEF_PROV,CRYPT_NEWKEYSET);
            }

            if(m_CryptInitErrorCode==S_OK)
            {
                // Create Key [9/12/2002]
                CCryptMD5Hash hMD5Hash;

                m_CryptInitErrorCode = hMD5Hash.Initialize(m_hCryptProv,CRYPT_PROV_CONTAINER_NAME);
                if(m_CryptInitErrorCode==S_OK)
                {
                    m_CryptInitErrorCode = m_hKey.Initialize(m_hCryptProv,hMD5Hash,ENCRYPT_ALGORITHM,CRYPT_KEYLENGTH);

                    if(m_CryptInitErrorCode==S_OK)
                    {
                        if(!ExtractLoginAndPasswordFromData(m_hKey,strHashData,m_LoginStr,m_PasswordStr))
                        {
                            m_LoginStr.Empty();
                            m_PasswordStr.Empty();
                        }
                    }
                }
            }
        }
    }
    else
    {
        m_LoginStr = strCommandLineLogin;

        if(strCommandLinePassword.GetLength()!=0)
            m_PasswordStr = strCommandLinePassword;
    }

    //////////////////////////////////////////////////////////////////////////

    m_btnSSL.SetPressed(GetOptionInt(IDS_NETOPTIONS, IDS_USESSL, FALSE));

    m_btnSavePassword.SetPressed(bRememberLogin);
    m_btnCancel.EnableWindow(FALSE);

    UpdateData(FALSE);

    m_LoginEdit.SetFocus();

    // Add Auto complete Mode [8/15/2003]
    // Step 1. Create CLSID_AutoComplete
    HRESULT hr = CoCreateInstance(CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER,IID_IAutoComplete, (LPVOID*)&m_pAutoComplete);
    // Step 2. Create Custom autocomplete source

    if(SUCCEEDED(hr))
        hr = m_pAutoComplete->Init(m_LoginEdit.GetSafeHwnd(),(LPUNKNOWN)m_AutoCompleteSource.GetInterface(&IID_IUnknown),NULL,NULL);


    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 10
0
BOOL CAddUserRequest::OnInitDialog() 
{
	CResizableDialog::OnInitDialog();
	
	HRESULT hr = m_pWebCustomizer.CreateInstance(CLSID_MpaWebCustomizer);
	
	LPUNKNOWN pDispatch = m_edit.GetControlUnknown();
	m_pWebCustomizer->PutRefWebBrowser((LPDISPATCH)pDispatch);
	
	InitMpaWebEvent();
	
	pSession = theNet2.GetSession();
	ASSERT(pSession!=NULL);

	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),FALSE);
	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),TRUE);

//	LoadSkin();
	
	CRect winRect;
	GetWindowRect(&winRect);

	CRect rTmp(15,70,winRect.Width()-15,winRect.Height()-50);

	//m_edit.Create(NULL,NULL,WS_VISIBLE|WS_BORDER,rTmp,this,IDC_DHTML_EDIT);
	//m_edit.SetContextMenu(IDR_MESSENGER_MENU,1,this);
	//m_edit.SetViewMode();

	//  [4/29/2002]
	//m_edit.SetDefaultFontName(L"Arial");
	//m_edit.SetDefaultFontSize(nFontSizes[GetOptionInt(IDS_OFSMESSENGER,IDS_SIZE,1)]);
	//  [4/29/2002]
	

	
	//	m_Nick.SetWindowPos(NULL,18,43,winRect.Width()-36,16,SWP_NOZORDER|SWP_NOACTIVATE);
	//	m_Nick.SetTextColor(0xffffff);
	//	m_Nick.SetTransparent(TRUE);
	
	//	m_Close.SetAutoPressed(TRUE);
	//	m_Close.SetCanStayPressed(FALSE);
	//	m_Mini.SetAutoPressed(TRUE);
	//	m_Mini.SetCanStayPressed(FALSE);
	//	m_Deny.SetAutoPressed(TRUE);
	//	m_Deny.SetCanStayPressed(FALSE);
	//	m_AddToContact.SetAutoPressed(TRUE);
	//	m_AddToContact.SetCanStayPressed(FALSE);
	//	m_Accept.SetAutoPressed(TRUE);
	//	m_Accept.SetCanStayPressed(FALSE);
	//	m_Details.SetAutoPressed(TRUE);
	//	m_Details.SetCanStayPressed(FALSE);
	
	
	//	m_Deny.SetWindowPos(NULL,winRect.Width()-91,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
	//	m_AddToContact.SetWindowPos(NULL,winRect.Width()-91,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW);
	//	m_Accept.SetWindowPos(NULL,winRect.Width()-170,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
	//	m_Details.SetWindowPos(NULL,15,winRect.Height()-38,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
	
	CRect r;
	//m_frameEdit.GetWindowRect(&r);
	//ScreenToClient(&r);
	//m_edit.SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER);
	AddAnchor(m_edit.GetSafeHwnd(), CSize(0,0), CSize(100,100));
	AddAnchor(m_Deny.GetSafeHwnd(), CSize(100,100), CSize(100,100));
	AddAnchor(m_AddToContact.GetSafeHwnd(), CSize(100,100), CSize(100,100));
	AddAnchor(m_Accept.GetSafeHwnd(), CSize(100,100), CSize(100,100));
	AddAnchor(m_Details.GetSafeHwnd(), CSize(0,100), CSize(0,100));
	
	CString strRect = GetOptionString(IDS_OFSMESSENGER, IDS_ADD_FRIENDR, _T(""));
	if(!strRect.IsEmpty())
	{
		CRect rWindow = StringToRect(strRect);
		FitRectToWindow(rWindow);
		SetWindowPos(NULL,rWindow.left,rWindow.top,rWindow.Width(),rWindow.Height(),SWP_NOZORDER|SWP_NOACTIVATE);
	}
	

	//m_edit.Clear();
	//m_edit.SetFocus();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 11
0
HRESULT CHttpDownloader::ConnectToServer(_bstr_t &strBuffer)
{
	BOOL bResult;
	DWORD dwStatus;
	DWORD nTimeoutCounter;
	_bstr_t strMethod;
	_bstr_t strUrl = m_request.url;

	LPCTSTR szProxyName = NULL;
	if(m_ProxyType == INTERNET_OPEN_TYPE_PROXY)
		szProxyName = m_ProxyName;
	
//// InternetOpen \\\\	
	if(!m_hInternet)
		m_hInternet = InternetOpen(_T("McHttpDownloader"), m_ProxyType, szProxyName, NULL, INTERNET_FLAG_ASYNC);
	if(!m_hInternet)
	{
		strBuffer = _T("InternetOpen failed");
		return E_FAIL;
	}

	
	InternetSetStatusCallback(m_hInternet, (INTERNET_STATUS_CALLBACK)CallbackFunc);
//// InternetOpen ////	
	
	if(m_longAbort > 0)
		return E_ABORT;

//// InternetConnect \\\\	
	if(!m_hConnect)
	{
		m_hConnect = InternetConnect(m_hInternet, m_request.server, (short)m_request.port, NULL, NULL, INTERNET_SERVICE_HTTP, NULL, (DWORD)&m_context);
	}
	if(m_hConnect == NULL)
	{
		strBuffer = _T("InternetConnect failed");
		return INET_E_CANNOT_CONNECT;
	}
//// InternetConnect ////	
	
	nTimeoutCounter = 0;

NewConnect:

	strMethod = _T("GET");
	strBuffer = _T("");

//// OpenRequest \\\\	
	if(m_hRequest)
	{
		::InternetCloseHandle(m_hRequest);
		m_hRequest = NULL;
	}
	
	if(m_longAbort > 0)
		return E_ABORT;

	DWORD dwFlags = 
		INTERNET_FLAG_KEEP_CONNECTION	|
		INTERNET_FLAG_NO_CACHE_WRITE	|
		INTERNET_FLAG_RELOAD			|
		INTERNET_FLAG_PRAGMA_NOCACHE	|
		INTERNET_FLAG_NO_UI			|
		INTERNET_FLAG_NO_COOKIES		|
		INTERNET_FLAG_IGNORE_CERT_CN_INVALID  |
		INTERNET_FLAG_NO_AUTO_REDIRECT  | 
		INTERNET_FLAG_HYPERLINK |
		(m_request.bUseSSL ?
							(INTERNET_FLAG_SECURE/*|
							INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|
							INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP*/)
							:
							0);
		
	m_context.op = HTTP_DOWNLOADER_OP_OPEN_REQUEST;
	m_hRequest = HttpOpenRequest(m_hConnect, strMethod, strUrl, _T("HTTP/1.1"), NULL, NULL, dwFlags, (DWORD)&m_context);
	if(m_hRequest == NULL)
	{
		strBuffer = _T("HttpOpenRequest failed");
		return E_FAIL;
	}

	if(m_ProxyType == INTERNET_OPEN_TYPE_PROXY)
	{
		if(GetOptionInt(IDS_NETOPTIONS,IDS_USEFIREWALL,0))
		{
			CString fireWallUser =  GetOptionString(IDS_NETOPTIONS, IDS_FIREWALLUSER, _T(""));
			CString fireWallPass = GetOptionString(IDS_NETOPTIONS, IDS_FIREWALLPASS, _T(""));

			//////////////////////////////////////////////////////////////////////////

			int HeaderLen = ATL::ProxyAuthorizationStringGetRequiredLength(fireWallUser, fireWallPass);
			LPTSTR strHeader = new TCHAR[HeaderLen+1];
			ZeroMemory(strHeader,HeaderLen+1);

			HRESULT hr = ATL::ProxyAuthorizationString(fireWallUser, fireWallPass, strHeader, &HeaderLen);

			ASSERT(hr==S_OK);

			HttpAddRequestHeaders(m_hRequest, strHeader, HeaderLen, HTTP_ADDREQ_FLAG_ADD );

			delete []strHeader;
			//////////////////////////////////////////////////////////////////////////
		}
	}
	
//// OpenRequest ////	
	
NewRequest:

	if(m_longAbort > 0)
		return E_ABORT;

	m_context.op = HTTP_DOWNLOADER_OP_SEND_REQUEST;
	bResult = HttpSendRequest(m_hRequest, NULL , 0, (LPVOID)(BYTE*)(LPCTSTR)strBuffer, lstrlen(strBuffer));
	if(!bResult && 997 == GetLastError())		// Overlapped I/O operation is in progress.
		bResult = WaitForComplete(m_dwTimeout); // Resolve host name, connect, send request, receive response.
	if(!bResult)
	{
		DWORD dwErrCode = GetLastError();
//		ATLTRACE("Send Request error = %d \r\n",dwErrCode);
		
		if(dwErrCode == 6)		// The handle is invalid.
			goto NewConnect;
		
		if(dwErrCode == ERROR_INTERNET_TIMEOUT)	// timeout
		{
			if(++nTimeoutCounter < m_dwConnectRetryCount)
				goto NewConnect;
			else
			{
				strBuffer = _T("Timeout");
				return E_FAIL;//INET_E_CONNECTION_TIMEOUT;
			}
		}

		strBuffer = _T("SendRequest failed");
		return E_FAIL;
	}
	
	dwStatus = GetHttpStatus();

	if(dwStatus == 401 || dwStatus == 407) // Denied or Proxy asks password
	{
		if(ERROR_INTERNET_FORCE_RETRY == 
		   InternetErrorDlg(GetDesktopWindow(), m_hRequest,
				ERROR_INTERNET_INCORRECT_PASSWORD,
				FLAGS_ERROR_UI_FILTER_FOR_ERRORS | 
				FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
				FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
				NULL))
			{
				goto NewRequest;
			}
					
	}

	if(dwStatus != 200) // Not OK
	{		
		strBuffer = _T("SendRequest returned with error");
		return INET_E_CANNOT_CONNECT;
	} 

	return S_OK;
}