CComBSTR::LoadString

Loads a string resource specified by nID and stores it in this object.

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

Parameters

See LoadString in the Windows SDK.

Return Value

Returns true if the string is successfully loaded; otherwise, returns false.

Remarks

The first function loads the resource from the module identified by you via the hInst parameter. The second function loads the resource from the resource module associated with the CComModule-derived object used in this project.

Example

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);   

Requirements

Header: atlbase.h

See Also

Reference

CComBSTR Class

Other Resources

ATL and MFC String Conversion Macros