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: 10
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 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.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.224.197.86)
13 sec.Function: 'CryptGenRandom'
Function group: 'Cryptography Reference'
29 sec.
Function group: 'Power Management'
44 sec.Function: 'RegSetValueEx'
57 sec.Function: 'SetProcessPreferredUILanguages'
1.2 min.Function: 'SwitchToThisWindow'
1.45 min.Function: 'mixerGetNumDevs'
1.68 min.Function: 'InternetConnect'
1.93 min.Function: 'GetObjectType'
2.17 min.Function: 'HttpSendRequest'
2.43 min.Function: 'GetTempPath'
Google
Advertise here!