CString::LoadString BOOL LoadString( UINT nID ); throw( CMemoryException );Return ValueNonzero if resource load was successful; otherwise 0.ParametersnIDA Windows string resource ID.ResReads a Windows string resource, identified by nID, into an existing CString object. ExampleThe following example demonstrates the use of CString::LoadString.// example for CString::LoadString #define IDS_FILENOTFOUND 1 CString s; if (! s.LoadString( IDS_FILENOTFOUND )) { AfxMessageBox("Error Loading String: IDS_FILENOTFOUND"); ... }CString Overview | Class Members | Hierarchy Chart LoadString的参数是一个字符串的ID值,是一个整形,不是字符型,当然编译出错拉。
BOOL LoadString( UINT nID );
throw( CMemoryException );Return ValueNonzero if resource load was successful; otherwise 0.ParametersnIDA Windows string resource ID.ResReads a Windows string resource, identified by nID, into an existing CString object. ExampleThe following example demonstrates the use of CString::LoadString.// example for CString::LoadString
#define IDS_FILENOTFOUND 1
CString s;
if (! s.LoadString( IDS_FILENOTFOUND ))
{
AfxMessageBox("Error Loading String: IDS_FILENOTFOUND");
...
}CString Overview | Class Members | Hierarchy Chart
LoadString的参数是一个字符串的ID值,是一个整形,不是字符型,当然编译出错拉。
BSTR bstr;
if (! s.LoadString( IDS_FILENOTFOUND ))
{
AfxMessageBox("Error Loading String: IDS_FILENOTFOUND");
...
}
bstr = str.AllocSysString();