Jump to content

BT viewer program


Recommended Posts

Hey, I am looking for some help on updating a list view item instead of clearing all of them and re adding, i planned on doing this by grabbing the unique handle of the bit tornado window and putting it in a hidden column or some thing like that, although I'm not quite sure how to do this, if anyone could post some help I'd appreciate it.

#include <GUIConstants.au3>
#include <Process.au3>
#include <Misc.au3>
#include <Constants.au3>
#Include <GuiList.au3>
#Include <GuiListView.au3>

Opt('GUIOnEventMode', 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
Opt('WinTitleMatchMode', 2)

Global $data = "(BitTornado)"
Global $toggle = 0
Dim $begin = TimerInit()

;Start GUI main
$gui_main = GuiCreate("Bit Tornado Viewer", 702, 257,-1, -1)
$list_torrent = GUICtrlCreateListView ("BT Window|Download Rate|Upload Rate",0,0,702,205);,$LVS_SORTDESCENDING)
GUICtrlSendMsg($list_torrent, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($list_torrent, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
_GUICtrlListViewSetColumnWidth($list_torrent, 0, 500)
$button_refresh = GuiCtrlCreateButton("Refresh", 20, 210, 80, 30)
$button_exit = GuiCtrlCreateButton("Exit", 300, 210, 80, 30)
$button_clear = GuiCtrlCreateButton("Clear", 160, 210, 80, 30)
;End GUI main

;Start Tray items
$tray_show_item = TrayCreateItem("Show")
TrayItemSetOnEvent(-1, "toggle")
$tray_hide_item = TrayCreateItem("Hide")
TrayItemSetOnEvent(-1, "toggle")
$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "quit")
TraySetClick(16)
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "toggle")
TrayItemSetState($tray_show_item, $GUI_DISABLE)
;End Tray items

;Start GUI Events
GUISetOnEvent($GUI_EVENT_CLOSE, 'quit')
GUICtrlSetOnEvent($button_refresh, 'refresh')
GUICtrlSetOnEvent($button_clear, 'clear')
GUICtrlSetOnEvent($button_exit, 'quit')
;End GUI Events

GUISetState(@SW_SHOW, $gui_main)

While 1
Sleep(100)
$dif = TimerDiff($begin)
If $dif > 1000 Then
_GUICtrlListViewDeleteAllItems ($list_torrent)
$var = WinList()

For $i = 1 to $var[0][0]
  If $var[$i][0] <> "" AND valid($var[$i][1]) Then
check()

$index = _GUICtrlListViewFindItem ($list_torrent, $var[$i][1], -1, BitOR($LVFI_STRING, $LVFI_WRAP))
If $index = $LV_ERR Then
$dlrate = ControlGetText($var[$i][1], "", "Static18")
$uprate = ControlGetText($var[$i][1], "", "Static22")
GUICtrlCreateListViewItem($var[$i][0] & "|" & $dlrate & "|" & $uprate, $list_torrent)
EndIf
EndIf
Next
$begin = TimerInit()
EndIf
Wend

Func quit()
Exit
EndFunc

Func toggle()
    If $toggle = 0 Then
        GUISetState(@SW_HIDE, $gui_main)
        TrayItemSetState($tray_hide_item, $GUI_DISABLE)
        TrayItemSetState($tray_show_item, $GUI_ENABLE)
        $toggle = 1
    ElseIf $toggle = 1 Then
        GUISetState(@SW_SHOW, $gui_main)
        TrayItemSetState($tray_show_item, $GUI_DISABLE)
        TrayItemSetState($tray_hide_item, $GUI_ENABLE)
        $toggle = 0
    EndIf
EndFunc

Func refresh()

EndFunc

Func clear()
_GUICtrlListViewDeleteAllItems ($list_torrent)
EndFunc

Func valid($handle)
If StringInStr($var[$i][0], $data) Then
Return 1
Else
Return 0
EndIf
EndFunc

Func check()
Const $PBM_GETPOS = ($WM_USER+8)
$torrentwindow = $var[$i][1]
$progress = ControlGetHandle($torrentwindow ,"","msctls_progress321")
$ret = DllCall("user32.dll","int","SendMessage","hwnd",$progress,"int",$PBM_GETPOS,"int",0,"int",0)
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...