TEAM ENVI^ ENVIMODE=1| ENVI^ FORCELOCAL=1
WIN1

_SUB WIN1,W287H254,禁止窗口关闭测试,
    ITEM ITEM1,L111T62W60H30,禁止关闭, EnableClose 0,
    ITEM ITEM2,L111T129W60H30,允许关闭,EnableClose 1,
_END

// EnableClose 0/1  [hWinID]
_SUB EnableClose
    IFEX #%~2>0, SET &__WinID=%~2
    SET &SC_CLOSE=0xF060
    SET &MF_GRAYED=0x00000001
    SET &MF_BYCOMMAND=0x00000000
    IFEX #%1>0, SET &En=%MF_BYCOMMAND%!  CALC #&&En=%MF_GRAYED% | %MF_BYCOMMAND%
    CALL $--ret:&&hmenu user32.dll,GetSystemMenu,#%__WinID%,#0
    CALL $user32.dll,EnableMenuItem,#%hmenu%,#%SC_CLOSE%,#%En%%
_END
