|
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.
|
|
|
|
|
|
You can put an icon in fancy new balloon tooltips (and I do so for a tray app I wrote).
But multilines with varous graphical symbols, you'll have to make your own window.
Have look at Paul DiLascia's June 2001 MSDN Magazine article, where he does a CPopupText window - and adapt it with as many pics as you can shake a stick at.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Hello everyone,
For the MSDN sample,
http://msdn2.microsoft.com/en-us/library/2af6btx2.aspx
template <class U>
struct rebind { typedef stingyallocator<U> other; };
My question is, what is the purpose of defining an internal struct which has only a type? How to use it? Why class U is different from _Ty?
(I see similar code in STL internal implementation for allocator class, seems like a pattern which I do not know.)
thanks in advance,
George
|
|
|
|
|
There is the allocator::rebind documentation in MSDN.
Maxwell Chen
|
|
|
|
|
|
George_George wrote: So, I think the purpose of this pattern is to change the template parameter (input type parameter to outer struct) to another one?
I guess so. I traced vector class (VC++2005), and found it rebind the outer type, _Ty , again (type no change).
Maxwell Chen
|
|
|
|
|
Thanks Maxwell,
Question answered.
regards,
George
|
|
|
|
|
dear all
my problem is below, anyone help me to check, thanks a lot.
T,sigma,maskSize,halfSize are all declared.
for (int k=0;k<5;k++)
{
halfSize = static_cast<int>(sqrt(-log(T))*2*pow(sigma[k],2));
maskSize = 2*halfSize + 1;
int Mask[k][maskSize][maskSize];
int valueX[k][maskSize][maskSize];
int valueY[k][maskSize][maskSize];
}
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
so anyone help me. thanks
Li Zhiyuan
|
|
|
|