I have an application which embeds a button control via ActiveX. The button was provided by a third party, and it implements a whole range of ActiveX interfaces (among which is IOleInPlaceObject). I do have an reference to the IUnknown implementation of the button.
The problem I'm facing is that the IOleWindow::GetWindow function provided by the object always returns an error; the error code is 0x80004005 which is apparently a common HRESULT value meaning E_FAIL. Not too descriptive.
For what it's worth, the object also exposes a hWnd property via it's IDispatch implementation; querying it succeeds, but the value of the property is always zero.
A bit of googling suggested that I may need to 'activate' the OLE object before the hWnd property yields a useful value. Does anybody know how to do this, is there a dedicated COM interface for activating OLE objects?
Interestingly, the button does seem to have a window handle, as is visible in Spy++.
UPDATE: I just found IQuickActivate which is implemented by the button control I'm dealing with, and which can be used to 'quickly' (ahem...) activate an item. However, filling the QACONTAINER structure seems to be quite a pain, so I'll rather not do that right now.