|
I think the problem is that the size of the font (vertical points) is not matching the vertical real size in pixels. I mean: a font 8 is not 8 pixels height.
Edit:
Just make a test. Declare a Font of 8 or 10 or 12 (whatever you want), then make a TextOut at (10,50) and another at (10, 50 + Font size) you will see that doesn't match)
So the thing is that you should calculate aprox the coeficient you need for a line in pixels of MM_TEXT
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
modified on Monday, May 19, 2008 1:57 PM
|
|
|
|
|
Thanks I will check it tomorrow and will tell you,but it seems right,if I will practically find font height pixels everything will get solved.
|| Lust Causes Sorrow ||
|
|
|
|
|
I use class CImage to load & save file. I see that it requires the path with "\\" but when I get the path of the desktop image, it's the path with "\". How can I handle it ? Plz help me
|
|
|
|
|
the \\ is required only when you hard code the \ character, to escape it (so that the single \ doesn't escape the character next to it.
but when you get a string, it's already constructed, thus no need for modify it.
|
|
|
|
|
I don't understand. So, I give an example:
CImage Image;
Image.Load("D:\Test.bmp") <-- can't load
Image.Load("D:\\Test.bmp") <-- can load
What happens when a function retrieves the path D:\Test.bmp? How can we use it ?
|
|
|
|
|
do you understand when I say "hard coding the string" ???
it means when you write the path yourself from within the source code...
so typing Image.Load("D:\\Test.bmp") is hard coding the path, thus you need to escape the \ char into '\\'.
also, writing Image.Load("D:\Test.bmp") is incorrect because the \ is in fact escaping the character next to it, so the compiler tries to understand '\t' as a single character (and as it exists, it will write it - the tab character - in the string between ':' and 'e').
now, if you get that path from an "Open File" dialog for instance, you wont have to iterate over that string to replace every \ with \\. get it now ?
|
|
|
|
|
Have you?
Try to look at [^].
But you really need a good tutorial on C programming language.
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
|
|
|
|
|
capint wrote: Image.Load("D:\Test.bmp") <-- can't load
Because D:est.bmp (or maybe D:<tab>est.bmp ) is what actually gets sent as the argument to Load() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: D:est.bmp (or maybe D:est.bmp)
or even D:est.bmp !
(BTW I got what you meant, anyway kidding is irresistible to me...)
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
|
|
|
|
|
You're a such a bad guy.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I know, buddy!
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
|
|
|
|
|
you could alternatively use / , most windows functions accept it, and the standard C library functions automatically convert it. \\ is ugly especially in long paths.
|
|
|
|
|
I still can't understand. I know about escape sequences U mean that the path we receive from window functions is OK ( we don't need to replace although they just have "\"), is that right ?
|
|
|
|
|
capint wrote: U mean that the path we receive from window functions is OK
Yes, because those are not being seen by the compiler. What happens at runtime is completely different.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My problem is that. I receive the string from the function SystemParametersInfo and I use that string to load by Image.Load. It doesn't work
|
|
|
|
|
capint wrote: It doesn't work
Then something else is wrong. Does the file actually exist? What does Load() return?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
All my code is here :
TCHAR * Temp;
Temp = new TCHAR[100];
CString str;
SystemParametersInfo(SPI_GETDESKWALLPAPER,100,Temp,0);
CImage Image;
str = Temp;
Image.Load(str);
Image.ReleaseDC();
Image.Save(_T("D:\\Temp\\Desktop.bmp"));
I debuged & I saw clearly the path, of course, it exits
When I replace str by another string created manually, it works
|
|
|
|
|
Which statement is failing?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No statement is failing. It just doesn't do anything. Actually, when I replace "\" by "/", it works. But I still wonder
|
|
|
|
|
capint wrote: No statement is failing.
How are you verifying this?
capint wrote: Actually, when I replace "\" by "/", it works. But I still wonder
Single slashes (like those used on Unix machines) can be used in place of double backslashes.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You realize, of course, that the path can be up to 260 characters long?
|
|
|
|
|
Hi for all
Does anyone knows a free API for video screen capture?
|
|
|
|
|
Do you want to capture of avi files?
|
|
|
|
|
My real intention is to select an area of the desktop(or other window) and record until I want to stop. After this I'll save in any format.
Something like Camstudio but much more simple.
|
|
|
|
|