Skip to content

Instantly share code, notes, and snippets.

@tmplinshi
Created May 31, 2015 13:41
Show Gist options
  • Select an option

  • Save tmplinshi/96db2d498d0df4ddf540 to your computer and use it in GitHub Desktop.

Select an option

Save tmplinshi/96db2d498d0df4ddf540 to your computer and use it in GitHub Desktop.
~LButton::
;~ if WinExist("ahk_class Notepad")
;~ MsgBox % "The active window's ID is " . WinExist("A")
mylist=ahk_class Notepad++ ,ahk_class Notepad,ahk_class SciTEWindow
WinGetClass,abc,A
tance:="ahk_class " abc
if tance contains %mylist%
{
CoordMode, Mouse, Screen
MouseGetPos, m_x, m_y, m_hw_target
; WM_NCHITTEST
SendMessage, 0x84,, ( m_y << 16 )|m_x,, ahk_id %m_hw_target%
If ( m_hw_target = WinExist( tance ) ) #------------这部份就是为了下面的text变量赋值。可要可不要。
{
If ( ErrorLevel = 2 ) ; HTCaption
text = Caption
Else If ( ErrorLevel = 3 ) ; HTSysMenu
text = system Menu
Else If ( ErrorLevel = 8 ) ; HTMINButton
text = Minimize Button
Else If ( ErrorLevel = 9 ) ; HTMAXButton
text = Maximize Button
Else If ( ErrorLevel = 20 ) ; HTClose
text = Close Button
Else If ( ErrorLevel = 21 ) ; HTHELP
text = help Button
if ErrorLevel in 2,3,8,9,20,21
MsgBox, Hello, Notepad's %text%!
If ErrorLevel in 20
{
WinMinimize,A
}
}
}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment