Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Measuring a String

Reply
Thread Tools

Measuring a String

 
 
John Fullman
Guest
Posts: n/a
 
      09-23-2005
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.

 
Reply With Quote
 
 
 
 
Jim Langston
Guest
Posts: n/a
 
      09-23-2005

"John Fullman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
 
Zara
Guest
Posts: n/a
 
      09-23-2005
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>
 
Reply With Quote
 
John Fullman
Guest
Posts: n/a
 
      09-23-2005

Zara wrote:
> GetTextExtentPoint32


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

 
Reply With Quote
 
Tim Love
Guest
Posts: n/a
 
      09-23-2005
"John Fullman" <(E-Mail Removed)> 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++.


 
Reply With Quote
 
benben
Guest
Posts: n/a
 
      09-23-2005
> 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


 
Reply With Quote
 
John Fullman
Guest
Posts: n/a
 
      09-24-2005

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Measuring serialized session "size" Bill Cohagan ASP .Net 1 11-25-2004 12:12 AM
Measuring Memory Useage Guadala Harry ASP .Net 2 10-25-2004 09:47 PM
Measuring Smtp traffic baboman Cisco 1 09-16-2004 02:19 PM
Problem with measuring Catalyst4006 interface capacity Joe Shen Cisco 4 01-01-2004 08:11 PM
Measuring performance of Net::FTP Carlo Filippini Perl 1 09-09-2003 05:41 PM



Advertisments