public void DoInterfaceAttachment() { try { //Get the IOleObject for Windows Media Player. _oleObject = this.GetOcx() as IOleObject; //Set the Client Site for the WMP control. _oleObject.SetClientSite(this as IOleClientSite); this.ocx = ((WMPLib.IWMPPlayer4)(this.GetOcx())); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } }
public void DoInterfaceAttachment() { if (!_isControlLoaded) { try { //Get the IOleObject for Windows Media Player. _oleObject = this.GetOcx() as IOleObject; _isControlLoaded = true; } catch (System.Exception ex) { //System.Diagnostics.Debug.WriteLine(ex.ToString()); } } if (!_isControlSited) { try { //Set the Client Site for the WMP control. _oleObject.SetClientSite(this as IOleClientSite); _isControlSited = true; } catch (Exception ex) { // This doesn't appear to have any effect on things, so once fired // don't attempt to fire it again _isControlSited = true; } } if (_controlOcx == null) { _controlOcx = ((WMPLib.IWMPPlayer4)(this.GetOcx())); } }
protected override void AttachInterfaces() { try { this.ocx = ((WMPLib.IWMPPlayer4)(this.GetOcx())); } catch (System.Exception ) { } }