🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: DrawTextEx

#7659
From: Remy Lebeau (TeamB)
Date: Mon, 03 Jan 2005 18:50
22 lines
1611 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:41d983be@newsgroups.borland.com...

> If cFileName.Length() >=199 then the contents of a[] will not be \0
terminated.

It does not need to be since the length of the buffer is being passed to
DrawTextEx().  However, the length being passed is the size of the buffer,
not the length of the string that was stored in the buffer.  That will cause
DrawTextEx() to render more data than is actually in the buffer.  That needs
to be corrected, ie:

    char a[200] = {0};
    strncpy(a, cFileName.c_str(), 199);
    int length = min(cFileName.Length(), 199);

    DrawTextEx(lb->Canvas->Handle, a, length, &r, DT_MODIFYSTRING |
DT_PATH_ELLIPSIS, NULL)


Gambit
Technical Details
Message-ID: <41d99396$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41d5500e$1@newsgroups.borland.com> <41d983be@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,42d3caa052e60398
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: <41d5500e$1@newsgroups.borland.com> <41d983be@newsgroups.borland.com>
Subject: Re: DrawTextEx
Date: Mon, 3 Jan 2005 10:50:25 -0800
Lines: 24
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: <41d99396$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1104778134 68.69.17.41 (3 Jan 2005 10:48:54 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail