Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

window menu - add or delete menu item

Posted on 2003-11-21
1
Medium Priority
?
537 Views
Last Modified: 2010-04-16
How can I add, delete or disable menu items in the window menu?
0
Comment
Question by:qweqwe
1 Comment
 
LVL 3

Accepted Solution

by:
raidos earned 500 total points
ID: 9797799
Var
  hSysMenu : hMenu;
  NCT: Integer;
Begin
    hSysmenu := GetSystemmenu(HandleOfYourWindow,False);
    Nct := Getmenuitemcount(hSysmenu);
    Deletemenu(hSysmenu,NCT-1,MF_BYPosition);
    //Plockar bort Separatorn på fönstret
    Deletemenu(hSysmenu,NCT-2,MF_BYPosition);
    //Redraw the Menu
    Drawmenubar(HandleOfYourWindowAgain);
End;

That's for removing items the last 2 items in the menu...

Enabling and disabling is similar to Deleting...
just replace Deletemenu with
  EnableMenuItem(hSysMenu, NCT-1, MF_BYPOSITION OR MF_DISABLED);
Or
  EnableMenuItem(hSysMenu, NCT-1, MF_BYPOSITION OR MF_ENABLED);
 
There are other Constants than MF_BYPOSITION in play aswell but check out the MSHelp for EnableMenu item and you'll get the full picture..

Adding items is no breeze...you will need to hook some WM_Message targeted for the window..
Haven't done that before so i don't really know how to do it...i've investigated some but my memory is clouded.. ;P

Regards
//raidos

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question