1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| procedure TForm1.FormCreate(Sender: TObject);
var
SystemMenu: THandle;
ItemIndex: Cardinal;
bmp: TBitmap;
begin
SystemMenu := GetSystemMenu(Handle, False);
AppendMenu(GetSystemMenu(Handle, False), MF_SEPARATOR, 0, '');
AppendMenu(GetSystemMenu(Handle, False), MF_STRING, 0, 'Nouveau Items...');
ItemIndex := 8;
bmp:= TBitmap.Create;
bmp.Width:= ImageList1.Width;
bmp.Height:= ImageList1.Height;
ImageList1.Draw(bmp.Canvas, 0, 0, 0);
SetMenuItemBitmaps(SystemMenu, ItemIndex, MF_BYPOSITION, bmp.Handle, bmp.Handle);
// Ajouter ce bmp à la liste ou au tableau de bitmaps (nécessaire pour pouvoir
// les libérer en fin d'application)
Application.OnMessage := OnMessage;
end; |
Partager