Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with Timers Pin
ThatsAlok18-May-06 1:40
ThatsAlok18-May-06 1:40 
GeneralRe: Working with Timers Pin
VinayCool18-May-06 1:44
VinayCool18-May-06 1:44 
AnswerRe: Working with Timers Pin
Roger Stoltz18-May-06 2:03
Roger Stoltz18-May-06 2:03 
GeneralRe: Working with Timers Pin
VinayCool18-May-06 2:13
VinayCool18-May-06 2:13 
GeneralRe: Working with Timers Pin
ThatsAlok18-May-06 2:06
ThatsAlok18-May-06 2:06 
QuestionRe: Working with Timers Pin
David Crow18-May-06 4:05
David Crow18-May-06 4:05 
QuestionDebugging .NET DLL from VC++ Pin
dharani18-May-06 0:26
dharani18-May-06 0:26 
QuestionERROR_INSUFFICIENT_BUFFER when calling HttpOpenRequest on separate thread Pin
tuxyboy18-May-06 0:01
tuxyboy18-May-06 0:01 
This code works perfect without exceptions when calling it from the main appthread, but when called on a working thread (AfxBeginThread) httpOpenRequest gives a valid handle and the function works but a bunch of exception occures during the call and afterwards GetLastError returns ERROR_INSUFFICIENT_BUFFER.
I know I shouldn't be worried if I get a valid handle but anyway....
Any ideas?

code:

CONST TCHAR *szAcceptType = TEXT(HTTP_ACCEPT_TYPE);
HINTERNET hHTTPRequest = NULL;
CHECK_BOOL(NULL != (hHTTPRequest=::httpOpenRequest(hSession, // HTTP session handle
HTTP_VERB_HEAD, // HTTP Verb szURI, // Object Name
HTTP_VERSION, // Version
NULL, // Reference
&szAcceptType, // Accept Type
INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_KEEP_CONNECTION,
NULL))); // context call-back point

CHECK_BOOL(hHTTPRequest != INVALID_HANDLE_VALUE);

// REPLACE HEADER
CHECK_BOOL(::HttpAddRequestHeaders( hHTTPRequest, HTTP_ACCEPT, _tcslen(HTTP_ACCEPT), HTTP_ADDREQ_FLAG_REPLACE));

// SEND REQUEST
CHECK_BOOL(::HttpSendRequest( hHTTPRequest, // handle by returned HttpOpenRequest
NULL, // additional HTTP header
0, // additional HTTP header length
NULL, // additional data in HTTP Post or HTTP Put 0)); // additional data length


return hHTTPRequest;

CLEANUP:

m_dwError=::GetLastError();
#ifdef _DEBUG
LPVOID lpMsgBuffer;
DWORD dwRet=FormatMessage( FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
GetModuleHandle("wininet.dll"),
m_dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<lptstr>(&lpMsgBuffer),
0,
NULL);
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuffer, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree(lpMsgBuffer);
#endif

if (hHTTPRequest)
InternetCloseHandle(hHTTPRequest);
hHTTPRequest = NULL;

return hHTTPRequest;
QuestionTCS Interview Pin
Scorpio17-May-06 23:57
Scorpio17-May-06 23:57 
AnswerRe: TCS Interview Pin
ThatsAlok18-May-06 0:15
ThatsAlok18-May-06 0:15 
GeneralRe: TCS Interview Pin
Scorpio18-May-06 0:24
Scorpio18-May-06 0:24 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 0:27
ThatsAlok18-May-06 0:27 
GeneralRe: TCS Interview Pin
Scorpio18-May-06 0:31
Scorpio18-May-06 0:31 
GeneralRe: TCS Interview Pin
Rage18-May-06 1:38
professionalRage18-May-06 1:38 
GeneralRe: TCS Interview Pin
Nibu babu thomas18-May-06 1:46
Nibu babu thomas18-May-06 1:46 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 2:07
ThatsAlok18-May-06 2:07 
GeneralRe: TCS Interview Pin
Nibu babu thomas18-May-06 17:10
Nibu babu thomas18-May-06 17:10 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 18:55
ThatsAlok18-May-06 18:55 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 2:07
ThatsAlok18-May-06 2:07 
AnswerRe: TCS Interview Pin
VinayCool18-May-06 0:19
VinayCool18-May-06 0:19 
GeneralRe: TCS Interview Pin
Scorpio18-May-06 0:32
Scorpio18-May-06 0:32 
JokeRe: TCS Interview Pin
VinayCool18-May-06 0:34
VinayCool18-May-06 0:34 
QuestionNew to C++. Few Questions About ArrayList type structure. Pin
Tristan Rhodes17-May-06 23:53
Tristan Rhodes17-May-06 23:53 
AnswerRe: New to C++. Few Questions About ArrayList type structure. Pin
Rage18-May-06 2:00
professionalRage18-May-06 2:00 
QuestionHow to add bitmaps as menu items in menu? Pin
Swati_18817-May-06 23:37
Swati_18817-May-06 23:37 

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.