User32GetMenuString(SafeHandle, UInt32, StringBuilder, Int32, MenuPosition) Method

Copies the text string of the specified menu item into the specified buffer.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true)]
public static int GetMenuString(
	SafeHandle hMenu,
	uint uIDItem,
	StringBuilder lpString,
	int nMaxCount,
	MenuPosition uFlags
)

Parameters

hMenu  SafeHandle
A handle to the menu.
uIDItem  UInt32
The menu item to be changed, as determined by the uFlags parameter.
lpString  StringBuilder
The buffer that receives the null-terminated string.

If the string is as long or longer than lpString, the string is truncated and the terminating null character is added.

If lpString is , the function returns the length of the menu string.

nMaxCount  Int32
The maximum length, in characters, of the string to be copied.

If the string is longer than the maximum specified in the nMaxCount parameter, the extra characters are truncated.

If nMaxCount is 0, the function returns the length of the menu string.

uFlags  MenuPosition
Indicates how the uIDItem parameter is interpreted.

Return Value

Int32
If the function succeeds, the return value specifies the number of characters copied to the buffer, not including the terminating null character.

If the function fails, the return value is zero.

If the specified item is not of type MIIM_STRING or MFT_STRING, then the return value is zero.

Remarks

See Also