life ideas

October 23, 2006

AutoHotKey

Filed under: Uncategorized — manoftoday @ 6:30 pm

 

1)  simulate a close action

WinGet, window_id, ID, MSN Messenger ;  as the title name
; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
PostMessage, 0x112, 0xF060,,, ahk_id %window_id% ; approach to simulate a click on close button

 

the downside is that it will mimimize to trayicon, unless the program has no tray icon.

 

2) by process Exit

Process, Exist, msnmsgr.exe

 

the downside is that it will still have a dead trayicon there, unless you manually refresh the tray window

 

3)  perfect approach

WM_CLOSE=0x10
WM_QUIT=0x12

DetectHiddenWindows, On
Process, Exist, msnmsgr.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!
}

 

4) by send a WM_COMMAN exit command

PostMessage, 0x111, 32770,,,雅虎通

 

how to find 32770?

please refer http://www.autohotkey.com/docs/misc/SendMessage.ht…

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: