Archived

This topic is now archived and is closed to further replies.

tarscher

parameter problem

Recommended Posts

hi alln I want to use BOOL WinHttpSendRequest( HINTERNET hRequest, LPCWSTR pwszHeaders, DWORD dwHeadersLength, LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwTotalLength, DWORD_PTR dwContext ); my code looks like this //******** BEGIN CODE *********** LPCWSTR header = "Content-Type: application/x-www-form-urlencoded"; LPVOID formData = "formGebruiker=Raccoon&formPas=test"; // ... WinHttpSendRequest(hRequest, header, strlen(header), formData, strlen(formData), 0, 0); //******** END CODE *********** I have no idea on how to use the second and fourth parameter... When compiling the code I get 3 errors. C:\hattrick\main.cpp(11) : error C2440: ''initializing'' : cannot convert from ''char [48]'' to ''const unsigned short *'' C:\hattrick\main.cpp(46) : error C2664: ''strlen'' : cannot convert parameter 1 from ''const unsigned short *'' to ''const char *'' C:\hattrick\main.cpp(46) : error C2664: ''strlen'' : cannot convert parameter 1 from ''void *'' to ''const char *'' not that beautifull at all. Someone can help me out... regards Stijn

Share this post


Link to post
Share on other sites
Excuse me, but how exactly is the WinHttp API a "Graphics programming and theory" problem?

There's a Network programming forum, a General programming forum, and, no offence intended, this question would be best off in the Beginnner forum.

Please take the time to read this:

http://www.catb.org/~esr/faqs/smart-questions.html

And drop me an email, I will answer your original question off the forum.

[edited by - assen on May 6, 2003 2:05:25 PM]

Share this post


Link to post
Share on other sites
quote:

There''s a Network programming forum, a General programming forum, and, no offence intended, this question would be best off in the Beginnner forum.


Agreed. Moved to beginner forum.

Share this post


Link to post
Share on other sites
I appologize, I wanted to place this one in the general forum but I must have missplaced it, sorry. Still no answer to my question :-(

regards and I hope I get an answer soon
Stijn

Share this post


Link to post
Share on other sites
Check out what MSDN has to say about that.

And about your compiler errors:

WinHttpSendRequest(hRequest, header, strlen(header), formData, strlen(formData), 0, 0);

header must be a wide-string, and you can''t use strlen() on those. You don''t even need strlen() at all, if the string is null-terminated. Similar problem with formData: you can''t use strlen on a void*.

Try this instead:

const char formData[] = "formGebruiker=Raccoon&formPas=test";

WinHttpSendRequest(hRequest, L"Content-Type: application/x-www-form-urlencoded", 0, (LPVOID)formData, strlen(formData), 0, 0);

Share this post


Link to post
Share on other sites