Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 95551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:40:33+00:00 2026-05-10T23:40:33+00:00

I have written an Application Desktop Toolbar (a.k.a AppBar), it works great except for

  • 0

I have written an Application Desktop Toolbar (a.k.a AppBar), it works great except for the fact that if I kill the process, the AppBar code never gets a chance to cleanup by sending an ABM_REMOVE. The problem is that this basically screws the users desktop up. The AppBar is written in .NET using interop code.

Does anyone know of a way to clean this resource up, even in the case of a process kill from TaskManager?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:40:34+00:00Added an answer on May 10, 2026 at 11:40 pm

    When a process is killed from Task Manager, no events are raised within that application. It’s common to use a seperate helper application that listens for the Win32_ProcessStopTrace event for your process. You can use the WqlEventQuery, which is part of System.Management for this.

    Here is some example code for this from a MegaSolutions post.

    using System; using System.Collections.Generic;  using System.Text;  using System.Management;    class ProcessObserver : IDisposable  {      ManagementEventWatcher m_processStartEvent = null;      ManagementEventWatcher m_processStopEvent = null;        public ProcessObserver(string processName, EventArrivedEventHandler onStart, EventArrivedEventHandler onStop)      {          WqlEventQuery startQuery = new WqlEventQuery('Win32_ProcessStartTrace', String.Format('ProcessName='{0}'', processName));          m_processStartEvent = new ManagementEventWatcher(startQuery);            WqlEventQuery stopQuery = new WqlEventQuery('Win32_ProcessStopTrace', String.Format('ProcessName='{0}'', processName));          m_processStopEvent = new ManagementEventWatcher(stopQuery);            if (onStart != null)              m_processStartEvent.EventArrived += onStart;            if (onStop != null)              m_processStopEvent.EventArrived += onStop;      }        public void Start()      {          m_processStartEvent.Start();          m_processStopEvent.Start();      }        public void Dispose()      {          m_processStartEvent.Dispose();          m_processStopEvent.Dispose();      }  } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Windows desktop application written in Delphi that works fine on Windows
Assume that we have a network deployed desktop application written in .NET. We don't
We have a desktop application written in Java Swing that currently uses Java Web
I also have a desktop application written in Windows Forms that is a middling
I have a Java desktop application that I have written. During the execution I
I have a desktop application written in Ruby that is using GTK2. It's just
I have a desktop application written in C#. It is trying to manage a
I have written an application for Android. the main part being that it communicates
I have a regular desktop application which is written in Python/GTK and SQLObject as
I have a C++ desktop application (written in wxWidgets) and I want to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.