private void TransitionFromLoadedToRunning()
{
Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Loaded, "Wrong start state to transition from");
if (this.ActiveXState == ActiveXHelper.ActiveXState.Loaded)
{
//
// See if the ActiveX control returns OLEMISC_SETCLIENTSITEFIRST
int bits = 0;
int hr = _axOleObject.GetMiscStatus(NativeMethods.DVASPECT_CONTENT, out bits);
if (NativeMethods.Succeeded(hr) && ((bits & NativeMethods.OLEMISC_SETCLIENTSITEFIRST) != 0))
{
//
// Simply setting the site to the ActiveX control should activate it.
// And this will take us to the Running state.
_axOleObject.SetClientSite(this.ActiveXSite);
}
StartEvents();
//
// We are now Running!
this.ActiveXState = ActiveXHelper.ActiveXState.Running;
}
}