🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Getting Message with WinMain

#2549
From: Remy Lebeau (TeamB)
Date: Mon, 12 Feb 2007 20:34
33 lines
2088 bytes
"poojo hackma" <poojo.com/mail> wrote in message
news:45d0cc1f@newsgroups.borland.com...

> I've got a small AutoRun style application that currently only
> has a WinMain function (i.e. old C program style).
>
> How can I add the ability to search for Windows Messages like
WM_COMMAND?

First, you need an actual window to receive the message with.  Console
applications do not have a window by default.  You will have to call
CreateWindow/Ex() for that.

Second, you need an active message queue to receive and process
messages with.  You will have to call Get/PeekMessage(),
TranslateMessage(), and DispatchMessage() for the lifetime of the
program for that.

> TCustomForm includes a WndProc function that has what I want, but
> my small WinMain application does not have (or need) a TForm. Is
there
> some way to implement this without having to create a form that I
don't use?

If you have enabled the VCL for your project, then you can use the
AllocateHWnd() function instead of calling CreateWindow/Ex().  The
callback method for AllocateHWnd() has to be a member of a class, and
you still need to implement your own message queue to receive the
messages.


Gambit
Technical Details
Message-ID: <45d0cf87$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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: <45d0cc1f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ece89f4506d844ba
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: <45d0cc1f@newsgroups.borland.com>
Subject: Re: Getting Message with WinMain
Date: Mon, 12 Feb 2007 12:34:51 -0800
Lines: 35
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: 75.83.34.171
Message-ID: <45d0cf87$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1171312519 75.83.34.171 (12 Feb 2007 12:35:19 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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