473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Measuring a String

Let's say I wanted the exact width of a string (in pixels) based on a
certain font or device context.
Anotherwords, how do I implement a funciton prototyped...

int MeasureStringInPixels(HDC dc, HFONT font, const char* text);

I've been pouring through windows api documentation to find the answer,
but it is very unclear (at least to me.) I'm sure this is easy. Just
not sure how it's done.

Sep 23 '05 #1
6 1754

"John Fullman" <jo**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Let's say I wanted the exact width of a string (in pixels) based on a
certain font or device context.
Anotherwords, how do I implement a funciton prototyped...

int MeasureStringInPixels(HDC dc, HFONT font, const char* text);

I've been pouring through windows api documentation to find the answer,
but it is very unclear (at least to me.) I'm sure this is easy. Just
not sure how it's done.


Try microsoft.public.vc.language maybe. Or microsoft.public.vc. Or maybe
some other m$ group.
Sep 23 '05 #2
John Fullman wrote:
Let's say I wanted the exact width of a string (in pixels) based on a
certain font or device context.
Anotherwords, how do I implement a funciton prototyped...

int MeasureStringInPixels(HDC dc, HFONT font, const char* text);

I've been pouring through windows api documentation to find the answer,
but it is very unclear (at least to me.) I'm sure this is easy. Just
not sure how it's done.

<OT>
GetTextExtentPoint32
</OT>
Sep 23 '05 #3

Zara wrote:
GetTextExtentPoint32


Hmmm... I think microsoft should name their functions better.

Sep 23 '05 #4
"John Fullman" <jo**********@gmail.com> writes:
I've been pouring through windows api documentation to find the answer,
but it is very unclear (at least to me.)

I suggest that you find a newsgroup that deals with windows api rather
than with C++.
Sep 23 '05 #5
> Hmmm... I think microsoft should name their functions better.


If that scares you, I'll let you know it is not even a function name. It is
a MACRO which resolves to either GetTextExtentPoint32A or
GetTextExtentPoint32W.

And I must tell ye I can't forget the last time I used a similar name in my
own namespace only to find out after hours of examination that the windows
header rudely renames my function name.

I HATE MACROS FULL STOP.

Ben
Sep 23 '05 #6

benben wrote:
If that scares you, I'll let you know it is not even a function name. It is
a MACRO which resolves to either GetTextExtentPoint32A or
GetTextExtentPoint32W.

And I must tell ye I can't forget the last time I used a similar name in my
own namespace only to find out after hours of examination that the windows
header rudely renames my function name.

I HATE MACROS FULL STOP.


This I know... and I hate it with an equal amount of passion. The
windows macros have caused me pain as well. Grrr....

I'm with ya.

Sep 24 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mudge | last post by:
I'm writing PHP Web sites that are database driven with mysql. I'm looking for ways to measure the performance (speed) of my php code, so that I can find ways to write the fastest php code. Any...
4
by: Marek Möhling | last post by:
My server (Apache/1.3.28 - PHP/4.3.3) is configured to receive gzipped data via: Header append Accept-Encoding "gzip, deflate" PHP is configured to send gzipped data via: php_value...
6
by: Matthew Nuzum | last post by:
We've had a chance to talk to some of our competitors who have recently gone out of business. One of the major failings that contributed to their collapse was not accurately understanding how much...
6
by: James dean | last post by:
I am comparing performance of my own application with another microsoft product. Is there first of all any s/w that could measure the performance of a running application like Ms...
2
by: Jason James | last post by:
Hi all, Only when a printpage event is fired from my printdocument am I able to get a handle on my printer through the passed parameter as follows ByVal e As...
74
by: Dominik Wallner | last post by:
Hi! I'm currently implementing a program which measures voltages through an external USB-AD-converter. It should output those values as time/voltage pairs. My problem is to measure the time...
5
by: Martin Horn | last post by:
Hi all, I wonder if someone can help me out with this problem. I want to confine input of characters in a textbox to the amount that will fit in a given width on printed output. For example...
9
by: Ross | last post by:
I'm a newbie at this, and have searched a lot but can't find something that seems appropriate for measuring a recurring elapsed time. Creating an object with: var mydate = new Date(); seems...
1
by: dantz | last post by:
Hi everyone, I have a textbox which is multiline and wordwrap is true. I did not set any scrollbar because I want to show it manually (using different buttons) The textbox will sometimes have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.