private void RegisterOleComponent() { OleCom = new OleComponent(); var ocm = this.GetService(typeof(SOleComponentManager)) as IOleComponentManager; if (ocm != null) { uint pwdID; OLECRINFO[] crinfo = new OLECRINFO[1]; crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO)); crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedAllActiveNotifs; ocm.FRegisterComponent(OleCom, crinfo, out pwdID); } }