| View previous topic :: View next topic |
| Author |
Message |
brotherS
Joined: 01 Jun 2005 Posts: 147
|
Posted: Wed Feb 15, 2006 11:11 am Post subject: kill process AND tray icon - possible? |
|
|
Hi,
what I don't really like about "process, close, bla.exe" is that it just kills the process but leaves the program's tray icon in the tray... do you know any way to prevent that? _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
Micha
Joined: 15 Nov 2005 Posts: 440 Location: Germany
|
Posted: Wed Feb 15, 2006 11:37 am Post subject: |
|
|
Hi,
well it's the same behaviour, if you kill the thread with taskmanager.
The Explorer doesn't recognize, that the tread had died.
I have only 2 very bad "solutions"
1. Kill all explorer-tasks and start a new one. The tray is recreated. But this means that all explorerwindows will close and some programs does not draw its trayicon again so you can "loose" some icons (Really bad idea)
The second idea: If you move your mouse over the icon, it vanishes.
Perhaps you can remember the current mouseposition, gets the coordinates of the trayicon, kill the thread, move the mouse to that position and moves it back.
I hope somebody has better ideas
Ciao
Micha |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed Feb 15, 2006 11:54 am Post subject: |
|
|
WinSet Redraw, , ahk_class TrayNotifyWnd
(Untested) _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Last edited by PhiLho on Wed Feb 15, 2006 6:09 pm; edited 1 time in total |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 147
|
Posted: Wed Feb 15, 2006 1:19 pm Post subject: |
|
|
@Micha:
Hehe, nice, I thought about something like that too but then thought there MUST be some better way
@PhiLho:
Thanks, sounds perfect, but doesn't work
I tried
| Code: |
WinSet Redraw, , ahk_class TrayNotifyWnd
|
and
| Code: |
WinSet, Redraw, , ahk_class Shell_TrayWnd
|
and even
| Code: |
DetectHiddenWindows, on
WinSet, Redraw, , ahk_class Shell_TrayWnd
|
..but nothing works  _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5382 Location: /b/
|
Posted: Wed Feb 15, 2006 2:19 pm Post subject: |
|
|
TrayNotifyWnd1 seems to refresh after you move the mouse over it. You can use MouseMove to simulate this. _________________
 |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 147
|
Posted: Wed Feb 15, 2006 2:53 pm Post subject: |
|
|
I'm not sure I can follow... since I'm using the Windows task bar on the left side of the desktop my (currently 15) tray icons are piling up in 3 icon rows... so you suggest to zig-zag the mouse over all the possible tray icon positions with MouseMove? _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed Feb 15, 2006 6:11 pm Post subject: |
|
|
The doc. suggests to try to hide and unhide the window if WinSet Redraw fails... Still untested... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Whitespliff
Joined: 09 Feb 2006 Posts: 33
|
Posted: Thu Feb 16, 2006 2:25 am Post subject: |
|
|
I was just to ask the same thing & I stumble on this thread
Now I'm using the MouseMove solution but thats not foolproof, somehow refreshing the systray would do it but I've no idea how to do that (exept for killing explorer.exe & restarting it but that's a bit overkill ).
More ideas are welcome... _________________ In a world without walls and fences, who needs Windows and Gates? |
|
| Back to top |
|
 |
JSLover
Joined: 20 Dec 2004 Posts: 541 Location: LooseChange911.com... the WTC attacks were done by the US Gov't... the official story is a lie...
|
Posted: Thu Feb 16, 2006 11:19 am Post subject: |
|
|
| Whitespliff wrote: | | More ideas are welcome... |
...have you both tried all manner of asking the process to close besides Process, Close...get a handle to a window & do WinClose on it or do PostMessage, WM_CLOSE or WM_QUIT...or something...anything is better than Process, Close...what programs do you need to close so hard?
| Code: | WM_CLOSE=0x10
WM_QUIT=0x12
DetectHiddenWindows, On
Process, Exist, dienow.exe
pid:=errorlevel
IfWinExist, ahk_pid %pid%
{
WinClose
;PostMessage, WM_CLOSE
;PostMessage, WM_QUIT
}
else msgbox, No dice! |
_________________
Home • Click image! • Blog |
|
| Back to top |
|
 |
Whitespliff
Joined: 09 Feb 2006 Posts: 33
|
Posted: Thu Feb 16, 2006 12:21 pm Post subject: |
|
|
In my case it are 2 processes that start along with my TV software, when I close PCTV the processes keep running.
EDIT: I'm not on the cpu that has the script running but I think this would work, TNX! _________________ In a world without walls and fences, who needs Windows and Gates? |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 147
|
Posted: Fri Feb 17, 2006 8:18 pm Post subject: |
|
|
| JSLover wrote: |
...have you both tried all manner of asking the process to close besides Process, Close...get a handle to a window & do WinClose on it or do PostMessage, WM_CLOSE or WM_QUIT...or something...anything is better than Process, Close...
|
You are totally right, I'm now using your WM_QUIT approach, thanks!
Too bad that neither that removes the tray icon... _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1239
|
Posted: Fri Feb 17, 2006 9:01 pm Post subject: |
|
|
Buried in the manual somewhere was this method I've been using of closing windows, which is supposed to be the same as clicking on the window close button (the X):
| Code: |
WindowID = ; need to get the window ID one way or another
; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
PostMessage, 0x112, 0xF060,,, ahk_id %WindowID%
|
|
|
| Back to top |
|
 |
Whitespliff
Joined: 09 Feb 2006 Posts: 33
|
Posted: Sat Feb 18, 2006 4:34 pm Post subject: |
|
|
| brotherS wrote: | | Too bad that neither that removes the tray icon... | Strange, it removes the tray icon on my scripts.
There was 1 script where I had to loop it 2 times before the icon disappeared. _________________ In a world without walls and fences, who needs Windows and Gates? |
|
| Back to top |
|
 |
JSLover
Joined: 20 Dec 2004 Posts: 541 Location: LooseChange911.com... the WTC attacks were done by the US Gov't... the official story is a lie...
|
Posted: Sat Feb 18, 2006 6:19 pm Post subject: |
|
|
| brotherS wrote: | | Too bad that neither that removes the tray icon... |
...what prog? Also...instead of zig-zagging you could make an image (screenshot) of only the tray icon...then use ImageSearch to find it on screen & MouseMove to the icon & back...to cause it to disappear from a mouse over...if nothing else ends up working...
| Whitespliff wrote: | | There was 1 script where I had to loop it 2 times before the icon disappeared. |
...ok...
| Code: | WM_CLOSE=0x10
WM_QUIT=0x12
DetectHiddenWindows, On
Process, Exist, dienow.exe
pid:=errorlevel
Loop
{
IfWinExist, ahk_pid %pid%
{
WinClose
;PostMessage, WM_CLOSE
;PostMessage, WM_QUIT
}
else if A_Index>1
break
else msgbox, No dice!
} |
_________________
Home • Click image! • Blog |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 147
|
Posted: Sun Feb 19, 2006 8:08 pm Post subject: |
|
|
Thanks for your help, I still hope Chris will come up with a RefreshTray command though...  _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
|