1先配置RC中的IDS值:
IDS_AUTHOR ....
IDS_NAME ....
2定义变量
注意其中的pstrAuthor和bstrName分别是用char*和BSTR定义的
typedef struct COMPONENT_INFO
{
[string] char* pstrAuthor;
short sMajor;
short sMinor;
BSTR bstrName;
}COMPONENT_INFO;
3加载IDS
采用了LoadString加载IDS值
char szBuffer[128] = {0};
if( LoadString( _Module.GetResourceInstance(), IDS_AUTHOR, szBuffer, sizeof(szBuffer)))
{
(*ppInfo)->pstrAuthor = (unsigned char*)CoTaskMemAlloc(lstrlen( szBuffer ) + 1);
memcpy((*ppInfo)->pstrAuthor, szBuffer, lstrlen(szBuffer) + 1);
}
if( LoadString( _Module.GetResourceInstance(), IDS_NAME, szBuffer, sizeof(szBuffer)))
{
USES_CONVERSION;
(*ppInfo)->bstrName = SysAllocString( A2W(szBuffer));
}