Montu
Joined: 11 Feb 2009 Posts: 142 Location: India
|
Posted: Wed Feb 11, 2009 1:49 pm Post subject: network connection monitering in Autohotkey GUI? |
|
|
Friends,
I'm working on this project
making a autohotkey GUI taskbar just like windows taskbar with starmenu and clock and everything.
but I'm stuck at network connection icon.
as you know that When we get connected to internet, there is a network connection icon in the taskbar near the clock. which gives functionality
to view how much data transffered, + enable / disable the connection.
How can I add that thing in my autohotkey GUI?
Thanks in Advance |
|
Sivvy
Joined: 21 Jul 2008 Posts: 726 Location: Calgary, AB, Canada
|
Posted: Wed Feb 11, 2009 4:25 pm Post subject: |
|
|
Ownership.
Here are a few lines of code from an incomplete script I stopped writing that steals the Windows TaskBar and places it onto my own GUI (Among other things, but all you really need is the TaskBar part).
| Code: | ControlGet FauxTaskBar, Hwnd, , ToolbarWindow322, ahk_class Shell_TrayWnd ; TaskBar
FauxTaskBarParent := GetParent(FauxTaskBar) ; Parent of TaskBar
TaskBarLength := A_ScreenWidth - 80
BarHeight = 30
y := A_ScreenHeight - BarHeight
Gui -Caption +ToolWindow +AlwaysOnTop +0x02000000 ; WS_CLIPCHILDREN
Gui Show, W%TaskBarLength% H%BarHeight% x80 y%y%, NewTaskBar
StartButtonPos := y - 30
StartButtonHeight := BarHeight + 55
Gui 2:-Caption +ToolWindow
Gui 2:Show, w1000 h%StartButtonHeight% x0 y%StartButtonPos%, StartButtonGui
WinSet Region, 0-0 w82 h82 E, StartButtonGui
WinSet Transparent, 100, StartButtonGui
FauxGuiWindow := WinExist("NewTaskBar")
GoSub, AddTools
Return
ShowStartMenu: ; Show real startmenu using my own button.
SendMessage 0x112, 0xF130 ; WM_SYSCOMMAND = 0x112 SC_TASKLIST = 0xF130
Return
AddTools:
SetParent(FauxTaskBar, FauxGuiWindow) ; Steal ownership
ControlMove, , 5, , , , ahk_id %FauxTaskBar%
WinHide, ahk_class Shell_TrayWnd ; Hide real TaskBar
Return
RestoreTools:
SetParent(FauxTaskBar, FauxTaskBarParent) ; Reset the owner
Return
GetParent(FauxControl) ; Get current control owner.
{
Return DllCall("GetParent", "UInt", FauxControl)
}
SetParent(FauxControl, FauxNewParent) ; For changing control ownership.
{
Return DllCall("SetParent", "UInt", FauxControl, "UInt", FauxNewParent)
}
^r::
RestoreExit:
GoSub RestoreTools
WinShow ahk_class Shell_TrayWnd ; Show real TaskBar
ExitApp
OnMessage(0x7E, "WM_DISPLAYCHANGE") ; In case user changes screen resolution
Return
WM_DISPLAYCHANGE() ; In case user changes screen resolution
{
Reload
} |
Not sure if that helps you any, but it shouldn't be too hard to figure out how to get Tray items.
Edit: If you put a picture in "Gui 2", clicking on it will act like clicking the start button.
To end the script and return ownership to Windows... Press "CTRL+r". |
|