|
What is your confusion, DavidCrow? I am learning allocator and have some concept level questions. Any ideas?
regards,
George
|
|
|
|
|
George_George wrote: Any ideas?
None whatsoever.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Simply adding ON_UPDATE_COMMAND_UI doesn't work.
Thanks.
|
|
|
|
|
I just go through the menu items using GetSubMenu()/EnableMenuItem() to enable or disable
items before calling TrackPopupMenu().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I want to enforce the OS, not to suspend a special thread during execution a set of operations, in a ,multithread program in c++.(all of my threads has the Realtime priority)
OS: WinXP
IDE: VS 2005
|
|
|
|
|
I'm not sure I understand your question very well. What you would like to do is in fact that when you process a certain set of operations, disable thread switching (so that no other thread is processed until you have finished to process your set of operations). Is that what you want to do ?
If yes, then I'm almost certain you can't do that. But there are other mean to achieve a similar result: if the only thing you want to do is to avoid that two threads of your program access the same 'resource' (whatever it might be) at the same time, then you can simply use a critical section to protect the access of said resource.
|
|
|
|
|
Actually i am working on my program performance.
I want to know how much does it take to execute a set of operations in a thread,
when 6 threads are running the same set of operations.
I hace a timer for each thread, which starts at the beginning of these operations and
stops at the end of these operations.
but because of time slicing the timer value does not show the time executed by the same thread.
|
|
|
|
|
You would need to add functionality to the operating system scheduler to accomplish this and since Microsoft operating systems are closed source, it is doubtful at best that you would be able to see and modify the source for your intended purpose.
What is the reason that the thread operations are critical? Is it that they need to be executed in order? Do they need to be executed one right after another? If yes is the answer to either of the last two questions, then critical sections is the answer your looking for.
Phil
|
|
|
|
|
Hi,
I wanted to interface an *.htm to my VC++ MFC program but I don't know how. Do I need a container for it?
Is it possible to place in a CView?
How will i implement it?
If you knew of a thread, please let me know.
Hope somebody can help me with this.
Thank you.
|
|
|
|
|
To display HTML documents?
Maxwell Chen
|
|
|
|
|
TooShy2Talk wrote: I wanted to interface an *.htm to my VC++ MFC program
Hans Dietrich has written a few wonderful articles[^] on these lines.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
You should see the CHtmlView class.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
|
I have a CTreeCtrl derived class which does heavy custom drawing for various styles.
One of the style is "Right justified" item, that is a tree item should be drawn at the right most corner of the window. Its an hyperlink as well.
I have handled NM_CUSTOMDRAW, and I do painting in PrePaint and say a Skip Default to prevent the custom drawn items to be painted again.
The code looks like this (Excerpt only)
GetItemRect(hItem, textRect, TRUE);
GetItemRect(hItem, itemRect, FALSE);
<br />
if ( itemStyle is Right Justified ) {<br />
<br />
itemRect.right -= _offsetRTJustifed;<br />
<br />
itemRect.left = itemRect.right - textRect.Width();<br />
<br />
pDC->DrawText(sItemText, &itemRect, DT_LEFT);<br />
}
This right justified item is added under a root item and appears when user expands that root item. When the user plays around with the tree items, expanding and collapsing often, the vertical scroll bar appears and disappears as per the number of tree items. Due to this scroll bar appearing/disappearing, the painting of this right justified item gets garbled.
(It seems as if the paint messages are lost in between very frequent scroll bar displays/removals)..
Its difficult to suggest, but would appreciate if somebody has a clue about it..
Thanks
Evil triumphs when good people sit quiet...
|
|
|
|
|
Hello everyone,
Any ideas why there is no ambiguity issues in the code? Which myfunc is called?
The code can pass compile and link in Visual Studio 2008 without any warning messages. The output is 100.
int myfunc (int& a) {return 100;}
int myfunc (const int& a) {return 200;}
int main()
{
int a = 1;
int& ra = a;
int rtn;
rtn = myfunc (ra);
return 0;
}
thanks in advance,
George
|
|
|
|
|
is n't it obvious.
try also,
1)
const int& ra = a;
rtn = myfunc (ra); // output 200
2)
int& ra = a;
rtn = myfunc (const_cast<const int&>(ra)); // output 200
And why ambiguity.
|
|
|
|
|
Hi Rajkumar,
The ambiguity in my original code is, ra is a non-const reference, it can match both non-const reference and const reference. If you try to commet out the version of myfunc which accepts non-const reference, the code still works and output 200, so both matches and there should be at least an ambiguity error or warning? Why?
regards,
George
|
|
|
|
|
yes, i am taking my word (isn't it obvious).
you will get answer for this here Argument Matching[^]
abstract: takes best match.
|
|
|
|
|
|
I know your post on ambiguity is based on our discussion on qualifier on base type.
we already discussed this, and Argument Type Differences [^], but iam sure you will find buggy sample i this link.
I don't have much more to say on qualifier on base type and qualifier on reference type, any way i try this,
int func(int &); and int func(const int &) has exclusive presence,
say, const int &ra = a; can be passed to func(ra) only if the second one exists.
while in, "int func(int )" and "int func(const int )" no exclusive presence.
|
|
|
|
|
Thanks Rajkumar,
Your reply is just what I want to have, cool! Especially the following statements from the link you recommended,
--------------------
For the same reason, function arguments of a type modified by const or volatile are not treated differently than the base type for the purposes of overloading.
However, the function overloading mechanism can distinguish between references that are qualified by const and volatile and references to the base type. This makes code such as the following possible:
--------------------
regards,
George
|
|
|
|
|
George,
Consider the 'best-match' rule. Both functions are acceptable, but one of them has better match for arguments than the other; i.e. myfunc(int&) better matches to the given argument then myfunc(const int&).
--
=====
Arman
|
|
|
|
|
Thanks Arman,
But if we remove & and change code to the following segment,
int myfunc (int a) {return 100;}
int myfunc (const int a) {return 200;}
There will be duplicated defined function error. So I think the rules are,
1. (as you said) compiler allow more than one matched function exist, but has a priority to match them;
2. (as I showed above) for const reference and non-const reference, compiler will treat them of two different functions, but for non-const value and const value, compiler will treat them as same functions.
My conclusions (1) and (2) are correct?
regards,
George
|
|
|
|
|
Can we draw a colored rectangle (symbol) in a tootltip? I need a tooltip which displays multiline text, that is, each row(line)in the tooltip will have a colored rectangle and text displyed next to it.
|
|
|
|
|