Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below Method is being executed two times, first time returning -2,147,467,262 for HRESULT value and second time zero, for single Object creation, and ultimately fails to create ActiveX control object.

C++
Value of HRESULT shows hresult = 

STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
      HRESULT hres = _Module.GetClassObject(rclsid, riid, ppv);
      return hres;
}


What I have tried:

negative HRESULT value translates to 0x80004002 / E_NOINTERFACE error code with description "No such interface supported." as per MSDN.
Posted
Updated 21-Aug-17 23:29pm
v2
Comments
Jochen Arndt 11-Aug-17 8:03am    
What are the rclsid and riid values when calling that function?

Those tell you which COM interfaces (riid) are not present in the classes (rclsid).

Then check if the DLL containing the objects is present and registered.
navneet@ISM 14-Aug-17 7:10am    
DllGetClassObject function gets executed two times, rclsid remains same in both execution. Additionally:
In first execution riid = IID_IClassFactory2, ppv = 0x005be5bc, hresult = -2147467262 ;
In second execution: riid = IID_IClassFactory, ppv = 0x005bf2ec, hresult = 0
Jochen Arndt 14-Aug-17 7:57am    
So the DLL containing the objects does not support IID_IClassFactory2.
Do you really need that interface (it is only required when the object is license protected).

You have to ask the supplier of the DLL or check the documentation.
navneet@ISM 22-Aug-17 1:48am    
Tried to add this ActiveX control to a Dialog of another basic mfc application using mouse right click and "Insert ActiveX control". It gives two errors on trot as:

1. The ActiveX control cannot be instantiated.
2. "Times Control" is not a valid ActiveX control. It is missing a required interface.

What appears confusing to me is on looking at all registered Automation objects, project which was compiling into a .dll file is present as an .OCX

So it is obvious that the object creation went wrong. This happens when the GUID isnt correct or the object isnt registered. Sometimes it happens when some (supporting) dll is missing which is needed for object creation.

Check that the correct object is adresssed by the call parameters. My tip is that it isnt registered. Register at the command line with regsvr32 in admin mode!!!
 
Share this answer
 
Comments
navneet@ISM 14-Aug-17 3:00am    
I tried registering the dll and ocx at the command line with regsvr32 in admin mode. but still giving me same error. I will look at GUID as suggested. Dll doesn't look like missing from project. Thank you for these clues, appreciate that.
navneet@ISM 21-Aug-17 8:00am    
Tried to add this ActiveX control to a Dialog of another basic mfc application using mouse right click and "Insert ActiveX control". It gives two errors on trot as:

1. The ActiveX control cannot be instantiated.
2. "Times Control" is not a valid ActiveX control. It is missing a required interface.
An ActiveX control that has persistent state, which was the case with this control, must implement either IPersistStream or IPersistStreamInit. Adding a line "COM_INTERFACE_ENTRY(IPersistStreamInit)", under

"BEGIN_COM_MAP(MyControl)-------- END_COM_MAP()"

solved the issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900