我有一个PopMenu和主菜单一抹一样,我不想使用ActionList,那么怎么能够做到最简单呢?
Kingron:
请参看如下代码:
procedure PopMainMenuItem ( hWnd : HWND ; Menu : TMenuItem );
var
R : TRect ;
begin
R := Screen . DesktopRect ;
TrackPopupMenu ( Menu . Handle , TPM_LEFTALIGN , Mouse . CursorPos . X , Mouse . CursorPos . Y , 0 , hWnd ,@ R );
end ;
procedure TForm1 . Button1Click ( Sender : TObject );
begin
PopMainMenuItem ( Handle , MainMenu1 . Items [ 0 ]);
end ;