Microsoft KB Archive/216278

= BUG: "Unspecified error" When Running VB Program That Hosts an ATL Control =

Article ID: 216278

Article Last Modified on 12/2/2003

-

APPLIES TO


 * Microsoft ActiveX Template Library 3.0, when used with:
 * Microsoft Visual C++ 6.0 Service Pack 5
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q216278



SYMPTOMS
When you run a Visual Basic program that contains an ATL ActiveX control, you may get the following error message:

System Error &H80004005 (-2147467259). Unspecified error.



CAUSE
If you created the control using the ATL Object Wizard and added the "HWND" option in the Stock Properties tab, you will get an entry in the .IDL for a [propget] function for the "Window" stock property.

In addition, the property map will contain a PROP_ENTRY(HWND...) macro. When the control is first initialized, the persistence code will go through the property map and call the [propput] functions for each entry via ITypeInfo::Invoke. Because there is no [propput] function in the .IDL for the Window property, the type library won't have this function, and ITypeInfo::Invoke will fail.



RESOLUTION
Persisting an HWND doesn't make sense; just comment out the PROP_ENTRY(HWND...) macro in the property map. To prevent this line from being added in the future, remove the following line from Control.h in \Program Files\Microsoft Visual Studio\Common\MSDev98\Template\ATL:

[!if=(SP_HWND, "TRUE")] PROP_ENTRY("HWND", DISPID_HWND, CLSID_NULL)[!endif]



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Keywords: kbbug kbcontainer kbpersistst kbctrlcreate kbctrl kbpending KB216278

-

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

© Microsoft Corporation. All rights reserved.