🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Send a mail with attachment

#13682
From: Rodolfo Frino
Date: Sun, 28 Sep 2003 15:42
59 lines
3163 bytes
> For a character not in the array that does a 20 item loop in which each
> iteration calls strlen (perhaps hoping optimization will cover him on
that)
> and indexes into an array.  All that when a simple call to achieve that
> which the standard function strchr  does.


That's a good point Ed. I forgot about strchr(). With this function the code
can be simplified as:

void SendCString(const char* s)
{
    const char CSpecialChar[] = "!@#$%^&*()_+{}|:<>?\"";
    for (unsigned int i=0; i < strlen(s) ; i++)
    {
        if (isupper(*(s+i)) || strchr(CSpecialChar, *(s+i)))
        {
            // send Shift key down
            keybd_event(VK_SHIFT, 1, 0, 0);
            // send char down
            keybd_event(VkKeyScan(*(s+i)), 1, 0, 0);
            // send char up
            keybd_event(VkKeyScan(*(s+i)), 1, KEYEVENTF_KEYUP, 0);
            // send Shift key up
            keybd_event(VK_SHIFT, 1, KEYEVENTF_KEYUP, 0);
        }
        else
        {
            // send char down
            keybd_event(VkKeyScan(*(s+i)), 1, 0, 0);
            // send char up
            keybd_event(VkKeyScan(*(s+i)), 1, KEYEVENTF_KEYUP, 0);
        }
    }
}

> He wrote it as dependent upon the VCL when it is not, adding an empty
> constructor for an unneeded form and setting a property at the bottom, a
> property of something not defined in the code shown and which is not part
of
> the functionality the code is supposed to illustrate.
> A custom and unneeded header file is included, a header file whose
contents
> are not shown on that page.

The property you refer to is a Label that I placed on the form at
design-time.
Well, I wanted to display the number of e-mails sent (MessageCount) on that
Label,
which must be on a Form, so I needed the form for that, and also to place a
button
to send the e-mail. Of course you could also do it without the Label and
without the Button.

I don't worry about the Labels/Buttons/etc. that are not declared anywhere,
people will figure it out,
and they will add them/drop them into their forms to run the example.

Rodolfo
Technical Details
Message-ID: <3f77017d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!small1.nntp.aus1.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: <3f70794d@newsgroups.borland.com> <3f7545de@newsgroups.borland.com> <3f755135@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,23d9e1242f297072
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-28 09:04:36 PST
From: "Rodolfo Frino" <rodolfofrino@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f70794d@newsgroups.borland.com> <3f7545de@newsgroups.borland.com> <3f755135@newsgroups.borland.com>
Subject: Re: Send a mail with attachment
Date: Mon, 29 Sep 2003 01:42:35 +1000
Lines: 61
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 203.206.18.13
Message-ID: <3f77017d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1064763773 203.206.18.13 (28 Sep 2003 08:42:53 -0700)
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail