Sign in to follow this  
Followers 0
Damein

Memory leak in my application?

7 posts in this topic

So question for you guys, I wrote an app and it seems to be working well but I feel like I have a memory leak somewhere?

Idle the program is using ~70mbs of memory but no CPU usage. Is this going to cause problems for any of my users?

Here is a link to the program Download Link


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

not 70mb ..

let me fix you, 220mb+

This is probably related internet explorer

Maybe with the latest IE version will be less memory leak.

Maybe try to use my method to create IE frame.

My method will create IE frame with latest IE version.

when you use _IECreateEmbedded you actually using up to IE 7.

 

Try this:

'?do=embed' frameborder='0' data-embedContent>>

Edited by gil900

Share this post


Link to post
Share on other sites

Sorry MBALZESHARI, didn't think it'd be a big issue.

And odd gil, I only experience 70 from mine at any given time. I'll look into that.

@ MBALZESHARI

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Data\Icon.ico
#AutoIt3Wrapper_Compression=0
#AutoIt3Wrapper_Res_Fileversion=3.3.0.0
#AutoIt3Wrapper_Res_LegalCopyright=R.S.S.
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;~ #AutoIt3Wrapper_Icon=Images\Icon.ico

#include ".\Skins\Hex.au3"
#include "_UskinLibrary.au3"
#include "GUIHyperLink.au3"

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <ListBoxConstants.au3>
#include <GuiListBox.au3>




_Uskin_LoadDLL()
_USkin_Init(_Hex(True))

Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)
Opt("GUICoordMode", 1)


TrayCreateItem("Show..")
TrayItemSetOnEvent(-1, "_Show")
TrayCreateItem("Hide..")
TrayItemSetOnEvent(-1, "_Tray")

TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_Exit")

Global $MobileQuality, $LowQuality, $MediumQuality, $HighQuality, $SourceQuality, $StreamLink, $Quality, $StreamLinkInput
Global $AddToFavoritesCheckBox, $FavoriteStream = 1, $InputStreamName, $FavoriteList, $LiveStreamGui, $RunChat, $ChatType = "Browser"
Global $FavoriteListOffline, $FavoriteListOnline, $CheckBoxForChat, $CheckBoxForBrowserChat, $CheckBoxForHexChat, $StreamChat
Global $TabList, $TabChanged
Global $Quality = "Source"

Local $oIE = _IECreateEmbedded()


$FavoritesList = IniReadSectionNames(@ScriptDir & "\Data\StreamInfo.ini")
$HotKey = IniRead(@ScriptDir & "\Data\Preferences.ini", "Preferences", "Hotkey", "NotFound")

HotKeySet($HotKey, "_GetLinks")

$RunChat = IniRead(@ScriptDir & "\Data\Preferences.ini", "Preferences", "ChatEnabled", "NotFound")

$PayPalLink = "https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=7_Ywm_iBHntx2jsC7G_ciEkJBWT_B4z4u-Dr4qt_JRqG0XAU7tQZ8fy30pq&dispatch=5885d80a13c0db1f8e263663d3faee8db315373d882600b51a5edf961ea39639"

$CheckFirstRun = IniRead(@ScriptDir & "\Data\Preferences.ini", "Preferences", "FirstRun", "NotFound")
If $CheckFirstRun = "0" Then
    MsgBox(0, "LiveStreamer Pro", "Please take a moment to read the following messages")
    MsgBox(0, "LiveStreamer Pro", "To use this program you must have LiveStreamer installed, if you have not installed in please exit this application and navigate to the folder labeled 'LiveStreamer Installer' and run that installation.")
    MsgBox(0, "LiveStreamer Pro", "To copy a link from a stream to use on this, navigate to the stream you want and press Ctrl+` and it will copy the link of the stream." & @CRLF & "Or simply right click the name of the stream below the thumbnail it shows and click 'Copy Shortcut'")
    MsgBox(0, "LiveStreamer Pro", "And please note the donations button at the top right, donations are always welcome but never mandatory!" & @CRLF & "Thanks and enjoy the program!")
    $CheckSave = MsgBox(4, "LiveStreamer Pro", "Do you wish to see this message ever again?")
    If $CheckSave = 6 Then
        Sleep(10)
    Else
        IniWrite(@ScriptDir & "\Data\Preferences.ini", "Preferences", "FirstRun", "1")
    EndIf
