BUG: CComBSTR::LoadString May Give an Access Violation without ATL Support (251344)
The information in this article applies to:
- The Microsoft Active Template Library (ATL) 3.0, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
This article was previously published under Q251344 SYMPTOMS
If you have used the CComBSTR class in a non-ATL application and used the bool CComBSTR::LoadString(UINT nID) function, it might give an access violation.
CAUSE
The global _pModule variable representing an instance of CComModule expected by ATL, is not declared and initialized.
RESOLUTION
Use the other overloaded version of LoadString that takes HINSTANCE as a parameter
bool CComBSTR::LoadString(HINSTANCE hInst, UINT nID)
and pass the HINSTANCE of the current module or the module wherever the string resource is defined.
Or, add ATL support to this project. In order to add ATL support, from the Insert menu, click New ATL Object. You are then asked if you want to add ATL support to this project; click Yes. As a result, the ATL Object Wizard is opened. Cancel that option if you do not want to add an ATL object to your project.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | kbArchitecture kbbug kbpending kbString KB251344 |
---|
|