Using Win32 functions in Visual FoxPro Image Gallery
Menu
..msdn
AppendMenu
CreateMenu
CreatePopupMenu
DeleteMenu
DestroyMenu
DrawMenuBar
GetMenu
GetMenuBarInfo
GetMenuItemCount
GetMenuItemID
GetMenuItemInfo
GetMenuString
GetSubMenu
GetSystemMenu
InsertMenuItem
IsMenu
SetMenu
TrackPopupMenuEx
Code examples:
GetMenuBarInfo
..msdn    Add comment     W32 Constants      Translate this page
Retrieves information about the specified menu bar.
Code examples:
Declaration:
 
BOOL GetMenuBarInfo(
    HWND hwnd,
    LONG idObject,
    LONG idItem,
    PMENUBARINFO pmbi
);
 
FoxPro declaration:
 
DECLARE INTEGER GetMenuBarInfo IN user32;
    INTEGER hWindow,;
    LONG idObject,;
    LONG idItem,;
    INTEGER pmbi
 
Parameters:
hwnd
[in] Handle to the window (menu bar) whose information is to be retrieved.

idObject
[in] Specifies the menu object. This parameter can be one of the following values: OBJID_CLIENT, OBJID_MENU, OBJID_SYSMENU.

idItem
[in] Specifies the item for which to retrieve information.

pmbi
[out] Pointer to a MENUBARINFO structure that receives the information.
Return value:
If the function succeeds, the return value is nonzero.
Usage:
 
* The definitions for PChar class and buf2dword() 
* functions can be found in other code samples on this webpage
 
DEFINE CLASS Tform As Form
PROTECTED hWindow
    hWindow=0
    ShowWindow=2
    Autocenter=.T.
    Caption="Calling GetMenuBarInfo"
 
PROCEDURE Activate
    IF THIS.hWindow = 0
        THIS.hWindow = THIS.HWnd
 
        LOCAL cBuffer, oMBInfo As PChar, nResult
 
        cBuffer = PADR(num2dword(MENUBARINFO_SIZE),;
            MENUBARINFO_SIZE, CHR(0))
 
        oMBInfo = CREATEOBJECT("PChar", m.cBuffer)
 
        nResult = GetMenuBarInfo(THIS.hWindow,;
            OBJID_SYSMENU, 0, oMBInfo.hMem)
 
        IF nResult = 0
            = MESSAGEBOX("GetMenuBarInfo failed: " +;
            TRANSFORM(GetLastError()))
        ELSE
        * parse MENUBARINFO structure
            cBuffer = oMBInfo.GetValue()
            ACTIVATE SCREEN
            ? "Rectangle:",;
                buf2dword(SUBSTR(cBuffer,5,4)),;
                buf2dword(SUBSTR(cBuffer,9,4)),;
                buf2dword(SUBSTR(cBuffer,13,4)),;
                buf2dword(SUBSTR(cBuffer,17,4))
 
            ? "hMenu:",;
                buf2dword(SUBSTR(cBuffer,21,4))
 
            ? "hwndMenu:",;
                buf2dword(SUBSTR(cBuffer,25,4))
        ENDIF
    ENDIF
 
PROCEDURE Destroy
    CLEAR EVENTS
 
ENDDEFINE
 
My comment:
Note that you must set MENUBARINFO.cbSize to sizeof(MENUBARINFO) before calling this function.

See also: GetMenuItemInfo, GetSystemMenu.
Word Index links for the GetMenuBarInfo :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2007-01-08 15:57:33
Modified: 2007-06-11 16:37:02
Visited in last 7 days: 19
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.234.42.16)
3 sec.Example: 'How to find which fonts Windows uses for drawing captions, menus and message boxes'
8 sec.Example: 'Copying picture of the active form to the Clipboard using Enhanced Metafile API functions'
2.16 hrs.Example: 'URL: splitting into its component parts'
 Function: 'CeRapiInvoke'
6.1 hrs.Example: 'Printing text on the main VFP window'
6.41 hrs.Function: 'capCreateCaptureWindow'
6.42 hrs.Example: 'Enumerating network interfaces on the local computer'
6.91 hrs.Function: 'JetSetColumn'
Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
 Example: 'Using FlashWindowEx to flash the taskbar button of the VFP application'
Language: 'C#'
10.19 hrs.Function: 'SQLTables'
Google
Advertise here!