Click here to Skip to main content
15,890,438 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Clipboard / Win32 Pin
David Crow7-May-10 17:02
David Crow7-May-10 17:02 
GeneralRe: Clipboard / Win32 Pin
Michael Dunn7-May-10 16:40
sitebuilderMichael Dunn7-May-10 16:40 
QuestionSend data to remote server from CString Pin
mesajflaviu7-May-10 8:25
mesajflaviu7-May-10 8:25 
AnswerRe: Send data to remote server from CString Pin
CPallini7-May-10 8:41
mveCPallini7-May-10 8:41 
AnswerRe: Send data to remote server from CString Pin
«_Superman_»7-May-10 8:48
professional«_Superman_»7-May-10 8:48 
GeneralRe: Send data to remote server from CString Pin
mesajflaviu7-May-10 9:08
mesajflaviu7-May-10 9:08 
QuestionGet resource ID from icon index Pin
cryptoknight177-May-10 7:49
cryptoknight177-May-10 7:49 
QuestionTimeout problem in CHttpFile::SendRequest() Pin
m_code7-May-10 7:49
m_code7-May-10 7:49 
I want to use google translator through an application I wrote the following code but it always time out what's my problem.

CString szTranReq(L"/translate_a/t?client=t&sl=en&tl=tr");
	
CString szText(L"text=Hello");

CString szServer(L"www.google.com");

DWORD inetPort = 80;




CInternetSession inetSession(::AfxGetAppName(), 1, PRE_CONFIG_INTERNET_ACCESS, NULL, NULL, NULL);

inetSession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 1000 * 3);
inetSession.SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 1000);
inetSession.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1);

CHttpConnection* pInetHttpConnection = inetSession.GetHttpConnection(szServer, inetPort, NULL, NULL); 


CHttpFile* pHttpFile = pInetHttpConnection->OpenRequest(
	CHttpConnection::HTTP_VERB_POST,
	szTranReq, NULL, 1, NULL, NULL,
	INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_DONT_CACHE);



pHttpFile->AddRequestHeaders(L"Host: www.google.com\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"User-Agent: Mozilla/5.0\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"Accept-Encoding: deflate\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"content-length: 10\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"Connection: Close\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);

pHttpFile->SendRequest();


DWORD dwRet;
pHttpFile->QueryInfoStatusCode(dwRet);


SendRequest() Method always timeout.
QuestionWhat device context methods are available to Crichedit Pin
ForNow7-May-10 7:10
ForNow7-May-10 7:10 
AnswerRe: What device context methods are available to Crichedit Pin
karle7-May-10 9:43
karle7-May-10 9:43 
GeneralRe: What device context methods are available to Crichedit Pin
ForNow7-May-10 11:21
ForNow7-May-10 11:21 
GeneralRe: What device context methods are available to Crichedit Pin
karle8-May-10 4:00
karle8-May-10 4:00 
GeneralRe: What device context methods are available to Crichedit Pin
ForNow8-May-10 15:38
ForNow8-May-10 15:38 
QuestionReceive data from server into CString Pin
mesajflaviu7-May-10 6:14
mesajflaviu7-May-10 6:14 
AnswerRe: Receive data from server into CString Pin
CPallini7-May-10 7:13
mveCPallini7-May-10 7:13 
GeneralRe: Receive data from server into CString Pin
mesajflaviu7-May-10 7:16
mesajflaviu7-May-10 7:16 
GeneralRe: Receive data from server into CString Pin
CPallini7-May-10 7:19
mveCPallini7-May-10 7:19 
GeneralRe: Receive data from server into CString Pin
mesajflaviu7-May-10 8:05
mesajflaviu7-May-10 8:05 
QuestionHow to locate the code which was "Detected memory leaks!" Pin
transoft7-May-10 3:19
transoft7-May-10 3:19 
AnswerRe: How to locate the code which was "Detected memory leaks!" Pin
Electron Shepherd7-May-10 3:30
Electron Shepherd7-May-10 3:30 
GeneralRe: How to locate the code which was "Detected memory leaks!" Pin
transoft7-May-10 4:14
transoft7-May-10 4:14 
GeneralRe: How to locate the code which was "Detected memory leaks!" Pin
Electron Shepherd7-May-10 4:16
Electron Shepherd7-May-10 4:16 
GeneralRe: How to locate the code which was "Detected memory leaks!" Pin
transoft7-May-10 4:16
transoft7-May-10 4:16 
GeneralRe: How to locate the code which was "Detected memory leaks!" Pin
Maximilien7-May-10 5:07
Maximilien7-May-10 5:07 
AnswerRe: How to locate the code which was "Detected memory leaks!" Pin
Chris Losinger7-May-10 5:02
professionalChris Losinger7-May-10 5:02 

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.