vc++之loadstring

LoadString

 

  从 资源 里加载字符串资源到CString对象里。   函数 LoadString声明如下:   WINUSERAPI   int   WINAPI   LoadStringA(   __in_opt HINSTANCE hInstance,   __in UINT uID,   __out_ecount(cchBufferMax) LPSTR lpBuffer,   __in int cchBufferMax);    hInstance是应用程序实例句柄。    uID是资源中的字符串编号。    lpBuffer是接收从资源里拷贝字符串出来的缓冲区。    cchBufferMax是指明缓冲的大小。   参数   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 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.   说明   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.   系统要求   Minimum DLL Version: user32.dll   Header: Declared in Winuser.h, include Windows.h   Import library: User32.lib   Minimum operating systems: Windows 95, Windows NT 3.1   Unicode: Implemented as ANSI and Unicode versions.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值