EndIf





_ShowGui()

Func _ShowGui()
    $LiveStreamGui = GUICreate("LiveStreamer Pro", 600, 500, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU))
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Tray")
    GUISetFont(12)
    GUICtrlCreateLabel("Prophete's LiveStreamer Pro", 160, 0, 300)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetFont(-1, 16)
    GUICtrlCreateLabel("An R.S.S. Production ©2014", 225, 30, 100, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetFont(-1, 6)
    GUICtrlCreateLabel("v3.3", 330, 30, 100, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetFont(-1, 6)
    $RefreshButton = GUICtrlCreateButton("Refresh", 80, 5, 60, 40)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_BrowseRefresh")
    $HomeButton = GUICtrlCreateButton("Home", 10, 5, 60, 40)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_BrowseHome")
    $DonationButton = GUICtrlCreateButton("Donations", 490, 10, 80, 50)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_Donation")
    $TabList = GUICtrlCreateTab(10, 45, 580, 420)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateTabItem("Live Streams")
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateObj($oIE, 20, 80, 560, 380)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    _IENavigate($oIE, "http://www.twitch.tv/directory")
    GUICtrlCreateTabItem("Stream Input")
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Input Stream Link", 220, 80, 120)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $StreamLinkInput = GUICtrlCreateInput("", 140, 120, 300, 25)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Select Stream Quality", 205, 180, 150)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $MobileQuality = GUICtrlCreateCheckbox("Mobile", 145, 230, 65, 25)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_QualityCheckBox1")
    $LowQuality = GUICtrlCreateCheckbox("Low", 255, 230, 65, 25)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_QualityCheckBox2")
    $MediumQuality = GUICtrlCreateCheckbox("Medium", 365, 230, 75, 25)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_QualityCheckBox3")
    $HighQuality = GUICtrlCreateCheckbox("High", 195, 280, 75, 25)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_QualityCheckBox4")
    $SourceQuality = GUICtrlCreateCheckbox("Source", 305, 280, 75, 25)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_QualityCheckBox5")
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlCreateLabel("Add To Favorites?", 225, 350, 130)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $AddToFavoritesCheckBox = GUICtrlCreateCheckbox("", 275, 380, 15, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetOnEvent(-1, "_FavoritesCheckBox")
    $PlayStream = GUICtrlCreateButton("Start Stream", 195, 430, 180, 30)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_StartStream")
    GUICtrlCreateTabItem("Favorites")
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Online", 70, 85, 80)
    GUICtrlSetFont(-1, 18)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlCreateLabel("Offline", 285, 85, 80)
    GUICtrlSetFont(-1, 18)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $FavoriteListOnline = GUICtrlCreateList("", 20, 120, 200, 350)
    GUICtrlSetOnEvent(-1, "_OnlineSelected")
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $FavoriteListOffline = GUICtrlCreateList("", 230, 120, 200, 350)
    GUICtrlSetOnEvent(-1, "_OfflineSelected")
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetData($FavoriteList, "")
    $RefreshButton = GUICtrlCreateButton("Refresh", 435, 140, 140, 30)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_RefreshFavoritesList")
    $StartStreamButton = GUICtrlCreateButton("Start Stream", 435, 220, 140, 30)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_StartStream2")
    $RemoveButton = GUICtrlCreateButton("Remove Stream", 435, 300, 140, 30)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_RemoveStream")
    $EditButton = GUICtrlCreateButton("Edit Stream", 435, 390, 140, 30)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_EditStream")
    $FavoritesList = IniReadSectionNames(@ScriptDir & "\Data\StreamInfo.ini")
    For $i = 2 To $FavoritesList[0]
        $URLLink = IniRead(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "URL", "NotFound")
        $Split = StringSplit($URLLink, "tv/", 1)
        $Url = 'https://api.twitch.tv/kraken/streams/' & $Split[UBound($Split) - 1]
        Global $sSource = BinaryToString(InetRead($Url))
        If StringInStr($sSource, '"stream":null') Then
            GUICtrlSetData($FavoriteListOffline, $FavoritesList[$i])
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "Status", "Offline")
        Else
            GUICtrlSetData($FavoriteListOnline, $FavoritesList[$i])
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "Status", "Online")
        EndIf
    Next
    GUICtrlCreateTabItem("Chat Options")
    GUICtrlCreateLabel("Enable Chat", 220, 80, 120)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetFont(-1, 16)
    $CheckBoxForChat = GUICtrlCreateCheckbox("", 270, 115, 15, 20)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    GUICtrlSetOnEvent(-1, "_EnableChatCheckbox")
    If $RunChat = "N" Then
        GUICtrlSetState($CheckBoxForChat, $GUI_UNCHECKED)
    Else
        GUICtrlSetState($CheckBoxForChat, $GUI_CHECKED)
    EndIf
    GUISetState()
