🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4048

Re: Length of text in MessageBox function

#4048
From: Remy Lebeau (TeamB)
Date: Thu, 23 Mar 2006 18:34
28 lines
2161 bytes
"Richard Casten" <richard.casten@aero.org> wrote in message
news:4422D533.32E31292@aero.org...

> If I could find the length of any string in the font that is
> being used in the message box, I could figure out what
> the character position of the asterisk needs to be.

There isn't any native way to do that.  The easiest thing to do is to just
make your own dialog.  Then you can calculate the length of the strings that
you display.

> How would I get the device context given that I am using
> the MessageBox function to display the text?

The only way to gain any kind of access to the MessageBox's internals is to
install a hook via SetWindowsHookEx() for the calling thread before then
calling MessageBox().  When the hook notifies your code that new windows are
being created, you can check for the specific HWND of the text field, and
then use GetWindowDC() to get its HDC.  Even better, you can use this
technique to manipulate the MessageBox() window itself in order to expand
its dimensions, move its buttons around, add custom controls, etc.  You
could even hook the window procedure for the dialog and draw your asterik
directly onto it, rather than manipulating the string to make an asterik
fall into the desired location.


Gambit
Technical Details
Message-ID: <4422ea15$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4422D533.32E31292@aero.org>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b8d4aea1a094904b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4422D533.32E31292@aero.org>
Subject: Re: Length of text in MessageBox function
Date: Thu, 23 Mar 2006 10:34:29 -0800
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <4422ea15$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1143138837 68.69.17.41 (23 Mar 2006 10:33:57 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail