[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

AppendMenu API call

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
JazC
Asked:
JazC
1 Solution
 
pjdbCommented:
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

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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now