Microsoft KB Archive/252297: Difference between revisions
m (Text replacement - "<" to "<") |
m (Text replacement - """ to """) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 73: | Line 73: | ||
=== Steps to Reproduce Behavior === | === Steps to Reproduce Behavior === | ||
If you have code similar to the following in your component, you receive the error described in the | If you have code similar to the following in your component, you receive the error described in the "Symptoms" section. | ||
<pre class="codesample"> HRESULT hr; | <pre class="codesample"> HRESULT hr; | ||
CAUUID pages; | CAUUID pages; | ||
CComPtr<IPropertyPage | CComPtr<IPropertyPage> pPropertyPage; | ||
CComPtr<ISpecifyPropertyPages | CComPtr<ISpecifyPropertyPages> pStockPage; | ||
hr = this- | hr = this->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pStockPage); | ||
if (SUCCEEDED(hr)) | if (SUCCEEDED(hr)) | ||
hr = pStockPage- | hr = pStockPage->GetPages(&pages); | ||
if (SUCCEEDED(hr)) | if (SUCCEEDED(hr)) | ||
hr = ::CoCreateInstance(pages.pElems[0], NULL, CLSCTX_ALL , IID_IPropertyPage, (void **)& | hr = ::CoCreateInstance(pages.pElems[0], NULL, CLSCTX_ALL , IID_IPropertyPage, (void **)&pPropertyPage); | ||
if (SUCCEEDED(hr)) | if (SUCCEEDED(hr)) | ||
{ | { | ||
PROPPAGEINFO pageInfo; | PROPPAGEINFO pageInfo; | ||
memset(& | memset(&pageInfo, 0, sizeof(PROPPAGEINFO)); | ||
pageInfo.cb = sizeof(PROPPAGEINFO); | pageInfo.cb = sizeof(PROPPAGEINFO); | ||
// Will give unhandled exception here.... | // Will give unhandled exception here.... | ||
hr = pPropertyPage- | hr = pPropertyPage->GetPageInfo(&pageInfo); | ||
if (SUCCEEDED(hr)) | if (SUCCEEDED(hr)) | ||
{ | { |
Latest revision as of 13:52, 21 July 2020
Article ID: 252297
Article Last Modified on 12/11/2003
APPLIES TO
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++ 6.0 Standard Edition
This article was previously published under Q252297
SYMPTOMS
If you call IPropertyPage::GetPageInfo on any of the stock property pages (CLSID_StockColorPage, CLSID_StockFontPage, or CLSID_StockPicturePage) exported from MsStkPrp.dll, you may receive an unhandled exception.
RESOLUTION
Work around this problem by setting the property page site; call IPropertyPage::SetPageSite, and pass a pointer to an implementation of IPropertyPageSite immediately after using the CoCreate function of the property page object or anytime before you call GetPageInfo.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
You may encounter this problem if you are developing your own custom property frames and fail to site the property page object properly.
Steps to Reproduce Behavior
If you have code similar to the following in your component, you receive the error described in the "Symptoms" section.
HRESULT hr; CAUUID pages; CComPtr<IPropertyPage> pPropertyPage; CComPtr<ISpecifyPropertyPages> pStockPage; hr = this->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pStockPage); if (SUCCEEDED(hr)) hr = pStockPage->GetPages(&pages); if (SUCCEEDED(hr)) hr = ::CoCreateInstance(pages.pElems[0], NULL, CLSCTX_ALL , IID_IPropertyPage, (void **)&pPropertyPage); if (SUCCEEDED(hr)) { PROPPAGEINFO pageInfo; memset(&pageInfo, 0, sizeof(PROPPAGEINFO)); pageInfo.cb = sizeof(PROPPAGEINFO); // Will give unhandled exception here.... hr = pPropertyPage->GetPageInfo(&pageInfo); if (SUCCEEDED(hr)) { // Do something. } }
REFERENCES
- OleCreatePropertyFrame
- OleCreatePropertyFrameIndirect
- IPropertyPage
- IPropertyPageSite
- ISpecifyPropertyPages
- IPerPropertyBrowsing
Additional query words: custom OleCreatePropertyFrame OleCreatePropertyFrameIndirect IPerPropertyBrowsing
Keywords: kbbug kbpropsheet kbarchitecture kbpending KB252297