My implementation involves the utilization of the following JavaScript code to generate a new ActiveX object.
var playerDiv = document.createElement("div");
playerDiv.style.border = "1px solid red";
var size = 200 + 20 * index;
playerDiv.style.width = 200 + 20 * index + "px";
playerDiv.style.height = 200 + 20 * index + "px";
playerDiv.setAttribute("id", 'divPlayer' + index);
var str = '<object id="player' + index + '" classid="CLSID:69A1BC06-C88F-4849-81E7-DB0AB0628819" width="' + size + '" height="' + size + '"></object>';
playerDiv.innerHTML = str;
divViewPort.appendChild(playerDiv);
The issue arises during the innerHTML binding process where a new ActiveX object is built, but calls from the JS engine to construct the m_hWnd variable are not being received. Upon analyzing the classic code, the call stack is as follows:
> BCPlayer.dll!CSinglePlayer::CreateControlWindow(HWND__ * hWndParent, tagRECT & rcPos) Line 3207 C++
BCPlayer.dll!ATL::CComControlBase::InPlaceActivate(long iVerb, const tagRECT * __formal) Line 1037 C++
... (remaining stack trace)
The function named:
CSinglePlayer::CreateControlWindow(HWND hWndParent, RECT& rcPos)
is an override of
public CComControl<CSinglePlayer>
.
which triggers CComControl<CSinglePlayer>::CreateControlWindow(hWndParent, rcPos);
In order to simulate the desired environment and trigger the necessary functions to generate the m_hWnd, I resorted to triggering an OnClick() event. The innerHTML used on my object does not execute any of the IOleObjectImpl functions directly. To provide some context, I inherit the following interfaces/classes:
class /*ATL_NO_VTABLE*/
__declspec(uuid("{69A1BC06-C88F-4849-81E7-DB0AB0628819}"))
VPlayer :
public CComObjectRootEx<CComMultiThreadModel>
//, public ATL::CWindowImpl<VPlayer, ATL::CWindow, ATL::CFrameWinTraits>
, public IObjectSafetyImpl<VPlayer, INTERFACESAFE_FOR_UNTRUSTED_CALLER |INTERFACESAFE_FOR_UNTRUSTED_DATA>
... (remaining class inheritance declaration)
m_bWindowOnly = TRUE;
Appreciate your assistance.