autohotkey - How can I close a stuck window using AHK or Python? - Stack Overflow

I have a Chromium based software that is really buggy, for some reason some windows of that process bec

I have a Chromium based software that is really buggy, for some reason some windows of that process become unkillable, I can move them around but I cannot close them.

I've tried to use winclose and winkill in AHK but it doesn't work (while the script correctly works on other windows). I've also tried the script below but it closes all the windows of the process. I don't know any language besides AHK and Python and maybe I need to use a low-level language

i::
MouseGetPos,,, id
MsgBox, The window ID under the mouse is: %id%
WinGet, pid, PID, ahk_id %id%
hProcess := DllCall("OpenProcess", "UInt", 1, "Int", 0, "UInt", pid, "Ptr")
DllCall("ntdll\NtTerminateProcess", "ptr", hProcess, "UInt", 0)
DllCall("CloseHandle", "ptr", hProcess)
return

I have a Chromium based software that is really buggy, for some reason some windows of that process become unkillable, I can move them around but I cannot close them.

I've tried to use winclose and winkill in AHK but it doesn't work (while the script correctly works on other windows). I've also tried the script below but it closes all the windows of the process. I don't know any language besides AHK and Python and maybe I need to use a low-level language

i::
MouseGetPos,,, id
MsgBox, The window ID under the mouse is: %id%
WinGet, pid, PID, ahk_id %id%
hProcess := DllCall("OpenProcess", "UInt", 1, "Int", 0, "UInt", pid, "Ptr")
DllCall("ntdll\NtTerminateProcess", "ptr", hProcess, "UInt", 0)
DllCall("CloseHandle", "ptr", hProcess)
return

Share Improve this question asked Mar 13 at 4:21 Heavy MaskHeavy Mask 1 1
  • You can try WinHide ahk_id %id% if the hidden window doesn't have any influence on the rest of the app. – Relax Commented Mar 13 at 9:28
Add a comment  | 

1 Answer 1

Reset to default 0

@Heavy Mask
Wanted to thank you for this. I don't know if you ever found a solution, but your script inspired me to create the below script. Might be able to use it yourself?

;;∙============================================================∙
#NoEnv
#Persistent
#SingleInstance, Force
SetBatchLines, -1
SetTitleMatchMode 2
SetWinDelay, 0

^!LButton::    ;;∙------∙

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744720701a4589891.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信