Re: How to print the cookie value
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Mon, 01 Oct 2007 09:07:09 -0400
bhattacharjeesoft@xxxxxxxxx wrote:
I have not used InternetGetCookie, but it would seems that you may be
mixing char and wchar_t strings.
Try like this:
LPCTSTR name= _T("usrauth");
TCHAR buffer [16384];
DWORD bufferSize = sizeof(buffer)/sizeof(buffer[0]);
BOOL bRes = InternetGetCookie((_T("http://www.mirracle.com"), name,
buffer, &bufferSize);
::MessageBox(NULL, buffer, NULL, MB_OK);
This should work for both Unicode and ANSI builds.
--
David Wilkinson
Visual C++ MVP
'InternetGetCookieW' : cannot convert parameter 1 from 'unsigned short
[26]' to 'const char *'
that is the error I am getting if I use ur code.Function is returning
false with error code 12006.What to do?
bhattacharjeesoft:
Are you sure you used the code exactly as I (and Giovanni) suggested?
Actually, there was a typo in my version (unmatched parenthesis), but you must have fixed that. Should be
BOOL bRes = InternetGetCookie(_T("http://www.mirracle.com"), name,
buffer, &bufferSize);
What version of Visual Studio are you using? If you are using VC6, have you defined both UNICODE and _UNICODE (or neither)? If you are using VC7 or later, I would also suggest you select the "treat wchar_t as a distinct type" (or something like this) in the project settings.
But, your error message does not seem consistent with the documentation on InternetGetCookie(). Surely InternetGetCookieW() should take a LPCWSTR as first parameter?
--
David Wilkinson
Visual C++ MVP
.
- References:
- How to print the cookie value
- From: bhattacharjeesoft
- Re: How to print the cookie value
- From: David Wilkinson
- Re: How to print the cookie value
- From: bhattacharjeesoft
- How to print the cookie value
- Prev by Date: where is the mistake here?
- Next by Date: OnInitialUpdate : start or end
- Previous by thread: Re: How to print the cookie value
- Next by thread: Re: vc++ different basic types
- Index(es):
Relevant Pages
|