Click here to Skip to main content
14,984,183 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with Timers Pin
ThatsAlok18-May-06 1:40
MemberThatsAlok18-May-06 1:40 
GeneralRe: Working with Timers Pin
VinayCool18-May-06 1:44
MemberVinayCool18-May-06 1:44 
AnswerRe: Working with Timers Pin
Roger Stoltz18-May-06 2:03
MemberRoger Stoltz18-May-06 2:03 
GeneralRe: Working with Timers Pin
VinayCool18-May-06 2:13
MemberVinayCool18-May-06 2:13 
GeneralRe: Working with Timers Pin
ThatsAlok18-May-06 2:06
MemberThatsAlok18-May-06 2:06 
QuestionRe: Working with Timers Pin
David Crow18-May-06 4:05
MemberDavid Crow18-May-06 4:05 
QuestionDebugging .NET DLL from VC++ Pin
dharani18-May-06 0:26
Memberdharani18-May-06 0:26 
QuestionERROR_INSUFFICIENT_BUFFER when calling HttpOpenRequest on separate thread Pin
tuxyboy18-May-06 0:01
Membertuxyboy18-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
MemberScorpio17-May-06 23:57 
AnswerRe: TCS Interview Pin
ThatsAlok18-May-06 0:15
MemberThatsAlok18-May-06 0:15 
GeneralRe: TCS Interview Pin
Scorpio18-May-06 0:24
MemberScorpio18-May-06 0:24 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 0:27
MemberThatsAlok18-May-06 0:27 
GeneralRe: TCS Interview Pin
Scorpio18-May-06 0:31
MemberScorpio18-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
MemberNibu babu thomas18-May-06 1:46 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 2:07
MemberThatsAlok18-May-06 2:07 
GeneralRe: TCS Interview Pin
Nibu babu thomas18-May-06 17:10
MemberNibu babu thomas18-May-06 17:10 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 18:55
MemberThatsAlok18-May-06 18:55 
GeneralRe: TCS Interview Pin
ThatsAlok18-May-06 2:07
MemberThatsAlok18-May-06 2:07 
AnswerRe: TCS Interview Pin
VinayCool18-May-06 0:19
MemberVinayCool18-May-06 0:19 
GeneralRe: TCS Interview Pin
Scorpio18-May-06 0:32
MemberScorpio18-May-06 0:32 
JokeRe: TCS Interview Pin
VinayCool18-May-06 0:34
MemberVinayCool18-May-06 0:34 
QuestionNew to C++. Few Questions About ArrayList type structure. Pin
Tristan Rhodes17-May-06 23:53
MemberTristan 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
MemberSwati_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.