EndFunc   ;==>_ShowGui

Func _OnlineSelected()
    GUICtrlSetData($FavoriteListOffline, "")
    $FavoritesList = IniReadSectionNames(@ScriptDir & "\Data\StreamInfo.ini")
    For $i = 2 To $FavoritesList[0]
        $CheckStatus = IniRead(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "Status", "NotFound")
        If $CheckStatus = "Offline" Then
            GUICtrlSetData($FavoriteListOffline, $FavoritesList[$i])
        Else
            Sleep(10)
        EndIf
    Next
EndFunc   ;==>_OnlineSelected

Func _OfflineSelected()
    GUICtrlSetData($FavoriteListOnline, "")
    $FavoritesList = IniReadSectionNames(@ScriptDir & "\Data\StreamInfo.ini")
    For $i = 2 To $FavoritesList[0]
        $CheckStatus = IniRead(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "Status", "NotFound")
        If $CheckStatus = "Online" Then
            GUICtrlSetData($FavoriteListOnline, $FavoritesList[$i])
        Else
            Sleep(10)
        EndIf
    Next
EndFunc   ;==>_OfflineSelected


Func _RefreshFavoritesList()
    GUICtrlSetData($FavoriteListOffline, "")
    GUICtrlSetData($FavoriteListOnline, "")
    $FavoritesList = IniReadSectionNames(@ScriptDir & "\Data\StreamInfo.ini")
    For $i = 2 To $FavoritesList[0]
        $URLLink = IniRead(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "URL", "NotFound")
        $Split = StringSplit($URLLink, "tv/", 1)
        $Url = 'https://api.twitch.tv/kraken/streams/' & $Split[UBound($Split) - 1]
        Global $sSource = BinaryToString(InetRead($Url))
        If StringInStr($sSource, '"stream":null') Then
            GUICtrlSetData($FavoriteListOffline, $FavoritesList[$i])
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "Status", "Offline")
        Else
            GUICtrlSetData($FavoriteListOnline, $FavoritesList[$i])
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $FavoritesList[$i], "Status", "Online")
        EndIf
    Next
EndFunc   ;==>_RefreshFavoritesList

Func _FavoritesCheckBox()
    $CheckCheckBox = GUICtrlRead($AddToFavoritesCheckBox, 0)
    If $CheckCheckBox = 1 Then
        $FavoriteStream = "1"
    Else
        $FavoriteStream = "0"
    EndIf
EndFunc   ;==>_FavoritesCheckBox

Func _EnableChatCheckbox()
    $CheckCheckBox = GUICtrlRead($CheckBoxForChat, 0)
    If $CheckCheckBox = 1 Then
        $RunChat = "Y"
        IniWrite(@ScriptDir & "\Data\Preferences.ini", "Preferences", "ChatEnabled", "Y")
    Else
        $RunChat = "N"
        IniWrite(@ScriptDir & "\Data\Preferences.ini", "Preferences", "ChatEnabled", "N")
    EndIf
EndFunc   ;==>_EnableChatCheckbox

Func _EnableBrowserChatCheckbox()
    $CheckCheckBox = GUICtrlRead($CheckBoxForBrowserChat, 0)
    If $CheckCheckBox = 1 Then
        $ChatType = "Browser"
        IniWrite(@ScriptDir & "\Data\Preferences.ini", "Preferences", "ChatPref", "Browser")
;~      GuiCtrlSetState($CheckBoxForHexChat, $GUI_UNCHECKED)
    EndIf
EndFunc   ;==>_EnableBrowserChatCheckbox

