AutoHotkey Community

It is currently May 27th, 2012, 11:05 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: February 22nd, 2010, 11:29 pm 
Offline

Joined: July 31st, 2008, 10:27 pm
Posts: 336
Sean - I just wanted to say thanks for these functions. Like most people here, I have a script running at all times to help me with my own projects. I added this one to it, then realized that so far I have used three of your libraries: Com, GetWebBrowser(), and now this one!
:D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2010, 11:42 am 
Offline

Joined: April 12th, 2010, 5:32 pm
Posts: 6
I used it to implement the Windows 7 Winkey+number (1, 2, 3, ...) functionality for opening the 1st, 2nd, 3rd, ... window in Windows XP. Here is the code (far from perfect, but works just fine :)):

Code:
TaskButtons(sExeName = "")
{
   WinGet,   pidTaskbar, PID, ahk_class Shell_TrayWnd
   hProc:=   DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
   pProc:=   DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 32, "Uint", 0x1000, "Uint", 0x4)
   idxTB:=   GetTaskSwBar()
      SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_BUTTONCOUNT
       
        i := 1
   Loop,   %ErrorLevel%
   {
      SendMessage, 0x417, A_Index-1, pProc, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_GETBUTTON
      VarSetCapacity(btn,32,0)
      DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pProc, "Uint", &btn, "Uint", 32, "Uint", 0)
         iBitmap   := NumGet(btn, 0)
         idn   := NumGet(btn, 4)
         Statyle := NumGet(btn, 8)
      If   dwData   := NumGet(btn,12)
         iString   := NumGet(btn,16)
      Else   dwData   := NumGet(btn,16,"int64"), iString:=NumGet(btn,24,"int64")
      DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "int64P", hWnd:=0, "Uint", NumGet(btn,12) ? 4:8, "Uint", 0)
      If Not   hWnd
         Continue
       
        buttons%i% := hWnd
        i++
   }
   DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pProc, "Uint", 0, "Uint", 0x8000)
   DllCall("CloseHandle", "Uint", hProc)
   ; Return   sTaskButtons
    Return   buttons
}

GetTaskSwBar()
{
   ControlGet, hParent, hWnd,, MSTaskSwWClass1 , ahk_class Shell_TrayWnd
   ControlGet, hChild , hWnd,, ToolbarWindow321, ahk_id %hParent%
   Loop
   {
      ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
      If  Not   hWnd
         Break
      Else If   hWnd = %hChild%
      {
         idxTB := A_Index
         Break
      }
   }
   Return   idxTB
}

#1::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons1%
        WinMinimize, ahk_id %buttons1%
    else
        WinActivate, ahk_id %buttons1%
return

#2::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons2%
        WinMinimize, ahk_id %buttons2%
    else
        WinActivate, ahk_id %buttons2%
return

#3::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons3%
        WinMinimize, ahk_id %buttons3%
    else
        WinActivate, ahk_id %buttons3%
return

#4::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons4%
        WinMinimize, ahk_id %buttons4%
    else
        WinActivate, ahk_id %buttons4%
return

#5::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons5%
        WinMinimize, ahk_id %buttons5%
    else
        WinActivate, ahk_id %buttons5%
return

#6::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons6%
        WinMinimize, ahk_id %buttons6%
    else
        WinActivate, ahk_id %buttons6%
return

#7::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons7%
        WinMinimize, ahk_id %buttons7%
    else
        WinActivate, ahk_id %buttons7%
return

#8::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons8%
        WinMinimize, ahk_id %buttons8%
    else
        WinActivate, ahk_id %buttons8%
return

#9::
    buttons := TaskButtons()
    IfWinActive, ahk_id %buttons9%
        WinMinimize, ahk_id %buttons9%
    else
        WinActivate, ahk_id %buttons9%
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2010, 2:01 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
yassendobrev wrote:
I used it to implement the Windows 7 Winkey+number (1, 2, 3, ...) functionality for opening the 1st, 2nd, 3rd, ... window in Windows XP.


Why not this?
Code:
TaskButtons(sExeName = "")
{
; ...
}

GetTaskSwBar()
{
; ...
}

#1::
#2::
#3::
#4::
#5::
#6::
#7::
#8::
#9::
  Buttons := TaskButtons() , Number := SubStr(A_ThisHotkey,2)
  IfWinActive, % "ahk_id " Buttons%Number%
    WinMinimize, % "ahk_id " Buttons%Number%
  Else
    WinActivate, % "ahk_id " Buttons%Number%
Return

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2010, 2:05 pm 
Offline

Joined: April 12th, 2010, 5:32 pm
Posts: 6
Have you tried it?
It's not working on my system :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2010, 2:36 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
Yeah, it doesn't. That's weird...
I can't see why mine won't work.

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2010, 12:43 am 
Offline

Joined: May 3rd, 2009, 6:37 pm
Posts: 67
Does this work on windows 7?, I'm just getting an empty MsgBox


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2010, 12:09 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
No it doesn't the taskbar seems to work different here.

I would be interested in getting this to work, but I have no idea if it's possible, I already did some researching at MSDN.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2010, 12:46 pm 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 314
What about changing

Number := SubStr(A_ThisHotkey,2)

To

Number := SubStr(A_ThisHotkey,0)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 18th, 2010, 3:58 pm 
Offline

Joined: March 6th, 2010, 11:52 am
Posts: 4
Location: Cheadle, Cheshire, UK
I'd just like to say how pleased I was to find TrayIcon.ahk so I can use it to keep an eye on what Dropbox is doing. You have no idea how long I spent searching for some way of doing this, for a script that tries to ensure that all is safe before Hibernating or Suspending.

Many thanks :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2011, 6:18 pm 
Offline

Joined: July 15th, 2006, 1:30 am
Posts: 48
Sorry for necro-posting but is there anything new for the Windows 7 taskbar?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2011, 3:59 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
Not that I know of, but I would like to know this myself.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2011, 3:30 pm 
bump cough cough windows 7


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3

All times are UTC [ DST ]


Who is online

Users browsing this forum: iDrug and 59 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group