🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages Started by RaynorPao Tue, 25 Mar 2003 02:41
System Menu
#17450
Author: RaynorPao
Date: Tue, 25 Mar 2003 02:41
7 lines
961 bytes
Hi all:

How can I show the system menu?
(Reverse, Move, Size, Maximum, Minimum, Exit)

Thanks.
RaynorPao.
Re: System Menu
#17451
Author: Remy Lebeau (TeamB)
Date: Tue, 25 Mar 2003 02:57
12 lines
1264 bytes
Show in what way exactly?  Do you just want it to exist in the titlebar, or
do you want to actually drop it down for the user to look at?  Please be
more specific.


Gambit

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

> How can I show the system menu?
> (Reverse, Move, Size, Maximum, Minimum, Exit)
Re: System Menu
#17452
Author: RaynorPao
Date: Tue, 25 Mar 2003 03:15
18 lines
1392 bytes
Hi Remy:

Thanks for your reply.
I just want to show the system menu like a PopupMenu on Form.
Is it possible?

Thanks.
RaynorPao.

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> ���g��l��
news:3e7fc449@newsgroups.borland.com...
> Show in what way exactly?  Do you just want it to exist in the titlebar,
or
> do you want to actually drop it down for the user to look at?  Please be
> more specific.
>
>
> Gambit
Re: System Menu
#17455
Author: Remy Lebeau (TeamB)
Date: Tue, 25 Mar 2003 03:43
9 lines
1220 bytes
Perhaps have a look at GetSystemMenu() and TrackPopupMenu().


Gambit

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

> I just want to show the system menu like a PopupMenu on Form.
Re: System Menu
#17457
Author: RaynorPao
Date: Tue, 25 Mar 2003 05:01
28 lines
1799 bytes
Hi Remy:

The System Menu can be display on my Form.
But when I click "Exit"....It will not close my Form(Exit Application).
My code is as below:

   HMENU hMenu=GetSystemMenu(Form1->Handle, FALSE);
   TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,
      Form1->Left+10, Form1->Top+10, 0, Form1->Handle, NULL);

How can I solve this problem?

Thanks.
RaynorPao.

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> ���g��l��
news:3e7fce0e$1@newsgroups.borland.com...
> Perhaps have a look at GetSystemMenu() and TrackPopupMenu().
>
>
> Gambit
>
> "RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
> news:3e7fc5d6@newsgroups.borland.com...
>
> > I just want to show the system menu like a PopupMenu on Form.
>
>
Re: System Menu
#17458
Author: 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>
Re: System Menu
#17459
Author: RaynorPao
Date: Tue, 25 Mar 2003 06:34
46 lines
2661 bytes
Hi Remy:

Thanks for your reply.
The problem is solved perfectly.

Thank you very much....^_^
RaynorPao.

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> ���g��l��
news:3e7fec3b@newsgroups.borland.com...
> 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>
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads