在onpopup事件中写代码进行判断。

解决方案 »

  1.   

    找了一招,用GetMenuItemRect,看下面的源程序:procedure TForm1.Timer1Timer(Sender: TObject);
    var
      rct: TRect;
    begin
      Label1.Caption := TimeToStr( Time ); // 表示我的计时器没死
      if GetMenuItemRect(0, PopupMenu1.Handle, 0, rct) then // 如果没有错(弹出状态)
        Label2.Caption := Format( 'Rect=%d, %d, %d, %d', [rct.left, rct.top, rct.right, rct.bottom] ) // 显示一下
      else
        Label2.Caption := SysErrorMessage( GetLastError ); // 否则显示错误信息
    end;