|
The prob is this in:
ListView_GetItemText(lpNmlv->hdr.hwndFrom, lParam2, lParamSort, szBuf2, sizeof(szBuf2));
the parameter lParamsort is wrong here, it should define the column (lpNmlv->iSubItem).
AND: Do you to set the LPARAM value when inserting your item?
Here is an excerpt from .NET help: "The lParam1 parameter is the 32-bit value associated with the first item being compared, and the lParam2 parameter is the value associated with the second item. These are the values specified in the lParam member of the items’ LVITEM structure when they were inserted into the list."
I hade precisely the same problems as you, now that I assured being the item.lPram member valid and changing the wrong parameter value to the item.iSubitem it works...
Hope it helps now?...
|
|
|
|
|
Tom Wright wrote:
My problem is that in my callback I need to access the window handle and I cannot
That's what the lParamSort paramter is for. You pass in whatever you want (for examnple, a number or a pointer to a data structure), and the same value is passed to your comparison function. Your comparision function can then interpret that lParam in the right way (as a number or dereference the pointer to get the data structure again), and process it.
|
|
|
|
|
I think you should be using ListView_GetItemData() with lParam1 and lParam2 .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I’ve used the CopyFile function for copy a file, but are there any “CopyDirectory”-function?
_____________________________
...and justice for all
APe
|
|
|
|
|
|
d00_ape wrote:
’ve used the CopyFile function for copy a file, but are there any “CopyDirectory”-function?
In Continuation with Mr. Ravi, this link provide you wrapper to ShFileOperation:-
http://www.codeproject.com/shell/cshellfileop.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
How would one go about adding a date time picker control to a list control (in report view)?
--
Edward Livingston
(aka ExtraLean)
--
"I still maintain that seeing a nipple is far less disturbing than seeing someone get their brains blown out." -- Chris Maunder
|
|
|
|
|
Hi
I have used the CFM_LINK, CFE_LINK style to some text in my CRichEditCtrl. The problem is that whatever color you choose for the whole text, the text with link properties is always blue and underlined. Due to design constrains, the background color of my CRichEditCtrl is... blue.
How could I change the color of the link text?
Thanks in advance
|
|
|
|
|
Hello!
I have to write a class in c++ which takes a char* as input, which is the content of an xml document, and gives back the canonical form of it without comments.
The problem is: i have to use msxml 4.0 or older, i cannot use .net, libxml etc.
I have been searching the web for a while now but nothing. If anybody could help me please do so.
|
|
|
|
|
Ruis Ngetal wrote:
...and gives back the canonical form of it without comments.
Are you wanting to canonicalize the name of the XML file or its contents? If the latter, are the strings actually file paths or URLs?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Well i get a string like:
"<?xml version="1.0"?>
<?xml-stylesheet href="doc.xsl"
type="text/xsl" ?>
<!DOCTYPE doc SYSTEM "doc.dtd">
<doc>Hello, world!<!-- Comment 1 --></doc>
<?pi-without-data ?>
<!-- Comment 2 -->
<!-- Comment 3 -->"
with all the whitespaces and linefeeds and the like, and i have to give back something like this:
"<?xml-stylesheet href="doc.xsl"
type="text/xsl" ?>
<doc>Hello, world!</doc>
<?pi-without-data?>"
normalizing the line feeds and whitespaces etc. as written in w3c's c14n standard (http://www.w3.org/TR/2001/REC-xml-c14n-20010315)
so i have to make a c14n canonicalizer.
|
|
|
|
|
Ruis Ngetal wrote:
so i have to make a c14n canonicalizer.
I wonder if the document's author, John Boyer, knows of any such utility.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
When open up the RHPOP3Connect.ntf (freeware downloaded at http://www.rhacl.de/freesoft.html), there are four java classes for: RHPOP3Connector, Pop3Mail, SMTPMail, and SocketMail. Anyone knows the source code for them?
David Li
|
|
|
|
|
int x = 1;
x = x++;
I think this should be well defined.
The operations are:
1. ++
2. =
As the expression x++ is an operand of operator=, I think it should be evaluated first (??).
The final value of x should then be 1.
But the increment seems to occur after the assignment. And x = 2.
|
|
|
|
|
pesho2932 wrote:
But the increment seems to occur after the assignment.
x++ is the post-increment operator. it increments after returning the value of the variable.
++x is the pre-increment operator. it increments before returning the value of the variable.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I know that (of course).
It can still be after the return and before the assignment. I think it should be there because the expression x++ is evaluated before the assignemet and it's effect should be complete by the time assignment occurs.
|
|
|
|
|
the steps for x = x++; go like this:
1. x++ evaluates to x (1).
1a. the ++ does not happen until after the expression containing it is complete (roughly speaking)
2. assign the value from step 1 to x (x=1)
3. x++ is performed, which increases x (2)
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
pesho2932 wrote:
As the expression x++ is an operand of operator=, I think it should be evaluated first (??).
Wrong. The ++ operator will complete before anything is assigned. Why would you want a half-baked value to be assigned to x ?
pesho2932 wrote:
The final value of x should then be 1.
It should be 2 as the current value of x , which is 1, is incremented by one, and the result of 2 is then assigned to x .
pesho2932 wrote:
But the increment seems to occur after the assignment. And x = 2.
Correct.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DavidCrow wrote:
pesho2932 wrote:
As the expression x++ is an operand of operator=, I think it should be evaluated first (??).
Wrong. The ++ operator will complete before anything is assigned. Why would you want a half-baked value to be assigned to x?
Hmm, being a postfix, the ++operator will complete at the end of the expression, so x = x will complete first, and then x with be incremented with ++. But maybe you explain it later in your response.
DavidCrow wrote:
pesho2932 wrote:
But the increment seems to occur after the assignment. And x = 2.
Correct.
Wait, if this is correct, and the increment occurs after the assignment, then how was you earlier statement correct, where you say the ++ operator will complete before anything is assigned? Your statements are in conflict.
In any case, this question is a moot point. We are dealing with one variable. The assignment is unnecessary, since x++ is the same as x += 1 and x++ will increment x, without having to reassign to x. Whether you increment before or after the assignment x = x does not matter. Then end result will be x == 2. Of course, while writing code compactly in one line might be cool and impressive, it is a lot easier to read if you separate the assignment and increment. Such as:
x = x;<br />
x++;
or...
x++;<br />
x=x;
In this way, someone reading your code is able to see much easier what you meant by that line of code and it makes finding and correcting errors much easier.
Danny
|
|
|
|
|
bugDanny wrote:
Hmm, being a postfix, the ++operator will complete at the end of the expression, so x = x will complete first, and then x with be incremented with ++. But maybe you explain it later in your response.
There are actually two expressions here. For VS6, the inner one (x++) is evaluated first and then the outer one (x=). The Precedence and Order of Evaluation rules dictate that postfix is always evaluated before assignment. For that matter, assignment is always evaluated last (with one exception).
Another way to look at this is the way some folks (used to) combine assignment and comparison statements into one, like:
while ((str = fgets()) != NULL)
... In this example, the inner, parenthesized expression (str = fgets() ) is evaluated first, and then the outer expression (str != NULL ) is evaluated last. It wouldn't make much sense to compare str to NULL before it had been assigned a value from the inner expression.
bugDanny wrote:
Wait, if this is correct, and the increment occurs after the assignment, then how was you earlier statement correct, where you say the ++ operator will complete before anything is assigned? Your statements are in conflict.
My bad. I meant to reiterate that the ++ operator was being evaluated before the assignment. Sorry for the confusion.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-- modified at 14:12 Thursday 15th September, 2005
|
|
|
|
|
x++ is a postfix operator, evaluating after the other expression evaluates. Try these experiments...
int x = 1;<br />
cout << x++;
If ++ behaved as you explained, then x++ should have incremented x before displaying, and the output would be 2. My experiment yields the output to be 1, since x is incremented after the other expression.
But wait, we were talking about assignments, not the use of (<<). So try this...
int x = 1;<br />
int y;<br />
y = x++;<br />
cout << y;
What is displayed now. The experiment is the same as in x = x++ , only now the assignment is stored in a different variable. It is no longer trivial.
DavidCrow wrote:
The inner one (x++) is evaluated first and then the outer one (x=). The Precedence and Order of Evaluation rules dictate that postfix is always evaluated before assignment.
According to this, x++ should be evaluated before y= . My experiment yields otherwise. Does The Precedence and Order of Evaluation perhaps talk about C, or an earlier version of C++?
Danny
|
|
|
|
|
bugDanny wrote:
But wait, we were talking about assignments...
Exactly. My earlier staments were about the postfix and assignment operators. They don't necessarily hold true for cout and the << operator.
bugDanny wrote:
cout << y;
What is displayed now.
Exactly what you told it to display, the value in y .
bugDanny wrote:
It is no longer trivial.
Trivial or otherwise, using the postfix and assignment operators in this fashion is a sure recipe for disaster. I've never done it this way, and can't see myself doing it in the future. I'm not a big fan of bad programming practices. That's all I can offer.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DavidCrow wrote:
bugDanny wrote:
cout << y;
What is displayed now.
Exactly what you told it to display, the value in y.
And the value in y was y = x++ , and should have been 2, if, as you said, x++ incremented before assigning to y. It was not 2, but 1, showing that the postfix operator incremented after the assignment.
DavidCrow wrote:
Trivial or otherwise, using the postfix and assignment operators in this fashion is a sure recipe for disaster. I've never done it this way, and can't see myself doing it in the future.
I agree with you wholeheartedly, as I mentioned in one of my responses earlier. But the question was not should he do it, he asked what would happen if he did it.
Danny
|
|
|
|
|
too add to the confusion.
8: int x = 1;
00401788 mov dword ptr [ebp-4],1
9: int y = 2;
0040178F mov dword ptr [ebp-8],2
10: int z = 0;
00401796 mov dword ptr [ebp-0Ch],0
11: z = y++, y = x++ ;
0040179D mov eax,dword ptr [ebp-8] #Set eax = to the value of X = 1
004017A0 mov dword ptr [ebp-0Ch],eax #Set Y = EAX = 1
004017A3 mov ecx,dword ptr [ebp-8] #Move vlaue of X to ECX
004017A6 add ecx,1 #Add 1 to ECX
004017A9 mov dword ptr [ebp-8],ecx #Move NewValue to Y = 2
004017AC mov edx,dword ptr [ebp-4] #Move X to EDX = 1
004017AF mov dword ptr [ebp-8],edx #Move EDX to Y = 1
004017B2 mov eax,dword ptr [ebp-4] #Move X to EAX
004017B5 add eax,1 #increment
004017B8 mov dword ptr [ebp-4],eax #finaly Reset the value of X
out put Z=2 Y=1 X=2
The increment always happens last.
When used in an expression the compiler takes the value and sticks it in assembly after the rest of the statement has been compiled it does the increment.
a programmer traped in a thugs body
|
|
|
|
|
bugDanny wrote:
But the question was not should he do it, he asked what would happen if he did it.
Agreed. To quote K&R from many years ago:
"The moral is that writing code that depends on order of evaluation is a bad programming practice in any language. Naturally, it is necessary to know what things to avoid, but if you don't know how they are done on various machines, you won't be tempted to take advantage of a particular implementation."
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|