网站首页  词典首页

请输入您要查询的函数:

 

术语 loadstring
释义 LoadString
语法:
int LoadString( HINSTANCE hInstance,
UINT uID,
LPTSTR lpBuffer,
int nBufferMax
);
LoadString函数
该LoadString函数加载一个从指定的模块关联,复制到一个缓冲区字符串,字符串资源的可执行文件,并追加终止NULL字符。
参数
hInstance
[in]句柄一个模块实例的可执行文件包含字符串资源。为了让处理应用程序本身,使用GetModuleHandle(空)。
的UID
[in]指定字符串的整数标识符被加载。
lpBuffer
[out]指向的缓冲区接收字符串。
nBufferMax
[in]指定缓冲区的大小,在TCHARs。这是指对函数或Unicode版本WCHARs ANSI版本字节。该字符串被截断,NULL结束,如果它的长度超过了指定的字符数。如果此参数为0,那么lpBuffer收到一个只读指针资源本身。
返回值
如果函数成功,返回值是复制到缓冲区TCHARs人数,不包括终止空字符,或零字符串资源,如果不存在。为了获得更多错误信息,调用GetLastError。
备注
安全警告:
使用此功能不当,可能会损害您的应用程序的安全。不正确地使用包括指定的nBufferMax参数错误的大小。例如,如果lpBuffer指向一个缓冲区szBuffer这是TCHAR szBuffer [100]宣布,那么sizeof(szBuffer)给出的字节缓冲区,这可能导致一个函数的Unicode版本缓冲区溢出的大小。缓冲区溢出的情况是,在许多应用安全问题的原因。在这种情况下,使用sizeof(szBuffer)/ sizeof(TCHAR)或sizeof(szBuffer)/ sizeof(szBuffer [0]),是给予适当大小的缓冲区。
在Windows 95/98/Me:LoadStringW是支持微软层对于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版本。
参见
Strings 概述 ,FormatMessage,LoadAccelerators,LoadBitmap,LoadCursor,LoadIcon,LoadMenu,LoadMenuIndirect
==英文原文==LoadString Function
The LoadString function loads a string resource from the executable file associated with a specified module, copies the string into a buffer, and appends a terminating NULL character.
Syntax
int LoadString( HINSTANCE hInstance,
UINT uID,
LPTSTR lpBuffer,
int nBufferMax
);
Parameters
hInstance
[in] Handle to an instance of the module whose executable file contains the string resource. To get the handle to the application itself, use GetModuleHandle (NULL).
uID
[in] Specifies the integer identifier of the string to be loaded.
lpBuffer
[out] Pointer to the buffer to receive the string.
nBufferMax
[in] Specifies the size of the buffer, in TCHARs. This refers to bytes for ANSI versions of the function or WCHARs for Unicode versions. The string is truncated and NULL terminated if it is longer than the number of characters specified. If this parameter is zero, then lpBuffer receives a read-only pointer to the resource itself.
Return Value
If the function succeeds, the return value is the number of TCHARs copied into the buffer, not including the terminating NULL character, or zero if the string resource does not exist. To get extended error information, call GetLastError .
Remarks
Security Alert
Using this function incorrectly can compromise the security of your application. Incorrect use includes specifying the wrong size in the nBufferMax parameter. For example, if lpBuffer points to a buffer szBuffer which is declared as TCHAR szBuffer[100], then sizeof(szBuffer) gives the size of the buffer in bytes, which could lead to a buffer overflow for the Unicode version of the function. Buffer overflow situations are the cause of many security problems in applications. In this case, using sizeof(szBuffer)/sizeof(TCHAR) or sizeof(szBuffer)/sizeof(szBuffer[0]) would give the proper size of the buffer.
Windows 95/98/Me: LoadStringW 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 a Child Window
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
Strings Overview , FormatMessage , LoadAccelerators , LoadBitmap , LoadCursor , LoadIcon , LoadMenu , LoadMenuIndirect
==原始网址==http://msdn.microsoft.com/en-us/library/ms647486(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:23:09