Re: Dynamic Menu Creation & Destroying them after each session
- Posted by Greg Haberek <ghaberek at gmail.com> Nov 13, 2005
- 541 views
> Is there any way I can get the MenuItemID's of the parent MenuID? Its pretty simple. Just get the count of items, then walk through grabbing each ID. I just whipped this up in GMail, it might not work entirely:
global function getMenuItemIDs( atom MenuID ) -- MenuID is the parent menu handle integer count sequence IDs atom ID count = c_func( xGetMenuItemCount, {MenuID} ) if count = -1 then return {} end if IDs = {} for i = 0 to count-1 do -- zero-based index IDs &= c_func( xGetMenuItemID, {MenuID, i} ) end if return IDs end function
> I get mID as a number which fails in xGetMenuItemID with "type_check fail= ure, mID is 4294967295" error. That's because its too big to be an integer. You need to declare mID as an atom. Most Windows "handles" need to be atoms. > Also I am not sure about the xRemoveMenu parameters (getParentHwnd ?). BOOL RemoveMenu( HMENU hmenu,=09// handle of menu UINT uItem,=09// menu item identifier or position UINT fuFlags=09// menu item flag ); > Where can I get detailed documentation on xGet..... functions? They're Windows API functions, and they don't start with 'x', most of us use that to separate them from the actual functions used to wrap them. Download the Windows API documentation here: (link from the Archive) ftp://ftp.borland.com/pub/delphi/techpubs/delphi2/win32.zip