|
Hello guys. It's my first application with WinHTTP. Please help me to fix an error.
This errors occurs after include "winhttp.h" file to stdafx.h of my application:
StdAfx.h:
<br />
#ifndef VC_EXTRALEAN<br />
#define VC_EXTRALEAN<br />
#endif<br />
<br />
#ifndef WINVER<br />
#define WINVER 0x0501<br />
#endif<br />
<br />
#ifndef _WIN32_WINNT<br />
#define _WIN32_WINNT 0x0501<br />
#endif <br />
<br />
#ifndef _WIN32_WINDOWS<br />
#define _WIN32_WINDOWS 0x0410<br />
#endif<br />
<br />
#ifndef _WIN32_IE<br />
#define _WIN32_IE 0x0600<br />
#endif<br />
<br />
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS<br />
#define _AFX_ALL_WARNINGS<br />
<br />
#include <afxwin.h><br />
#include <afxext.h><br />
#include <afxdisp.h><br />
<br />
#include <afxdtctl.h><br />
#ifndef _AFX_NO_AFXCMN_SUPPORT<br />
#include <afxcmn.h><br />
#endif // _AFX_NO_AFXCMN_SUPPORT<br />
<br />
#include <winhttp.h>
When I complile this application then I gets following list of the errors:
<br />
..\winhttp.h(285): error C2065: '__in' : undeclared identifier<br />
..\winhttp.h(285): error C2143: syntax error : missing ')' before 'const'<br />
..\winhttp.h(285): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(285): error C2491: 'WinHttpTimeFromSystemTime' : definition of dllimport data not allowed<br />
..\winhttp.h(287): error C2059: syntax error : ')'<br />
..\winhttp.h(292): error C3861: '__in': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(292): error C2146: syntax error : missing ')' before identifier 'LPCWSTR'<br />
..\winhttp.h(292): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(292): error C2491: 'WinHttpTimeToSystemTime' : definition of dllimport data not allowed<br />
..\winhttp.h(294): error C2059: syntax error : ')'<br />
..\winhttp.h(313): error C2065: 'dwUrlLength' : undeclared identifier<br />
..\winhttp.h(313): error C3861: '__in_ecount': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(313): error C2146: syntax error : missing ')' before identifier 'LPCWSTR'<br />
..\winhttp.h(313): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(313): error C2491: 'WinHttpCrackUrl' : definition of dllimport data not allowed<br />
..\winhttp.h(317): error C2059: syntax error : ')'<br />
..\winhttp.h(322): error C3861: '__in': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(322): error C2146: syntax error : missing ')' before identifier 'LPURL_COMPONENTS'<br />
..\winhttp.h(322): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(322): error C2491: 'WinHttpCreateUrl' : definition of dllimport data not allowed<br />
..\winhttp.h(326): error C2059: syntax error : ')'<br />
..\winhttp.h(1029): error C3861: '__in': identifier not found, even with argument-dependent lookup<br />
..\winhttp.h(1029): error C2146: syntax error : missing ')' before identifier 'DWORD'<br />
..\winhttp.h(1029): warning C4229: anachronism used : modifiers on data are ignored<br />
..\winhttp.h(1029): error C2491: 'WinHttpDetectAutoProxyConfigUrl' : definition of dllimport data not allowed<br />
..\winhttp.h(1031): error C2059: syntax error : ')'<br />
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
Eugene Pustovoyt wrote: error C2065: '__in' : undeclared identifier
what version of visual studio you are using. It seems __in definition is present in VC7 and VC8.
|
|
|
|
|
|
Sir,
Can u please suggest me how to write the file extentions .I want to use
vc++ . I was given the code link .But I am sorry to say that It contained errors.Sir, I also want some theoretical knowledge about how to write file extentions.Can u please send me a link .
Thanks
|
|
|
|
|
without more details on your particular problem, this is the only answer I can give you :
CString sFileName( _T("YouFileName" ) );
CString sExtension( _T(".YourExtension" ) );
CString sFullFileName;
sFullFileName = sFileName + sExtension;
|
|
|
|
|
amaneet wrote: I also want some theoretical knowledge about how to write file extentions.
Such as? A file's extension is just part of its filename.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Can you be more specific what do you want exactly?
|
|
|
|
|
I have created a few function which accept an LPVOID paramater. I often call these functions passing in a LPBYTE '0xFFFFFF00' (Don't ask). Rather than creating this value for each time I want to pass it, I decided to add it to a define statement.
const UINT D_N_ = 0xFFFFFF00;
#define DOUBLE_NULL (LPVOID)&D_N_
Thats the only way I could make it work, but it looks ugly! Is there a correct way of doing this?
|
|
|
|
|
waldermort wrote: I have created a few function...
Are they functions or class methods?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Ok, so what about:
class MyClass
{
void foo(LPVOID lpVoid = (LPBYTE) 0xffffff00);
}; Now you can call the foo() method with or without an argument.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I know, but for the sake of readability, I would like to have a big bold DOUBLE_NULL on the calling line. I'm calling these particular functions hundreds of times all over the code, it get's confusing when I can't see exactly why the function is being called. I do usually use this calling convention, but more for a function that is only called a very few times.
|
|
|
|
|
waldermort wrote: const UINT D_N_ = 0xFFFFFF00;
the define could also be a const is that what you mean?
const LPVOID DOUBLE_NULL = (LPVOID)&D_N_;
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
No, I was hoping to do it in a single line. But like they say "If it ain't broke, don't fix it"
|
|
|
|
|
David and Zac's examples do not use the address-of operator. Does your solution require it? If so it is not possible to do in one line since a memory address is requried... correct?
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
It is generally bad practice to use #define to define constants in C++. The preferred method it to declare it as a constant variable:
const UINT D_N_ = 0xFFFFFF00;
const LPVOID DOUBLE_NULL = (LPVOID)&D_N_;
you could get it to 1 line if you wanted to:
const LPVOID DOUBLE_NULL = (LPVOID)0xFFFFFF00;
As for declaring your functions, I would avoid using default parameters and instead actually pass in this value as needed. If this function is being called a substantial number of times, you may want to re-evaluate some of your other code, or perhaps wrap the call to myFunc(DOUBLE_NULL) in an inline helper method:
inline void MyFuncWithDoubleNull()
{
myFunc(DOUBLE_NULL);
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thanks for advising me to declare it as a constant variable. I had already tried the 1 line method, but the code calls for the address of operator and throws an exception when using it within the memcpy() function.
I'm not sure I understand what you mean about using an inline helper. I'm guessing it's similar to a macro right? As it happens I am re-writing the class to taking out the duplicate code and replacing it with a series of helper functions. Trouble is these helper functions heavily use other class members which prevents me taking it out of the class.
|
|
|
|
|
waldermort wrote: I had already tried the 1 line method, but the code calls for the address of operator and throws an exception when using it within the memcpy() function.
From your description, using it in functions like memcpy would do far worse than throw an exception. Unless that memory is allocated somewhere, you will be trying to copy/write to a very high location in memory that isn't yours to write to.
waldermort wrote: I'm not sure I understand what you mean about using an inline helper. I'm guessing it's similar to a macro right?
Not exactly, but the idea is the same. I believe I gave an example in my previous response.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
The 1-line one do not have the same meaning as the 2-line one.
In
const UINT D_N_ = 0xFFFFFF00;
const LPVOID DOUBLE_NULL = (LPVOID)&D_N_;
DOUBLE_NULL is an address that points to 0xFFFFFF00 , but in
const LPVOID DOUBLE_NULL = (LPVOID)0xFFFFFF00;
DOUBLE_NULL is an address while the address itself is 0xFFFFFF00 , and nobody knows what it is pointing to.
|
|
|
|
|
fefe.wyx wrote: The 1-line one do not have the same meaning as the 2-line one.
I realize that. I was under the impression that is what he was looking for (that is, a pointer to 0xFFFFFF00). If he really wanted some variable declared to with that value to point to, then the two line version is the only want to accomplish it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Greetings:
I have a simple question: In a CListCtrl (configured in report mode), how do I simply select the item number that I want to appear at the top of the list. In other words, my list has, say, 1000 items and I would like to programatically scroll the list so that item number 500 is positioned at the top of the view. I do not necessarily need it to be selected or have the focus, I just want to position it.
Thanks in advance,
Mark
|
|
|
|
|
Note the difference between the item indices CListCtrl saved and logical indices you used in putting which item on the top. CListCtrl always sets the top item's index to 1, which you cannot change. If you moved item #500 to the top, then its index will be changed to 1. CListCtrl maintains this indexing for user selection purpose.
Thus, to programmatically move the items any way you want, you have to maintain your own logical indexing, as you do with sorting criteria.
Best,
Jun
|
|
|
|
|
Can you make use of CListCtrl::EnsureVisible() ?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi:
I found that EnsureVisible will only make sure that you can SEE the item. It does not necessarily put it at the top of the view. If the box is currently showing item 0 at the top, and I ask to EnsureVisible for item 500, then it will only scroll enough to show item 500 at the BOTTOM of the view range.
Its all very surprising. It seems like a pretty common need - to want to scroll the view range so that item N appears at the top of the view range - yet it is not easy to do...
Cheers,
Mark
|
|
|
|
|
Jethro63 wrote: It seems like a pretty common need...
This marks the first time I've heard of it.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|