;~ Func _EnableHexChatCheckbox()
;~  $CheckCheckBox = GUICtrlRead($CheckBoxForHexChat, 0)
;~  If $CheckCheckBox = 1 Then
;~      $ChatType = "Hex"
;~      IniWrite(@ScriptDir & "\Data\Preferences.ini", "Preferences", "ChatPref", "Hex")
;~      GuiCtrlSetState($CheckBoxForBrowserChat, $GUI_UNCHECKED)
;~  EndIf
;~ EndFunc   ;==>_EnableHexChatCheckbox


Func _QualityCheckBox1()
    $Quality = "Mobile"
    $CheckCheckBox = GUICtrlRead($MobileQuality, 0)
    If $CheckCheckBox = 1 Then
        GUICtrlSetState($LowQuality, $GUI_UNCHECKED)
        GUICtrlSetState($MediumQuality, $GUI_UNCHECKED)
        GUICtrlSetState($HighQuality, $GUI_UNCHECKED)
        GUICtrlSetState($SourceQuality, $GUI_UNCHECKED)
    EndIf
EndFunc   ;==>_QualityCheckBox1

Func _QualityCheckBox2()
    $Quality = "Low"
    $CheckCheckBox = GUICtrlRead($LowQuality, 0)
    If $CheckCheckBox = 1 Then
        GUICtrlSetState($MobileQuality, $GUI_UNCHECKED)
        GUICtrlSetState($MediumQuality, $GUI_UNCHECKED)
        GUICtrlSetState($HighQuality, $GUI_UNCHECKED)
        GUICtrlSetState($SourceQuality, $GUI_UNCHECKED)
    EndIf
EndFunc   ;==>_QualityCheckBox2

Func _QualityCheckBox3()
    $Quality = "Medium"
    $CheckCheckBox = GUICtrlRead($MediumQuality, 0)
    If $CheckCheckBox = 1 Then
        GUICtrlSetState($MobileQuality, $GUI_UNCHECKED)
        GUICtrlSetState($LowQuality, $GUI_UNCHECKED)
        GUICtrlSetState($HighQuality, $GUI_UNCHECKED)
        GUICtrlSetState($SourceQuality, $GUI_UNCHECKED)
    EndIf
EndFunc   ;==>_QualityCheckBox3

Func _QualityCheckBox4()
    $Quality = "High"
    $CheckCheckBox = GUICtrlRead($HighQuality, 0)
    If $CheckCheckBox = 1 Then
        GUICtrlSetState($MobileQuality, $GUI_UNCHECKED)
        GUICtrlSetState($LowQuality, $GUI_UNCHECKED)
        GUICtrlSetState($MediumQuality, $GUI_UNCHECKED)
        GUICtrlSetState($SourceQuality, $GUI_UNCHECKED)
    EndIf
EndFunc   ;==>_QualityCheckBox4

Func _QualityCheckBox5()
    $Quality = "Source"
    $CheckCheckBox = GUICtrlRead($SourceQuality, 0)
    If $CheckCheckBox = 1 Then
        GUICtrlSetState($MobileQuality, $GUI_UNCHECKED)
        GUICtrlSetState($LowQuality, $GUI_UNCHECKED)
        GUICtrlSetState($MediumQuality, $GUI_UNCHECKED)
        GUICtrlSetState($HighQuality, $GUI_UNCHECKED)
    EndIf
EndFunc   ;==>_QualityCheckBox5

