private static void OnStop() { if (_cookie != 0) { ComAPI.CoRevokeClassObject(_cookie); } }
private static void OnStart() { Guid CLSID_MyObject = new Guid(Server.Guid); UInt32 hResult = ComAPI.CoRegisterClassObject(ref CLSID_MyObject, new ClassFactory(), ComAPI.CLSCTX_LOCAL_SERVER, ComAPI.REGCLS_MULTIPLEUSE, out _cookie); if (hResult != 0) { throw new ApplicationException( "CoRegisterClassObject failed" + hResult.ToString("X")); } else { Console.WriteLine("CoRegisterClassObject successfully!"); } }