Click here to Skip to main content
15,887,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Pin
David Crow14-Jan-04 3:33
David Crow14-Jan-04 3:33 
GeneralRe: C++ Pin
NewbieCoder14-Jan-04 5:01
NewbieCoder14-Jan-04 5:01 
GeneralGDI question Pin
Anthony_Yio13-Jan-04 23:45
Anthony_Yio13-Jan-04 23:45 
GeneralRe: GDI question Pin
ohadp14-Jan-04 1:43
ohadp14-Jan-04 1:43 
GeneralMFC Pin
parthmankad13-Jan-04 22:57
parthmankad13-Jan-04 22:57 
GeneralRe: MFC Pin
Eugene Pustovoyt13-Jan-04 23:03
Eugene Pustovoyt13-Jan-04 23:03 
GeneralRe: MFC Pin
Prakash Nadar13-Jan-04 23:05
Prakash Nadar13-Jan-04 23:05 
GeneralGets a internet page through HTTP proxy Pin
Eugene Pustovoyt13-Jan-04 22:40
Eugene Pustovoyt13-Jan-04 22:40 
Here sample of a code to gets a page through proxy with authorizing. First ::HttpSendRequest call returns success, but second call after proxy authorization is wedging. Why!? Where is mistake!?

HINTERNET hOpenHandle, hConnectHandle, hResourceHandle; 
DWORD dwError, dwStatus; 
DWORD dwStatusSize = sizeof(dwStatus); 
hOpenHandle = ::InternetOpen("Example", INTERNET_OPEN_TYPE_PROXY, strProxyName, NULL, 0); 
if (NULL != hOpenHandle)
{
	hConnectHandle = ::InternetConnect(hOpenHandle, "www.microsoft.com", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
	if (NULL != hConnectHandle)
	{
		hResourceHandle = ::HttpOpenRequest(hConnectHandle, "GET", "", HTTP_VERSION, NULL, 0, INTERNET_FLAG_DONT_CACHE, 0);
		if (NULL != hResourceHandle)
		{
resend: 
			BOOL bSendRequest = ::HttpSendRequest(hResourceHandle, NULL, 0, NULL, 0); 
			::HttpQueryInfo(hResourceHandle, HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE, &dwStatus, &dwStatusSize, NULL); 
			switch (dwStatus) 
			{ 
			case HTTP_STATUS_PROXY_AUTH_REQ: 
				//Proxy Authentication Required 
				// Insert code to set strUsername and strPassword. 
				InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_USERNAME, (LPVOID)(LPCTSTR)strProxyUsername, strlen(strProxyUsername)+1); 
				InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_PASSWORD, (LPVOID)(LPCTSTR)strProxyPassword, strlen(strProxyPassword)+1);
				goto resend; 
				break; 
			case HTTP_STATUS_DENIED: 
				//Server Authentication Required 
				// Insert code to set strUsername and strPassword. 
				InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_USERNAME, (LPVOID)(LPCTSTR)strProxyUsername, strlen(strProxyUsername)+1); 
				InternetSetOption(hResourceHandle, INTERNET_OPTION_PROXY_PASSWORD, (LPVOID)(LPCTSTR)strProxyPassword, strlen(strProxyPassword)+1);
				goto resend; 
				break; 
			} 
			// Insert code to read the information from the hResourceHandle 
			// at this point.
			if (HTTP_STATUS_OK == dwStatus)
			{
                                //Gets a page
			}
                        ::InternetCloseHandle(hResourceHandle);
		}
		::InternetCloseHandle(hConnectHandle);
	}
	::InternetCloseHandle(hOpenHandle);
}


Best regards,
Eugene Pustovoyt
GeneralRe: Gets a internet page through HTTP proxy Pin
YaronNir19-Jan-10 4:09
YaronNir19-Jan-10 4:09 
GeneralCrash at 2nd SendMessage Pin
SiddharthAtw13-Jan-04 22:27
SiddharthAtw13-Jan-04 22:27 
GeneralRe: Crash at 2nd SendMessage Pin
Prakash Nadar13-Jan-04 22:58
Prakash Nadar13-Jan-04 22:58 
GeneralRe: Crash at 2nd SendMessage Pin
ohadp13-Jan-04 23:00
ohadp13-Jan-04 23:00 
GeneralRe: Crash at 2nd SendMessage Pin
Monty213-Jan-04 23:27
Monty213-Jan-04 23:27 
GeneralWant to make buttons that can't get focus Pin
ohadp13-Jan-04 21:51
ohadp13-Jan-04 21:51 
GeneralRe: Want to make buttons that can't get focus Pin
Rob Manderson13-Jan-04 22:47
protectorRob Manderson13-Jan-04 22:47 
GeneralRe: Want to make buttons that can't get focus Pin
ohadp13-Jan-04 22:54
ohadp13-Jan-04 22:54 
GeneralRe: Want to make buttons that can't get focus Pin
Rob Manderson13-Jan-04 23:00
protectorRob Manderson13-Jan-04 23:00 
GeneralRe: Want to make buttons that can't get focus Pin
ohadp13-Jan-04 23:35
ohadp13-Jan-04 23:35 
GeneralGet time of a file Pin
Cedric Moonen13-Jan-04 20:37
Cedric Moonen13-Jan-04 20:37 
GeneralRe: Get time of a file Pin
algol13-Jan-04 21:17
algol13-Jan-04 21:17 
GeneralRe: Get time of a file Pin
murali_utr13-Jan-04 21:20
murali_utr13-Jan-04 21:20 
GeneralRe: Get time of a file Pin
Cedric Moonen13-Jan-04 21:25
Cedric Moonen13-Jan-04 21:25 
Generalhelp in MDI needed Pin
Ruchit Sharma13-Jan-04 20:32
Ruchit Sharma13-Jan-04 20:32 
GeneralRe: help in MDI needed Pin
Antti Keskinen14-Jan-04 1:08
Antti Keskinen14-Jan-04 1:08 
GeneralAnimate button Pin
Member 64882813-Jan-04 19:30
Member 64882813-Jan-04 19:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.