ok first off, it is possible (how reliable the technique is i dont know, this code was thrown together very quickly and has not been tested fully (but should provide the ground work))
you will need to get the handle for the solitaire window (i used winspy and just bodged it in) for this code to run
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
'Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_GRAYED = &H1&
Private Const MF_ENABLED = &H0&
Dim myhwnd As Long
Dim myhMenu As Long
'Dim myMenuCount As Integer
Dim myhSubMenu As Long
Private Sub Command1_Click()
'disables exit menu of solitaire
'quick bodge using winspy
myhwnd = 1115426
myhMenu = GetMenu(myhwnd)
myhSubMenu = GetSubMenu(myhMenu, 0)
' myMenuCount = GetMenuItemCount(myhSubMenu)
stuff = EnableMenuItem(myhSubMenu, 6, MF_BYPOSITION + MF_GRAYED)
End Sub
Private Sub Command2_Click()
'enables exit menu of solitaire
'quick bodge using winspy
myhwnd = 1115426
myhMenu = GetMenu(myhwnd)
myhSubMenu = GetSubMenu(myhMenu, 0)
' myMenuCount = GetMenuItemCount(myhSubMenu)
stuff = EnableMenuItem(myhSubMenu, 6, MF_BYPOSITION + MF_ENABLED)
End Sub
hope this gets you started... ill try and throw a nicer bit of code together tomorrow... (unless someones got some ready written stuff!
good luck!
If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
come on... get involved!
To get the best response to a question, please check out FAQ222-2244 first
A General Guide To Excel in VB FAQ222-3383