Func _StartStream()
    $StreamLink = GUICtrlRead($StreamLinkInput)
    If $FavoriteStream = "1" Then
        $CheckFavoritesList = IniReadSectionNames(@ScriptDir & "\Data\StreamInfo.ini")
        For $i = 1 To $CheckFavoritesList[0] - 1
            $CheckUrl = IniReadSection(@ScriptDir & "\Data\StreamInfo.ini", $CheckFavoritesList[$i])
            If $CheckUrl[1][1] = $StreamLink Then
                MsgBox(48, "Duplicate", "Duplicate stream found, please remove the pre-existing one before favoriting this again!")
                $FavoriteStream = "0"
                GUICtrlSetState($AddToFavoritesCheckBox, $GUI_UNCHECKED)
                ExitLoop
            EndIf
        Next
    EndIf
    If $FavoriteStream = "1" Then
        While $InputStreamName = ""
            $InputStreamName = InputBox("Livestreamer Pro", "Please input a name that you would like to use for this stream.")
        WEnd
        IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $InputStreamName, "URL", $StreamLink)
        IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $InputStreamName, "Quality", $Quality)
        IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $InputStreamName, "Status", "Online")
    EndIf
    $CheckStream = MsgBox(4, "LiveStreamer Pro", "Launching Stream " & @CRLF & $StreamLink & @CRLF & @CRLF & "With quality setting " & $Quality & @CRLF & "Is this correct?")
    If $CheckStream = 6 Then
        Run("livestreamer " & $StreamLink & " " & $Quality)
        If $RunChat = "Y" Then
            $StreamChat = $StreamLink & "\chat?popout="
            _RunChat()
        EndIf
    Else
        Sleep(10)
    EndIf
    $InputStreamName = ""
EndFunc   ;==>_StartStream

