🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to use traditional Windows message and API function ?

#636
From: Dennis Jones
Date: Mon, 11 Feb 2008 23:10
36 lines
2062 bytes
"nick" <nileiqi@hotmail.com> wrote in message 
news:47b0d385$1@newsgroups.borland.com...

> (1) Receiving a message in application.
> (2) I want application receiving a message and then display some kind of 
> infomation. I can do that in traditional Windows API program but don't 
> know how to do it in C++ builder. Thanks.

Easy.  Let's say you want to know when the PC clock time has changed (I do 
this in one of my apps):

// in your header file
class TMyForm : public TForm
{
private:
    // declare a handler function for your message
    MESSAGE void __fastcall WM_TimeChange(TMessage &Message);

BEGIN_MESSAGE_MAP
    // associate your handler function with some message
    VCL_MESSAGE_HANDLER(WM_TIMECHANGE,              TMessage, 
WM_TimeChange);
END_MESSAGE_MAP(TForm);
};

// in your source file
// define the handler function
MESSAGE void __fastcall TMyForm::WM_TimeChange(TMessage &Message)
{
    // do something when the WM_TIMECHANGE message is received
}

This works for both Windows messages and application-defined messages.

- Dennis 
Technical Details
Message-ID: <47b0d5c9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <47b02ecf$1@newsgroups.borland.com> <MPG.221a525c60a3d10c989a5f@newsgroups.borland.com> <47b0d385$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,985e142ee2266c4
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47b02ecf$1@newsgroups.borland.com> <MPG.221a525c60a3d10c989a5f@newsgroups.borland.com> <47b0d385$1@newsgroups.borland.com>
Subject: Re: How to use traditional Windows message and API function ?
Date: Mon, 11 Feb 2008 15:10:03 -0800
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.245.109.58
Message-ID: <47b0d5c9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1202771401 71.245.109.58 (11 Feb 2008 15:10:01 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail