Hi
Are you wanting to get the information for a
popup/dropdown menu on a button on the speedbar and not the main form menu? In
that case you may need to use OBJID_CLIENT and not OBJID_MENU. I have not done
this but was interested and found the following on the microsoft web
site.
The GetMenuBarInfo function retrieves information about the specified menu bar.
Syntax
BOOL GetMenuBarInfo(
HWND hwnd, LONG idObject, LONG idItem, PMENUBARINFO 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
- The popup menu associated with the window.
- OBJID_MENU
- The menu bar associated with the window (see the GetMenu function).
- OBJID_SYSMENU
- The system menu associated with the window (see the GetSystemMenu function).
- idItem
- [in] Specifies the item for which to retrieve information. If this parameter is zero, the function retrieves information about the menu itself. If this parameter is 1, the function retrieves information about the first item on the menu, and so on.
- pmbi
- [out] Pointer to a MENUBARINFO structure that receives the information. Note that you must set MENUBARINFO.cbSize to sizeof(MENUBARINFO) before calling this function.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
-----Original Message-----
From: Vaughan, Benjamin Carl [mailto:[EMAIL PROTECTED]]
Sent: Monday, 25 August 2003 02:43 p.m.
To: Multiple recipients of list delphi
Subject: RE: Re: [DUG]: GetMenuBarInfo
Hi Dennis,
I was not using the Menu's Handle (in that case I would have got Error
1400, "Invalid Handle".
I had tried the form as well, as the toolbars handle, both returned the
same error.
Regards
Ben
-----Original Message-----
From: Dennis Chuah [mailto:[EMAIL PROTECTED]]
Sent: Monday, 25 August 2003 2:08 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: GetMenuBarInfo
Pass the form's handle, not the menu bar's.
----- Original Message -----
From: "Vaughan, Benjamin Carl" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 1:11 PM
Subject: [DUG]: GetMenuBarInfo
Hi,
I am currently attempting to get the size of a Menu using the windows
API method GetMenuBarInfo.
My code is as follows
var
menuInfo: tagMENUBARINFO;
res : longbool;
begin
//tbMenu is the TToolbar that TMainMenu is hooked up to
res := GetMenuBarInfo(tbMenu.Handle,OBJID_MENU,0,menuInfo)
end;
The method is failing and GetLastError is only giving me the extremely
useful message of "The parameter is incorrect." ,
ERROR_INVALID_PARAMETER.
Does anybody have any idea what would be wrong with this piece of code,
or has anyone used this method before?
Regards
Ben
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal - For more information please visit www.marshalsoftware.com