Func _StartStream2()
    $GetStreamInfo = GUICtrlRead($FavoriteListOnline)
    If $GetStreamInfo = "" Then
        MsgBox(48, "Error", "No item selected or an offline stream was attempted to start!")
    Else
        $StreamLink = IniReadSection(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
        $CheckStream = MsgBox(4, "LiveStreamer Pro", "Launching Stream " & @CRLF & $StreamLink[1][1] & @CRLF & @CRLF & "With quality setting " & $StreamLink[2][1] & @CRLF & "Is this correct?")
        If $CheckStream = 6 Then
            Run("livestreamer " & $StreamLink[1][1] & " " & $StreamLink[2][1])
            If $RunChat = "Y" Then
                $StreamChat = $StreamLink[1][1] & "\chat?popout="
                _RunChat()
            EndIf
        Else
            Sleep(10)
        EndIf
    EndIf
EndFunc   ;==>_StartStream2

Func _RemoveStream()
    $GetStreamInfo = GUICtrlRead($FavoriteListOnline)
    If $GetStreamInfo = "" Then
        $GetStreamInfo = GUICtrlRead($FavoriteListOffline)
        $CheckRemove = MsgBox(4, "LiveStreamer Pro", "Are you sure you wish to remove " & $GetStreamInfo & "?")
        If $CheckRemove = 6 Then
            IniDelete(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
            _RefreshFavoritesList()
        Else
            Sleep(10)
        EndIf
    Else
        $CheckRemove = MsgBox(4, "LiveStreamer Pro", "Are you sure you wish to remove " & $GetStreamInfo & "?")
        If $CheckRemove = 6 Then
            IniDelete(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
            _RefreshFavoritesList()
        Else
            Sleep(10)
        EndIf
    EndIf
EndFunc   ;==>_RemoveStream

Func _EditStream()
    $GetStreamInfo = GUICtrlRead($FavoriteListOnline)
    If $GetStreamInfo = "" Then
        $GetStreamInfo = GUICtrlRead($FavoriteListOffline)
        $CheckEdit = MsgBox(4, "LiveStreamer Pro", "Do you want to edit the stream " & $GetStreamInfo & "?")
        If $CheckEdit = 6 Then
            $StreamLink = IniReadSection(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
            $NewName = InputBox("LiveStreamer Pro", "What name would you like to give this stream?", $GetStreamInfo)
            $NewLink = InputBox("LiveStreamer Pro", "What URL would you like to assign to this stream?", $StreamLink[1][1])
            $NewQuality = InputBox("LiveStreamer Pro", "What quality did you want to give this stream?", $StreamLink[2][1])
            IniDelete(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $NewName, "URL", $NewLink)
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $NewName, "Quality", $NewQuality)
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $NewName, "Status", "Offline")
            _RefreshFavoritesList()
        EndIf
    Else
        $CheckEdit = MsgBox(4, "LiveStreamer Pro", "Do you want to edit the stream " & $GetStreamInfo & "?")
        If $CheckEdit = 6 Then
            $StreamLink = IniReadSection(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
            $NewName = InputBox("LiveStreamer Pro", "What name would you like to give this stream?", $GetStreamInfo)
            $NewLink = InputBox("LiveStreamer Pro", "What URL would you like to assign to this stream?", $StreamLink[1][1])
            $NewQuality = InputBox("LiveStreamer Pro", "What quality did you want to give this stream?", $StreamLink[2][1])
            IniDelete(@ScriptDir & "\Data\StreamInfo.ini", $GetStreamInfo)
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $NewName, "URL", $NewLink)
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $NewName, "Quality", $NewQuality)
            IniWrite(@ScriptDir & "\Data\StreamInfo.ini", $NewName, "Status", "Online")
            _RefreshFavoritesList()
        EndIf
    EndIf
EndFunc   ;==>_EditStream

Func _RunChat()
    If $ChatType = "Browser" Then
        ShellExecute($StreamChat)
    EndIf
;~  ElseIf $ChatType = "Hex" Then
;~      WinActivate("HexChat")
;~      WinWait("HexChat")
;~      Send("/join # ")
;~      $GetChannel = StringRegExp($StreamChat, "(?i)(?s).tv/(.*?)/", 1)
;~      Send($GetChannel)
;~      Sleep(500)
;~      Send("{Enter}")
;~  EndIf
EndFunc   ;==>_RunChat

Func _Donation()
    ShellExecute($PayPalLink)
EndFunc   ;==>_Donation


Func _BrowseRefresh()
    _IEAction($oIE, "refresh")
EndFunc   ;==>_BrowseRefresh

Func _BrowseHome()
    _IENavigate($oIE, "http://www.twitch.tv/directory")
EndFunc   ;==>_BrowseHome


Func _Tray()
    If WinExists("LiveStreamer Pro") Then
        GUISetState(@SW_HIDE, $LiveStreamGui)
    EndIf
EndFunc   ;==>_Tray

Func _Show()
    GUISetState(@SW_SHOW, $LiveStreamGui)
EndFunc   ;==>_Show


Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _GetLinks()
    $Link = _IEPropertyGet($oIE, "locationurl")
    $Strip1 = StringReplace($Link, "directory#/", "")
    ClipPut($Strip1)
    MsgBox(0, "LiveStreamer Pro", "Copying the following link to your clipboard.." & @CRLF & @CRLF & $Strip1)
EndFunc   ;==>_GetLinks

While 1
    $Msg = GUICtrlRead($TabList)
    If $Msg > 0 Then
        If $TabChanged = 0 Then
            If WinExists("LiveStreamer Pro") Then
                _IENavigate($oIE, "blank")
                $TabChanged = 1
            EndIf
        EndIf
    Else
        If WinExists("LiveStreamer Pro") Then
            If $TabChanged = 1 Then
                _IENavigate($oIE, "http://www.twitch.tv/directory")
                $TabChanged = 0
            EndIf
        EndIf
    EndIf
    Sleep(10)
WEnd


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites

Damein,

The loop only needs to have Sleep in it as the tab control does fire an event and thus reading the tab control in the loop is just using extra resources for no good reason that I can observe with testing.

Here is code I would use as a replacement

GUICtrlSetOnEvent($TabList, "_TabChange")
;...
While 1
    Sleep(10)
WEnd

Func _TabChange()
    Dim $oIE, $TabList
    Local Static $TabMain = 0, $TabRecorded = 0
    ; get current tab
    Local $TabCurrent = GUICtrlRead($TabList)
    ; check if current tab is main tab
    If $TabCurrent = $TabMain Then
        ; if main tab (current) is not same as recorded then use _IENavigate
        If $TabRecorded <> $TabMain Then _IENavigate($oIE, "http://www.twitch.tv/directory")
    Else ; if current tab is not main tab
        ; only use _IENavigate if recorded is main tab
        If $TabRecorded = $TabMain Then _IENavigate($oIE, "about:blank")
    EndIf
    ; record current tab
    $TabRecorded = $TabCurrent
EndFunc

Notice the "about:blank" navigation used instead of "blank". The "blank" causes a incorrect address timeout and slows down the code. The "about:blank" is instant with no slowdown. The tab change event seems reasonable to me and the loop looks quite sleepy now.

You do have a label overlapping the tabs and you do have list box controls going below the tab control on Windows 7 here. Not major concerns though you may want to correct them.

The script uses quite some memory as you mentioned but seems quite stable e.g. no rises of memory consumption outside of expected range that I noticed. You can take that as a compliment. :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0