CComBSTR::LoadString

此对象加载 nID 指定的字符串资源并将其存储。

bool LoadString( 
   HINSTANCE hInst, 
   UINT nID  
) throw(); 
bool LoadString( 
   UINT nID  
) throw();

参数

在参见 Windows SDK的 LoadString

返回值

如果该字符串成功加载,则返回; true 否则,返回 false

备注

第一个函数从您确定的模块加载该资源通过 hInst 参数。 第二个函数从资源模块与 CComModule-用于此项目的派生对象加载该资源。

示例

CComBSTR bstrTemp;

// IDS_PROJNAME proj name stored as resource in string table
bstrTemp.LoadString(IDS_PROJNAME);

// the above is equivalent to: 
// bstrTemp.LoadString(_Module.m_hInstResource, IDS_PROJNAME); 

// display message box w/ proj name as title & text
::MessageBox(NULL, CW2CT(bstrTemp), CW2CT(bstrTemp), MB_OK);   

要求

Header: atlbase.h

请参见

参考

CComBSTR 类

其他资源

ATL and MFC String Conversion Macros