Microsoft KB Archive/310566

= PRB: You Receive an Unknown Error When You Call a Method of the MFC ActiveX Control =

Article ID: 310566

Article Last Modified on 7/27/2004

-

APPLIES TO


 * Microsoft Windows CE 2.11 for the Handheld PC
 * Microsoft Windows CE 2.0 for the Handheld PC
 * Microsoft Windows CE Palm-size PC 2.01 software

-



This article was previously published under Q310566



SYMPTOMS
When you attempt to call a method of the MFC ActiveX Control, and the control is hosted in Microsoft Internet Explorer, Pocket Internet Explorer reports an unknown error on the line that calls the method.



CAUSE
This behavior can occur if the IPersistPropertyBag::InitNew method is not called and the control is not initialized properly.



RESOLUTION
To resolve this issue, add a Boolean variable to the control class, and then initialize it to TRUE. Use the MFC ClassWizard to override the OnSetClientSite method. Replace the code inside OnSetClientSite with the following: if(m_fInitPersist) {   IPersistPropertyBag* pPersistPropBag = NULL; HRESULT hr = InternalQueryInterface(&IID_IPersistPropertyBag, (void**)&pPersistPropBag); if(SUCCEEDED(hr) && pPersistPropBag) pPersistPropBag->InitNew; m_fInitPersist = FALSE; } COleControl::OnSetClientSite;

Additional query words: IPersistPropertyBag OnSetClientSite

Keywords: kbprb KB310566

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.