AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

uTorrent :: WM_COMMAND > wParam values for Menu items

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
SKAN



Joined: 26 Dec 2005
Posts: 7159

PostPosted: Sat Nov 07, 2009 11:04 am    Post subject: uTorrent :: WM_COMMAND > wParam values for Menu items Reply with quote

Killing the process is a pretty bad idea with uTorrent and the you may use uTorrent_Exit() which exits uTorrent by simulating File > Exit through WM_COMMAND.
Though the tray icon disappears immediately, the process ( utorrent.exe ) will persist until it notifies the trackers, which would typically take around 10 seconds.

The return value will be Seconds taken if successful or the PID itself if the process was not closed within 20 seconds.

Code:
uTorrent_Exit( ahk_class="µTorrent4823DF041B09" ) {
; by SKAN  www.autohotkey.com/forum/viewtopic.php?t=50732
 hWnd := DllCall( "FindWindowA", Str,ahk_class, Int,0 ), TC := A_TickCount
 DllCall( "PostMessageA", UInt,hWnd, UInt,0x111, UInt,64, Int,0 ) ; Alt+FX = File > Exit
 Process, WaitClose, utorrent.exe, 20
 Return ErrorLevel ? ErrorLevel : Round( (A_TickCount-TC)/1000,2 )
}


Other PostMessage > wParam values for taming uTorrent

    Tray Menu
  • 60 Hide/Show uTorrent
  • 61 Resume All Torrents
  • 62 Pause All Torrents
  • 63 Exit uTorrent

    File Menu
  • 65 Add Torrent
  • 67 Add Torrent
  • 73 Add Torrent from URL
  • 72 Create New Torrent
  • 64 Exit

    Options Menu
  • 68 Preferences
  • 80 RSS Downloader
  • 82 Speed Guide Dialog
  • 76 Show Toolbar
  • 75 Show Detailed Info
  • 77 Show Status Bar
  • 78 Show Category List
  • 84 Icons on Tabs

    Help Menu
  • 83 uTorrent Help
  • 70 uTorrent Webpage
  • 99 uTorrent Foums
  • 71 Check for Updates
  • 81 Show Statistics
  • 69 About uTorrent


Last edited by SKAN on Tue Nov 17, 2009 1:22 pm; edited 3 times in total
Back to top
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 64

PostPosted: Mon Nov 09, 2009 1:54 pm    Post subject: Reply with quote

Do you really need the DllCall()s? I think "DetectHiddenWindows on" and the builtin PostMessage should be enough to do the same job.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7159

PostPosted: Mon Nov 09, 2009 2:12 pm    Post subject: Reply with quote

jackieku wrote:
"DetectHiddenWindows on" and the builtin PostMessage should be enough to do the same job.


Exactly!. I learnt this alternative from corrupt.

Quote:
Do you really need the DllCall()s?


I prefer functions over a subroutine for the sake of avoiding Global variables,
and I avoid using the following inside functions:
    DetectHiddenWindows
    SetFormat, Integer, Hex
    Gui

Just a matter of preference.
Back to top
View user's profile Send private message
neh neh pork
Guest





PostPosted: Wed Nov 11, 2009 2:02 pm    Post subject: Reply with quote

thanx, this is useful Wink
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 7159

PostPosted: Tue Nov 17, 2009 1:21 pm    Post subject: Reply with quote

I discovered more wParam values with brute force.. Titles post updated.
Back to top
View user's profile Send private message
Vade



Joined: 14 Jun 2008
Posts: 5

PostPosted: Thu Nov 19, 2009 1:40 pm    Post subject: Reply with quote

Thanks SKAN !
This is just what I've been looking for. Now I don't have to recheck my torrents Smile .
I tried finding those wParams with WinSpector, but had no luck.
Back to top
View user's profile Send private message
shajul



Joined: 15 Sep 2006
Posts: 99

PostPosted: Thu Nov 19, 2009 3:22 pm    Post subject: Reply with quote

Great work!!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group