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

  • Home
  • SEARCH
  • 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 3405782
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:32:51+00:00 2026-05-18T05:32:51+00:00

I am working on a small application that is meant to call some (really

  • 0

I am working on a small application that is meant to call some (really diverse) functions which are sadly out of my control and designed in such a way that I have no clue when the proper user action is done. In particular some of these spawn a thread to do their work in, which ends up dying at some point in the future. So some are implemented sync, some are implemented asynchronous, and my code does not know which of those it will be.

The only purpose of my application is to launch these tasks and terminate upon completion. Since the purpose is automation, I anticipate it being called 100s of times from batchfiles in a matter of moments, so I do not wish the process to linger any longer than absolutely possible.

Since I have no signal I can wait for, ExitThread() on my primary thread seems to be the way to go, so that any threads spawned by the foreign code will end up killing the process when they terminate.

So now to get to my actual issue mentioned in the title. 🙂 In order to get the proper interfaces for my jig, I need to mess around with some COM functions. SHParseDisplayName, IShellFolder::GetUIObjectOf and a bunch of others. But long after I am done with these interfaces and have released them, these threads remain present. Even after I called CoUninitialize().

When inspecting my process using Process Explorer, the majority of these threads seem to have ntdll.dll@EtwTraceMessageVa as the entry point, and are stuck in ntdll.dll!ZwAlpcSendWaitReceivePort+0xa. Obviously, randomly terminating threads using TerminateThread is not an option here.

How can I get COM to terminate those threads when I am done with using it? I am using W7 x64 to develop on.

  • 1 1 Answer
  • 0 Views
  • 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. Editorial Team
    Editorial Team
    2026-05-18T05:32:52+00:00Added an answer on May 18, 2026 at 5:32 am

    I figured out the problem, and it was an obvious case of all the documentation being somewhere but not where you are looking, and a somewhat related subject has had a blog post on this issue which brought me to the missing piece.

    My app pops up an IContextMenu of a file (hence no ShellExecute in my code), and then allows one to invoke a command. However, some verbs like properties are the oddballs that my question was about: they spawn another thread and give no notification or obvious way to block it.

    Using SHSetExplorerInstance as mentioned in the linked post fixed my problems. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small VB.NET application that I'm working on using the full version
I have a small application I am working on that at one point needs
I am working on a small AIR desktop application and I have some configuration
I am working on a small application in VB.NET. The program needs administrator privilege
I am working on a small team of web application developers. We edit JSPs
I'm working on a relatively small asp.net web application and am wondering if there
I've been quite used to working on small projects which I coded with 1,000
I am working on a php web application which involves calls to 3rd party
I'm working on an online PHP application that has a need for delayed PHP
I'm working on a small templating engine, and I'm using DOMDocument to parse the

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.