网站首页  词典首页

请输入您要查询的函数:

 

术语 getmenustring
释义 GetMenuString
语法:
int GetMenuString( HMENU hMenu,
UINT uIDItem,
LPTSTR lpString,
int nMaxCount,
UINT uFlag
);
GetMenuString功能
该GetMenuString功能复制指定菜单项的文本字符串到指定的缓冲区。
参数
hMenu
[in]句柄菜单。
uIDItem
[中]指定菜单项的改变,由uFlag参数确定。
lpString
[out]指向的缓冲区,它接收NULL结尾的字符串。如果该字符串,只要比lpString或更长的时间,该字符串被截断,终止空字符被添加。 lpString是如果NULL,则函数返回菜单的字符串的长度。
nMaxCount
[in]指定的最大长度,以字符,该字符串被复制。如果字符串长度超过最大的nMaxCount参数指定额外的字符将被截断。如果nMaxCount为0,则函数返回菜单的字符串的长度。
uFlag
[in]指定如何uIDItem参数解释。此参数必须是下列值之一。
MF_BYCOMMAND
指示uIDItem给出了菜单项的标识符。如果既不MF_BYCOMMAND或MF_BYPOSITION标志指定,MF_BYCOMMAND标志是默认的标志。
MF_BYPOSITION
指示uIDItem使从零开始的菜单项的相对位置。
返回值
如果函数成功,返回值指定了复制到缓冲区的字符数不包括终止空字符。
如果函数失败,返回值是零。
如果指定的项目类型不是MFT_STRING,则返回值为0。
Windows 98/Me和Windows 2000/XP的:MIIM_STRING取代MFT_STRING。
备注
注意GetMenuString功能已被取代。使用获取菜单项函数来检索菜单项文本。
该nMaxCount参数必须是一个比字符的文本字符串数量较大的,以适应终止NULL字符。
如果nMaxCount为0,则函数返回菜单的字符串的长度。
安全警告:
该lpString参数是一个TCHAR缓冲区,nMaxCount是在TCHARs菜单字符串的长度。浆纱这些参数不当可导致字符串的截断,导致可能的数据丢失。
在Windows 95/98/Me:GetMenuStringW是支持微软层对于Unicode。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
例如
有关示例,请参阅创建用户可编辑加速器。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
菜单,GetMenuItemID
==英文原文==GetMenuString Function
The GetMenuString function copies the text string of the specified menu item into the specified buffer.
Syntax
int GetMenuString( HMENU hMenu,
UINT uIDItem,
LPTSTR lpString,
int nMaxCount,
UINT uFlag
);
Parameters
hMenu
[in] Handle to the menu.
uIDItem
[in] Specifies the menu item to be changed, as determined by the uFlag parameter.
lpString
[out] Pointer to 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 NULL, the function returns the length of the menu string.
nMaxCount
[in] Specifies 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.
uFlag
[in] Specifies how the uIDItem parameter is interpreted. This parameter must be one of the following values.
MF_BYCOMMAND
Indicates that uIDItem gives the identifier of the menu item. If neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified, the MF_BYCOMMAND flag is the default flag.
MF_BYPOSITION
Indicates that uIDItem gives the zero-based relative position of the menu item.
Return Value
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 MFT_STRING, then the return value is zero.
Windows 98/Me and Windows 2000/XP: MIIM_STRING supersedes MFT_STRING.
Remarks
Note The GetMenuString function has been superseded. Use the GetMenuItemInfo function to retrieve the menu item text.
The nMaxCount parameter must be one larger than the number of characters in the text string to accommodate the terminating NULL character.
If nMaxCount is 0, the function returns the length of the menu string.
Security Alert
The lpString parameter is a TCHAR buffer, and nMaxCount is the length of the menu string in TCHARs. Sizing these parameters incorrectly can cause truncation of the string, leading to possible loss of data.
Windows 95/98/Me: GetMenuStringW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .
Example
For an example, see Creating User Editable Accelerators .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.
See Also
Menus , GetMenuItemID
==原始网址==http://msdn.microsoft.com/en-us/library/ms647983(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:18:44