Beispiel #1
0
		public static void Revoke()
		{
			if (null == m_newFilter)
				return;

			try
			{
				ApplicationControllerTrace trace = new ApplicationControllerTrace("Unregister message filter");

				IOleMessageFilter oldFilter = null;
				long hresult = CoRegisterMessageFilter(m_oldFilter, out oldFilter);
				if (hresult != S_OK)
				{
					trace.Log(String.Format("Could not revoke MessageFilter (hresult = 0x{0:X} - possibly called from MTA thread (unsupported))", hresult));
				}

				if (null != oldFilter)
				{
					StringBuilder message = new StringBuilder("The previous message filter is ");
					message.Append(oldFilter.GetType());
					trace.Log(message.ToString());
				}
			}
			catch (System.Exception e)
			{
				ApplicationControllerTrace trace = new ApplicationControllerTrace("Unregister message filter");
				trace.Log(e.Message);
			}
			finally
			{
				m_newFilter = null;
				m_oldFilter = null;
			}
		}
Beispiel #2
0
		public static void Register()
		{
			if (null != m_newFilter)
				return;

			ApplicationControllerTrace trace = new ApplicationControllerTrace("Register message filter");

			MessageFilter newFilter = new MessageFilter();
			long hresult = CoRegisterMessageFilter(newFilter, out m_oldFilter);
			if (hresult == S_OK)
			{
				m_newFilter = newFilter;
			}
			else
			{
				trace.Log(String.Format("Could not register MessageFilter (hresult = 0x{0:X} - possibly called from MTA thread (unsupported))", hresult));
			}

			if (null == m_oldFilter)
			{
				trace.Log("The process did not contain a message filter");
			}
			else
			{
				StringBuilder message = new StringBuilder("The previous message filter is ");
				message.Append(m_oldFilter.GetType());
				trace.Log(message.ToString());
			}
		}
Beispiel #3
0
		public static void Register()
		{
			if (null != _newFilter)
				return;

			var newFilter = new MessageFilter();
			long hresult = CoRegisterMessageFilter(newFilter, out _oldFilter);
			if (hresult == S_OK)
			{
				_newFilter = newFilter;
			}
		}
        /// <summary>
        /// Uninstalls the retry message filter.
        /// </summary>
        public static void Uninstall()
        {
            lock (syncRoot)
            {
                if (oldFilter != null)
                {
                    IOleMessageFilter filter;
                    NativeMethods.CoRegisterMessageFilter(oldFilter, out filter);

                    oldFilter = null;
                    newFilter = null;
                }
            }
        }
Beispiel #5
0
		public static void Revoke()
		{
			if (null == _newFilter)
				return;

			try
			{
				IOleMessageFilter oldFilter;
				CoRegisterMessageFilter(_oldFilter, out oldFilter);
			}
			catch (Exception e)
			{
                Logger.LogError(e);
			}
			finally
			{
				_newFilter = null;
				_oldFilter = null;
			}
		}
 private static extern int CoRegisterMessageFilter(IOleMessageFilter lpMessageFilter, out IOleMessageFilter lplpMessageFilter);
 private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
			CoRegisterMessageFilter(IOleMessageFilter newFilter, out
				IOleMessageFilter oldFilter);
Beispiel #9
0
        // Done with the filter, close it.
        public static void Revoke()
        {
            IOleMessageFilter oldFilter = null;

            CoRegisterMessageFilter(null, out oldFilter);
        }
Beispiel #10
0
        /// <summary>
        /// Note this registers the filter only for the current thread.
        /// </summary>
        public static void Register()
        {
            IOleMessageFilter oldFilter = null;

            CoRegisterMessageFilter(new ComMessageFilter(), out oldFilter);
        }
Beispiel #11
0
 CoRegisterMessageFilter(IOleMessageFilter newFilter, out
                         IOleMessageFilter oldFilter);
Beispiel #12
0
 private static extern int CoRegisterMessageFilter(
     IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
Beispiel #13
0
            private static void CoRegisterMessageFilter(IOleMessageFilter newFilter)
            {
                IOleMessageFilter oldFilter;

                CoRegisterMessageFilter(newFilter, out oldFilter);
            }
Beispiel #14
0
 private static extern int CoRegisterMessageFilter(IOleMessageFilter hTaskCallee, out IOleMessageFilter oldFilter);
Beispiel #15
0
 public static void CoRegisterMessageFilter(IOleMessageFilter newFilter) => CoRegisterMessageFilter(newFilter, out _);
 private static void CoRegisterMessageFilter(IOleMessageFilter newFilter)
 {
     IOleMessageFilter oldFilter;
     CoRegisterMessageFilter(newFilter, out oldFilter);
 }