zoukankan      html  css  js  c++  java
  • 使用API动态添加删除菜单项

    使用API动态添加删除菜单项

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls;

    type
    TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
    private
        { Private declarations }
        hMenu,hPopMenu1,hPopMenu2:HMENU;
    public
        { Public declarations }

    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    hMenu:=CreateMenu();
    hPopMenu1:=CreateMenu();
    hPopMenu2:=CreateMenu();
    AppendMenu(hPopMenu1,MF_STRING,40001,'New');
    AppendMenu(hPopMenu1,MF_STRING,40002,'Open');
    AppendMenu(hPopMenu2,MF_STRING,40005,'About');
    AppendMenu(hPopMenu1,MF_POPUP, hPopMenu2, 'Help');
    AppendMenu(hMenu,MF_POPUP,hPopMenu1,'&File');
    SetMenu(self.Handle,hMenu);
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    DeleteMenu(hPopMenu1,2,MF_BYPOSITION);
    end;

    end.

  • 相关阅读:
    转载:Cgroups 与 Systemd
    转载:linux cgroups 简介
    深入剖析Linux IO原理
    Tomcat zabbix监控、jmx监控、zabbix_java_gateway
    Tomcat 打开jmx
    vsftp、ftps 搭建
    Tomcat 调优
    Tomcat 部署及配置
    SVN 搭建
    Nginx 编译安装
  • 原文地址:https://www.cnblogs.com/webcyz/p/2767875.html
Copyright © 2011-2022 走看看