//rc 文件:
MyMenu1 MENU
begin
Popup "File"
begin
MenuItem "&Open"
MenuItem "&Save"
MenuItem Separator
MenuItem "E&xit"
end
end
{严格的头可能是这样写: MyMenu1 MENU PRELOAD DISCARDABLE}
//程序代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
hm: HMENU;
begin
hm := LoadMenu(HInstance, 'MyMenu1');
SetMenu(Handle, hm);
end;
end.
//效果图: