🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: System Menu

#17458
From: Remy Lebeau (TeamB)
Date: Tue, 25 Mar 2003 05:52
33 lines
2263 bytes
After playing with it a bit, it would appear that when allowing the system
menu in behavior in its native manner, it sends WM_SYSCOMMAND commands to
the form, but when using TrackPopupMenu() it sends WM_COMMAND messages
instead.  That difference is confusing the VCL as to what to do with them,
since those two messages have different implementations.

To make it work correctly, you have to take the return value of
TrackPopupMenu() (which you're already specifying the TPM_RETURNCMD flag
for, you're just not using the actual return value) and then manually send
WM_SYSCOMMAND to the form, ie:

    HMENU hMenu = GetSystemMenu(Form1->Handle, FALSE);
    int nCmd = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,
Form1->Left+10, Form1->Top+10, 0, Form1->Handle, NULL);
    if( nCmd )
    {
        TMessage Message;
        Message.Msg = WM_SYSCOMMAND;
        Message.WParam = nCmd;
        Message.LParam = 0;
        Form1->WndProc(Message);
    }


Gambit

"RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
news:3e7fdee7@newsgroups.borland.com...

> The System Menu can be display on my Form.
> But when I click "Exit"....It will not close my
> Form(Exit Application).
<snip>
Technical Details
Message-ID: <3e7fec3b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e7fbdfa@newsgroups.borland.com> <3e7fc449@newsgroups.borland.com> <3e7fc5d6@newsgroups.borland.com> <3e7fce0e$1@newsgroups.borland.com> <3e7fdee7@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,ef942edb0660a72e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-24 21:47:25 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e7fbdfa@newsgroups.borland.com> <3e7fc449@newsgroups.borland.com> <3e7fc5d6@newsgroups.borland.com> <3e7fce0e$1@newsgroups.borland.com> <3e7fdee7@newsgroups.borland.com>
Subject: Re: System Menu
Date: Mon, 24 Mar 2003 21:52:07 -0800
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e7fec3b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048570939 207.175.226.26 (24 Mar 2003 21:42:19 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail