|
Thank you for the link. I found the link before I post my question.
I am thinking is there a workaround method instead of changing the Windows' setting.
It looks like it is only solution. MS should design a new function call like GetCharABCWidthsFloatEx to allow user to specify it is a standard or ClearType font and with a default value "standard".
Best,
|
|
|
|
|
transoft wrote: I did not say "I think". I actually tried the function and got the results. I
tried on different machine (XP, VISTA, WIN 7). I used exact same configuration.
But I got different results.
But it's not the same configuration - it's a different platform and there is no way it can be the same video drivers. Windows is constantly changing how text is drawn. ClearType, NTDDI, and changes to the fonts themselves mean that there might be different values.
Are we talking about large differences in the return values?
Maybe as a test, you can write a string, and measure the bounding rectangle and see if it's different on each platform.
/* Charles Oppermann */
http://weblogs.asp.net/chuckop
|
|
|
|
|
I saw this question about a minute after you posted it. Having never heard of the function before I started looking into it, finding as others have mentioned that the values are supposed to depend on a number of different things.
Immediately, I set to work whipping up an application to test the function. No matter what I thought of to try,I couldn't get the vales returned to change. I ran the app both under XP 32 bit and Win7 64 bit. Each OS returned the same values, as did each font I tried (only tried 2) as did each font-size and weight I tried. Win7 has clear-type enabled, XP doesn't. Win7 running on my laptop, XP running in a virtual machine on the same laptop.
This made it clear to me that I wasn't qualified to even begin to answer your question. Though, still I couldn't help wondering why it was such a problem. Surely different conditions would mean that the mapping between logical width and number of pixels would change.
Take for example, the dialog units that are used. (on dialogs, oddly enough) These vary based upon the size of the chosen dialog font. This allows an app to continue to look right whether your default text size is 11pt and you use it as a desktop 1 foot in front of you, or if you have text-size set to 30pt and you use it as a media-pc, hooked up to your telly. This is one of the differences between regular windows and media-center edition - the default text size.
I would suggest that you mention why it matters to you if the function returns different values. There is after all, a transformation that happens to these values before they are ultimately used, so why can't you also do this transformation before you do your calculations?
The clearer you make your problem, the more likely you are to get a solution that's a good fit!
|
|
|
|
|
Thank you so much for spending so much time on this. I really appreciate it.
Actually, I have a solution (Don't use clear-type font) for it now. The reason I post my question here is that I want to find a workaround for this. I hate to change Windows setting every time when I start to use my software. Right now it looks like it is impossible without changing Windows setting.
Best regards,
|
|
|
|
|
my control loads fine some methods work
void CWindowsGTView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
SetWidth(300);
SetHeight(300);
MessageBox(L"test");
GetDocument()->SetTitle(L"one mad scientist");
Navigate2(_T("http://localhost/test_build.php"),NULL,NULL);
}
although set SetTitle and some methods work other don't work
and don't show up in intellesence either
//for example this doesn't work but SetTitle does
GetDocument()->InvokeScript("test");
http://msdn.microsoft.com/en-us/library/aa752046%28v=vs.85%29.aspx[^]
basically trying to do this to allow two way communication
heard some reports this is broken in windows7 and ie 9
but nothing substantial
have not used mfc a lot used to the native api but
word around is com is a real head ache in the native api
so far this is more of a head ache, if anybody has done this sort of thing and point out where im going wrong be much appreciated!
|
|
|
|
|
Hi,
suppose if i declare any virtual function as an inline how it differentiates from compile time ?
Base class object pointer variable may reference to inherited object.How inline works in such case?
thank you
modified on Thursday, August 25, 2011 9:24 AM
|
|
|
|
|
Since it can't it won't inline it (inline is just a tip for the compiler).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It is actually possible under certain conditions for the compiler to inline virtual functions.
Consider the following:
class Base
{
virtual void func() {...}
};
class Derived : public Base
{
virtual void func() {...}
};
Base b;
b.func();
Derived d;
d.func();
In both cases, the compiler can chose to inline func.
|
|
|
|
|
Yes, you are right, I should have written: "the compiler cannot always inline virtual functions...". However, the rationale behind virtual function is for supporting polymorphism, hence I assumed, in my answer, that late binding was the case of interest.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
There are two rather common examples where virtual functions are resolved statically, and therefore can be inlined without problem:
1. Explicitely calling the base class implementation
2. Virtual destructors. The compiler will automatically create a chain of calls to destructors according to the inheritance chain. These are resolved statically. The only thing that may be resolved dynamically (at runtime) is the top level call, and even that only if the compiler cannot determine the actual class at compile time
class Shape {
bool state;
public:
inline virtual void initialize() {
state = false;
}
inline virtual ~Shape() {}
};
class Square : public Shape {
float width;
public:
virtual void initialize() {
Shape::initialize();
width = 0.;
}
~inline virtual ~Square() {}
};
int main() {
Shape* pShape = new Square;
pShape->initialize;
delete pShape;
return 0;
}
|
|
|
|
|
You can inline virtual functions just like any others: either by using the 'inline' keyword, or just by writing the function definition right into the declaration. Sometimes this makes sense (such as for destructors), sometimes it doesn't. It mostly depends on whether or not a compiler is able to decide what class a particular object pointer actually points to. Somtimes this can only be detemined at runtime and in that case, obviously, no inlining will occur.
More information and examples can be found on the web, e. g. here: http://msdn.microsoft.com/en-us/magazine/cc301407.aspx[^] or here: http://drdobbs.com/cpp/184403747[^]
In short - if the type of an object pointer can only be determined at runtime, then inlining is not possible, even if the base class and all derived classes do have inlined implementations of that function. If you really, absolutely, desperately need a function to be inlined, either make sure that a particular version is being called (if that is even possible), or simply don't use inheritance for that. That said, since inlining is really only the very last step in performance optimization, it's usally not a real issue: if you can't inline, then you just don't.
|
|
|
|
|
How to get attachment filename without download attachment file in C++ or C# or Java? Which library support this?
|
|
|
|
|
Attachment to what? Outlook? Gmail? Hotmail? Other?
|
|
|
|
|
Attachment to message in Gmail mailbox.
|
|
|
|
|
I'd suppose that one of the 24 million, six hundred thousand google search results for gmail c/c++ api[^] would have the answer?
|
|
|
|
|
I have made my virtual pc using virtual hard disk. but when i put files in my virtual hard disk via windows explorer, i can not see them in my virtual pc. Is there any way to access these files through the virtual pc. I m using windows CE 7 as OS in my virtual pc.
|
|
|
|
|
What does your question have to do with C/C++/MFC?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
hi,
how do i detect memory leak, in a win32 console project?
Zo.Naderi-Iran
|
|
|
|
|
|
If all else fails, you can use the Signal Flare debugging pattern: Increase the size of your allocations (one at a time) by ten, and rerun your program. When the memory leak increases by ten, you've found the problem.
|
|
|
|
|
|
|
If using protocol TCP and UDP how to use more network bandwidth?
Especially, how to limit transfer speed of other application, when my program is transferring data?
|
|
|
|
|
Q1: Increase the packet-size as much as practical. The header size is fixed, so by increasing the total size of the packet, you are minimizing the proportion of the data that is used to just transfer the header.
The downside is that more packets will fail a CRC check, meaning you'll have to download a larger number of larger chunks of data in the event of CRC failure.
Q2: Don't know. I certainly wouldn't want a program to explicitly screw with the transfer speed of an app I was already running. I suspect that the best solution would be to have the user pause/shut-down these other programs themselves.
|
|
|
|
|
Assume your program can,Then, why others program can not?
If all the programs can, what will be the result?
|
|
|
|