Solved

AppendMenu API call

Posted on 1998-04-07
1
363 Views
Last Modified: 2010-08-05
How do I use the AppendMenu call within Delphi?
Source code or example would be good.
I'm trying to add a menu into Outlook using API calls.
Also how would I go about finding all the menu ID's of existing menus in outlook.
0
Comment
Question by:JazC
1 Comment
 
LVL 1

Accepted Solution

by:
pjdb earned 100 total points
ID: 1361329
Drop a popupmenu on your from and anme the first item "test" then put the folowwing code in the oncreate event of the form. It will add a separator and the item test from the popupmenu.

var
  temp:array[0..20]of char;
begin
      AppendMenu(GetSystemMenu(Handle, FALSE), MF_SEPARATOR, 0, '');
      strpcopy(@temp, test.caption);
      AppendMenu(GetSystemMenu(Handle, FALSE), MF_STRING, test.Handle, @temp);
end;

to manage the event on this menu you need to add in the public declaration part of the form :
procedure onwm_syscommand (var msg: Tmessage); message wm_syscommand;

procedure Tmyformi.onwm_syscommand(var msg:Tmessage);
begin
      if msg.wparam=test.Handle then
      begin
            {your stuff}
      end;
      inherited;
end;

JDB
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

827 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