Jump to content

Recommended Posts

Posted

Microsoft Sysinternals Process Explorer can list all threads in a Windows process. It can also terminate any specific thread in a process. I can't seem to find a Windows command line utility that does this. The closest I could find is a command line utility to list threads of a process.

I was hoping someone might have done something like this in Autoit already. From what I can tell, this would require a VERY experienced AutoIt expert who knows how to use Windows API commands such as TerminateThread comfortably.

Usage:

Processthread.exe -L notepad.exe

Result:

TID: 33772 notepad.exe+0x3570

TID: 37532 WINMM.dll!timeEndPeriod+0xe8

Usage:

Processthread.exe -T 33772

Result:

TID: 33772 notepad.exe+0x3570 **TERMINATED**

Posted

You can look here for information about a function that can terminate threads, but I'd look at the warning about half way down the page. Why are you looking to kill a program's threads instead of the program itself?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

I had a feeling I would get an answer like that. :) Yes, I already looked there obviously, that's why I mentioned the TerminateThread function in my first post. Im hoping this thread will catch the attention of someone with the expertise to do this; and, wouldn't mind helping out. Anyway, I've got a Vista64 device driver for an irreplaceable legacy product R5000HD mod that has a bug in it. The bug causes a specific process thread keep banging away at a resource that doesn't exist; which wastes significant CPU cycles. The developer for the device driver is nowhere to be found; which is the correct way to address the issue. I can successfully provide a "band-aid" for this issue by manually killing the thread via Process Explorer. There is no other way good way for me to address this issue; or I would have gone another route. I would like automate this, instead of manually doing it every time in Process Explorer.

Posted

Hmm.. Ive seen C and C# code that can do this. I was hoping that AutoIt has the same access to the WinAPI as C based languages in respect to this.

Posted

I'm not suggesting AutoIt3 cannot accomplish the task.

I'm saying it is that dodgy a function according to even MSDN

that without a full knowledge of what a thread is doing it is

extremely dangerous to the stability of the app and maybe

even system critical processes to use.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

Yes. I saw the same warning on MSDN. There are rare circumstances where this can be very useful and effective though. As mentioned earlier, I don't have any issues successfully doing this manually via Process Explorer's GUI; and, I dont have full knowledge of what the thread is doing. :) But, I do know that the band-aid solution actually works pretty well (no more weird Utilization caused by that thread... and system is perfectly stable for several days/weeks of uptime). Im just looking for a way to automate this via command line.

  • 3 years later...
Posted

I also want to terminate a specific thread ran by a process.

What do i do ?

Tha stupid program keeps popping up messages i dont want to see.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...