hi all ,
Anybody knows how
to remove the quit menu item of the Doc menu of an
application?
I 've tried the code which is
provided in tn2062 as following ,
-
(void)applicationDidFinishLaunching:(NSNotification
*)aNotification
{
OSStatus error;
//Completely
remove the Quit menu item
MenuItemIndex
outIndex;
MenuRef
applicationMenu;
MenuRef
baseMenu;
baseMenu =
GetApplicationDockTileMenu ();
error =
GetIndMenuItemWithCommandID(
NULL, kHICommandQuit,
1,
&applicationMenu, &outIndex);
DeleteMenuItem(applicationMenu,
outIndex);
error =
GetIndMenuItemWithCommandID(
NULL, kHICommandHide,
1,
&applicationMenu, &outIndex);
SetItemCmd(applicationMenu, outIndex,0);
}
But it doesn't work,
GetIndMenuItemWithCommandID return -5622, which means the menu is not
there.
Thank you very
much.
Jacky
zhu