I'm trying to grey out the Restore menu item on a from's menu. I thought i should be able to do it something like this, but it's not working....
but it doesnt work. hMenu (and consequently hSubMenu and hID ) all return 0.Code:Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long Const MF_GRAYED = &H1 Dim hMenu As Long Dim hID As Long Dim hSubMenu As Long hMenu = GetMenu(Current.hWnd) hSubMenu = GetSubMenu(hMenu, 0) hID = GetMenuItemID(hMenu, 0) ModifyMenu hMenu, hID, MF_GRAYED, hSubMenu, "Restore"
Can someone tell me where i am going wrong?




Reply With Quote