Click to See Complete Forum and Search --> : SetMenuItemInfo does not work on Win2000


Tom Antonsen
May 3rd, 2001, 08:10 AM
Hallo,

I have maded the code below, so I can make the Close(x) button grey (MF_GRAYED) or enabled (MF_ENABLED). I works fine on Windows 95 but does not work on Windows 2000! Can you help me??


private Sub Set_close_button(byval NewStatus as Long)


Dim Success as Long
Dim hMenu as Long

Dim MII as MENUITEMINFO

hMenu = GetSystemMenu(me.hwnd, 0)

MII.cbSize = len(MII)
MII.dwTypeData = string(80, 0)
MII.cch = len(MII.dwTypeData)
MII.fState = NewStatus
MII.fMask = &H1
MII.wID = SC_CLOSE

Success = SetMenuItemInfo(hMenu, MII.wID, false, MII)
DrawMenuBar me.hwnd 'Update menu ??
SendMessage me.hwnd, WM_NCACTIVATE, true, 0 'Update menu??

End Sub