CString的两种LoadString

来源:互联网 发布:linux 路由表怎么看 编辑:程序博客网 时间:2024/05/16 12:12

CString aa;

1.bool aaa = aa.LoadString(IDS_STATUS_DATA);

如果不能成功的话,就试一下:

2.bool aaa = aa.LoadString(NULL,IDS_STATUS_DATA);

其它的还有:

3.LoadString(NULL,IDS_STATUS_NAME,aa.GetBuffer(10),10);

aa.ReleaseBuffer();

至于1与2的区别还不清楚。


这是什么意思,不懂:

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

好像发现一个区别了,在没有动态加载其它资源文件的时候,用第二种能够成功,但是动态加载资源文件的时候,如果用第二种,则不会得到加载的资源文件中的字符串,而是默认资源。