#!PECMD
SET  ::WM_LBUTTONDOWN                  =0x0201
SET  ::WM_RBUTTONDOWN                  =0x0204

//对齐： https://docs.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-trackpopupmenu
SET &TPM_RIGHTALIGN=0x0008
SET &TPM_LEFTALIGN=0x0000
SET &TPM_CENTERALIGN=0x0004
SET &TPM_BOTTOMALIGN=0x0020
SET &TPM_TOPALIGN=0x0000
SET &TPM_VCENTERALIGN=0x0010

ENVI &&I=0
DoMenu   //弹出式菜单
WIN1
_SUB WIN1,W289H249,新窗口1,
    //ENVI @WIN1.MSG=%&WM_LBUTTONDOWN%: CALL  DoMenu  //左键菜单
    //ENVI @WIN1.MSG=%&WM_RBUTTONDOWN%:.:(%&TPM_RIGHTALIGN%+%&TPM_TOPALIGN%) CALL  DoMenu   //右键菜单,左下角
    ENVI @WIN1.MSG=%&WM_RBUTTONDOWN%: CALL  DoMenu   //右键菜单
_END


_SUB DoMenu
//CALL --popmenu:10.10 MyMenu1
CALL @--popmenu       MyMenu1
_END

_SUB MyMenu1
    CALC #&I=%&I% + 1
    CALC #&&N= %&I% % 2
    MENU Menu1,分辨率1024X768 颜色32位 刷新率60,DISP W1024H768B32F60
    IFEX $ 1 = %&N%, MENU Menu3,【动态】分辨率1024X768 颜色16位 刷新率60,DISP W1024H768B16F60
    MENU -
    MENU Menu2,分辨率800X600  颜色16位 刷新率60,DISP W800H600B16F60 
_END
