Hi David,
I finalized the routine. This routine is called when the dialog is created
from a hotkey or startup. The Object passed in is the menu created for the
dialog and you have to find which sub menu, like edit or view menus before
adding your item.
I had to add the flag for CompactMenuItem to insure the menu items are not
created time and time again when going into the dialog if the dialog was
already created once and not closed. This flag is also set false in the
callback if the dialog happens to get closed.
I noticed it has a space when not adding this flag depending on which way
you cursor through the menu if you happen to open the dialog again after
already being displayed.
The flag is needed to prevent adding items to a menu that already added
them.
I had first written it with the items in the XML file now I only add them
when I want them and leave them totally out of the XML file. Thus none gets
created if after XP.
Take Care, Bruce
Sub SetMenuItems( dObj)
'Hide Menu Items Not For XP.
If application.OSVersion.MajorVersion => 6 Then
' this is Windows Vista or later
Exit Sub
Else
On Error Resume Next
If CompactMenuItem Then
dObj.Delete( "me_reset_compact_count")
dObj.Delete( "mv_read_compact_count")
CompactMenuItem = False
Else
Speak " this is Prior To Windows Vista, So Adding Compact Check Menu Items"
dObj.GetSubMenu( "menu_edit_clip").InsertItem "Reset &Email Compact Check
Count", 0, "me_reset_compact_count", 5
dObj.GetSubMenu( "menu_view_clip").InsertItem "Read &Email Compact Check
Count", 0, "mv_read_compact_count", 3
CompactMenuItem = True
End If
End If
End Sub
Sent: Tuesday, December 03, 2013 11:11 AM
Subject: Re: Disabling a menu choice - how to?
Hi David,
Below is the way to set or reset your menu item. I am using this for
those who have XP and wish to monitor and reset the good old Email Compact
Check Count. For those who use Outlook Express and want to stop or postpone the
check for compacting.
I added a toggle for testing purposes and it works perfectly. I thought
of having it disabled but like you, it does make for reading issues and
clutters a menu.
You can choose your own position point and remember which sub menu you
are in as well in order to get the item where you want it.
Enjoy,
Bruce
Dim ToggleMenu: ToggleMenu = False
Sub SetMenuItems( dObj)
'Hide Menu Items Not For XP.
' On Error Resume Next
If ToggleMenu Then 'application.OSVersion.MajorVersion => 6 Then
Speak " this is Windows Vista or later"
dObj.Delete( "me_reset_compact_count")
dObj.Delete( "mv_read_compact_count")
ToggleMenu = Not ToggleMenu
Else
Speak " this is Prior To Windows Vista, So Enable Outlook Express Compact
Check Count"
dObj.GetSubMenu( "menu_edit_clip").InsertItem "Reset &Email Compact Check
Count", 0, "me_reset_compact_count", 5
dObj.GetSubMenu( "menu_view_clip").InsertItem "Read &Email Compact Check
Count", 0, "mv_read_compact_count", 3
ToggleMenu = Not ToggleMenu
End If
End Sub
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com