最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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::    ;;∙------∙
发布评论

评论列表(0)

  1. 暂无评论