Jump to content

my old program wants a face lift....


Recommended Posts

hi guys, a while i wrote a programe called x-launcher.....

and its time for a face lift..... like sliding windows..

so if anyone wants to try and re mod my prog. feel free....

just curious as to what u guys can come up with....

#include<Array.au3>
#include<GuiImageList.au3>
#include<GuiListView.au3>
#include<Misc.au3>
#include<String.au3>
#include<ButtonConstants.au3>
#include<GUIConstantsEx.au3>
#include<ListViewConstants.au3>
#include<StructureConstants.au3>
#include<WindowsConstants.au3>
#include<WinAPI.au3>
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=X-Launch.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Opt("GUIOnEventMode", 1)
Opt("TrayIconHide", 1)

$a = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "X-Launch")
;if it doesn't write it

If @error = -1 Then
    ConsoleWrite("attempting Regwrite " & $a & @LF)
    If RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "X-L", "REG_SZ", @ScriptDir & "\X-Launch.exe") <> 1 Then

        If @error = 1 Then
            MsgBox(0, "Error", "Unable to save to requested key", 2)
        ElseIf @error = 2 Then
            MsgBox(0, "Error", "unable to save main key.", 2)
        ElseIf @error = 3 Then
            MsgBox("Error", "Unable to remote connect to the registry", 2)
        ElseIf @error = -1 Then
            MsgBox("Error", "Unable to save requested value", 2)
        ElseIf @error = -2 Then
            MsgBox("Error", "Value type not supported,", 2)
        EndIf
    EndIf
EndIf



If WinExists("X-L") = 1 Then
    MsgBox(0, "DOH", "Already running", 0)
    Exit
EndIf


$inifile = @MyDocumentsDir & "\X Launcher.ini"

Global $gui_active, $set, $last
Global $WM_DROPFILES = 0x233
Global $gaDropFiles[1], $buttons
Global $mini, $win, $sel, $ms_, $xp, $yp, $lost, $pth, $re_, $sct, $network, $strings, $network_f

$buttons = 10
;$WS_BORDER+$WS_POPUP,$WS_EX_TOOLWINDOW+$WS_EX_TOPMOST
$XL = GUICreate("X-L", 204, $buttons * 42, 320, 300, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES, $WS_EX_TOPMOST));44 fist size then 204
GUISetBkColor(0xC8C8FF, $XL)


Dim $Pic1[$buttons + 1]
Dim $but[$buttons + 1]
$network_f = False
$network = True

$y = 0
$gui_active = True
$size = 1
$mini = 0

For $ct = 1 To $buttons
    $Pic1[$ct] = GUICtrlCreateLabel("", 2, 2 + $y, 40, 40)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetResizing(-1, $GUI_DOCKALL)
    $but[$ct] = GUICtrlCreateButton("", 6, 6 + $y, 32, 32, $BS_ICON)
    GUICtrlSetOnEvent(-1, "pressed")
    GUICtrlSetResizing(-1, $GUI_DOCKALL)
    GUICtrlSetState(-1, $GUI_NODROPACCEPTED)
    $b1 = GUICtrlCreateContextMenu($but[$ct])
    $b2 = GUICtrlCreateMenuItem("Change", $b1)
    GUICtrlSetOnEvent(-1, "change_icon")
    $y += 42
Next


ConsoleWrite("hlistview")


$hListView = GUICtrlCreateListView("", 46, 2, 155, 418, $LVS_LIST, $WS_EX_CLIENTEDGE)


GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT))

$hImage = _GUIImageList_Create(32, 32)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetView($hListView, 3)

$menu1 = GUICtrlCreateContextMenu($hListView)
$delete = GUICtrlCreateMenuItem("Remove", $menu1)
GUICtrlSetOnEvent(-1, "delete")
$rename = GUICtrlCreateMenuItem("Rename", $menu1)
GUICtrlSetOnEvent(-1, "Rename")
$info = GUICtrlCreateMenuItem("Path", $menu1)
GUICtrlSetOnEvent(-1, "Info")



For $u = 1 To $buttons
    $ri = IniRead($inifile, "icons", $u, "")
    If $ri <> "" Then
        GUICtrlSetImage($but[$u], $ri, 0, 1)
    ElseIf $ri = "" And $u = 1 Then
        GUICtrlSetImage($but[1], @ScriptDir & "\icons\094_imageres.ico", 0, 1);question mark
    ElseIf $ri = "" And $u = 2 Then
        GUICtrlSetImage($but[2], @ScriptDir & "\icons\1_gcdef.ico", 0, 1);game
    ElseIf $ri = "" And $u = 3 Then
        GUICtrlSetImage($but[3], @ScriptDir & "\icons\1_Au3InfoA.ico", 0, 1);autoit
    ElseIf $ri = "" And $u = 4 Then
        GUICtrlSetImage($but[4], @ScriptDir & "\icons\017_imageres.ico", 0, 1);score
    ElseIf $ri = "" And $u = 5 Then
        GUICtrlSetImage($but[5], @ScriptDir & "\icons\147_imageres.ico", 0, 1);burn
    ElseIf $ri = "" And $u = 6 Then
        GUICtrlSetImage($but[6], @ScriptDir & "\icons\15_connect.ico", 0, 1);web
    ElseIf $ri = "" And $u = 7 Then
        GUICtrlSetImage($but[7], @ScriptDir & "\icons\1_mmc.ico", 0, 1);tools
    ElseIf $ri = "" And $u = 8 Then
        GUICtrlSetImage($but[8], @ScriptDir & "\icons\1_mmci.ico", 0, 1);sound
    ElseIf $ri = "" And $u = 9 Then
        GUICtrlSetImage($but[9], @ScriptDir & "\icons\1_mspaint.ico", 0, 1);paint
    ElseIf $ri = "" And $u = 10 Then
        GUICtrlSetImage($but[10], @ScriptDir & "\icons\10_oobefldr.ico", 0, 1);video
    EndIf
Next

ConsoleWrite("reg msg ")
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")

GUISetOnEvent($GUI_EVENT_DROPPED, "Dropped", $XL)
GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$win = WinGetPos("X-L")

If FileExists($inifile) = 1 Then

    $rd_set = IniRead($inifile, "config", 1, "not")
    If $rd_set <> "not" Then
        $set = $rd_set
        $last = $rd_set
        GUICtrlSetBkColor($Pic1[$set], 0xFF0000)
    Else
        $set = 1
        $last = 1
        GUICtrlSetBkColor($Pic1[$set], 0xFF0000)
    EndIf
    $rd_ = IniRead($inifile, "config", 0, "")
    If $rd_ <> "0" Then
        $ss3 = StringSplit($rd_, "|")

        WinMove("X-L", "", $ss3[1], $ss3[2])
        GUISetState(@SW_SHOW)
    Else
        GUISetState(@SW_SHOW)
    EndIf
    ConsoleWrite("Before load" & @LF)
    load()
    ConsoleWrite("after load" & @LF)
Else
    ConsoleWrite("else" & @LF)
    GUISetState(@SW_SHOW)
    $set = 1
    $last = 1
    GUICtrlSetBkColor($Pic1[$set], 0xFF0000)
    For $c_ = 1 To 10
        IniWrite($inifile, $c_, 0, 0)

    Next
    IniWrite($inifile, "config", 0, 0)
    If IniWrite($inifile, "config", 1, 1) = 1 Then
        MsgBox(0, "", "You inifile has been created successfully", 0)
    Else
        MsgBox(32, "Error", "Failed to create inifile, Please insure you have Admin priviledges", 0)
    EndIf

EndIf
ConsoleWrite("got to while")

While 1
    Sleep(50)
    If $win[1] < 0 Then
        WinMove("X-L", "", $win[0], 0, $win[2], $win[3])
    ElseIf $win[1] > @DesktopHeight - $win[3] Then
        WinMove("X-L", "", $win[0], @DesktopHeight - $win[3], $win[2], $win[3])
    ElseIf $win[0] < 0 Then
        WinMove("X-L", "", 0, $win[1], $win[2], $win[3])
    ElseIf $win[0] > @DesktopWidth - $win[2] Then
        WinMove("X-L", "", @DesktopWidth - $win[2], $win[1], $win[2], $win[3])
    EndIf
    If WinActive("X-L") = 0 And $gui_active = False And $mini = 0 Then
        $win = WinGetPos("X-L")
        WinMove("X-L", "", $win[0], $win[1], $win[2], $win[3] - ($buttons * 42), 0)
        $mini = 1
    ElseIf WinActive("X-L") = 1 And $gui_active = False And $mini = 1 Then
        $win = WinGetPos("X-L")
        WinMove("X-L", "", $win[0], $win[1], $win[2], $win[3] + ($buttons * 42), 0)
        $mini = 0
    EndIf
    $win = WinGetPos("X-L")
    $ms = MouseGetPos()
    ;   if $mini=1 and $ms[0]>10 and $ms[0]<@DesktopWidth-40 then WinMove("X-L","",$ms[0]-10,0)  ;gui mouse follow

    If $ms[0] > $win[0] And $ms[0] < $win[0] + $win[2] And $ms[1] > $win[1] And $ms[1] < $win[1] + $win[3] And $gui_active = False And WinActive("X-L") = 0 Then
        WinActivate("X-L")
        $mini = 1

    EndIf
WEnd

Func pressed()
    Local $iD = @GUI_CtrlId
    ConsoleWrite("ID " & $iD / 4 & @LF)
    For $x = 1 To $buttons
        If $iD = $but[$x] Then
            GUICtrlSetBkColor($Pic1[(Int($iD / 4))], 0xFF0000)
            $set = Int($iD / 4)
        EndIf
        If $last <> $set Then GUICtrlSetBkColor($Pic1[$last], 0xC8C8FF)
    Next

    If $gui_active = True Then
        If $last = $set Then
            GUICtrlSetBkColor($Pic1[$set], 0xC8C8FF)
            $gui_active = False
            size_box()
        EndIf
    ElseIf $gui_active = False Then
        GUICtrlSetBkColor($Pic1[$set], 0xFF0000)
        $gui_active = True
        size_box()

    EndIf

    If $gui_active = True And $last <> $set Then
        _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
        load()
    EndIf
    $last = $set
    IniWrite($inifile, "config", 1, $set)

EndFunc   ;==>pressed

Func quit()
    $win = WinGetPos("X-L")
    IniWrite($inifile, "config", 0, $win[0] & "|" & $win[1])
    Exit
EndFunc   ;==>quit

Func size_box()
    $win = WinGetPos("X-L")
    If $gui_active = True Then
        WinMove("X-L", "", $win[0], $win[1], $win[2] + 160, $win[3])

    Else
        WinMove("X-L", "", $win[0], $win[1], $win[2] - 160, $win[3])
    EndIf
EndFunc   ;==>size_box

Func Dropped()
    $read = IniReadSection($inifile, $set)

    For $d = 0 To UBound($gaDropFiles) - 1
        ConsoleWrite("Dropped " & $gaDropFiles[$d] & @LF)
        $sct = ""
        If StringRight($gaDropFiles[$d], 4) = ".lnk" Then
            ConsoleWrite("LINK" & @LF)
            $FGS = FileGetShortcut($gaDropFiles[$d])
            ;_ArrayDisplay($FGS)
            For $c = 0 To 6
                ConsoleWrite("FGS[" & $c & "]" & $FGS[$c] & @LF)
            Next


            If $FGS[4] <> "" Then
                $sct = $FGS[4]
            ElseIf StringLeft($FGS[0], 2) = "\\" Then
                $file = $FGS[0]
            EndIf
            $file = $FGS[0]
        Else
            $file = $gaDropFiles[$d]
        EndIf

        ConsoleWrite("$sct>" & $sct & "  file>" & $file & @LF)

        If $file <> "" Then
            If FileExists($file) = 1 Then
                $ss = StringSplit($file, "\")
                $s_ = $ss[0]
                If StringInStr($ss[$s_], ".", 0, -1) > 0 Then
                    $str = StringTrimRight($ss[$s_], 4)
                Else
                    $str = $ss[$s_]

                EndIf
                If $sct = "" Then
                    If StringRight($file, 4) = ".mp3" Then
                        ConsoleWrite("MP3" & @LF)
                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\125_imageres.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, $str, $index)
                    ElseIf StringLeft($file, 2) = "\\" Then

                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\32_SyncCenter.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, $str, $index)
                    Else
                        ConsoleWrite("add image sct" & @LF)
                        $tst = _WinAPI_ExtractIconEx($file, 0, 0, 0, 0)
                        ConsoleWrite("tst  -->" & $tst & @LF)
                        If $tst <> 0 Then
                            $index = _GUIImageList_AddIcon($hImage, $file, 0, True)
                            _GUICtrlListView_AddItem($hListView, $str, $index)
                        Else
                            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\093_imageres.ico", 0, True)
                            _GUICtrlListView_AddItem($hListView, $str, $index)
                        EndIf
                    EndIf
                Else

                    If StringRight($file, 4) = ".mp3" Then
                        ConsoleWrite("2nd MP3" & @LF)
                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\125_imageres.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, $str, $index)
                    ElseIf StringLeft($file, 2) = "\\" Then

                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\224_shell32.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, $str, $index)
                    Else
                        ConsoleWrite("add image file" & @LF)
                        $index = _GUIImageList_AddIcon($hImage, $sct, 0, True)
                        _GUICtrlListView_AddItem($hListView, $str, $index)
                    EndIf
                EndIf


                If $read[0][0] = 1 And $read[1][1] = "0" Then
                    If $sct = "" Then
                        ConsoleWrite("1nd" & @LF)
                        IniWrite($inifile, $set, $d, $file)
                    Else
                        $ss = StringSplit($file, "\")
                        $s_ = $ss[0]
                        If StringInStr($ss[$s_], ".", 0, -1) > 0 Then
                            $str = StringTrimRight($ss[$s_], 4)
                        Else
                            $str = $ss[$s_]
                            ConsoleWrite("Kept String format 1st" & $str & @LF)
                        EndIf
                        ConsoleWrite("Saving 1st iniwrite" & @LF)
                        IniWrite($inifile, $set, ($read[0][0]) + $d, $sct & "|" & $str & "|" & $sct)
                    EndIf
                Else
                    If $sct = "" Then
                        If StringLeft($file, 2) = "\\" Then

                            ConsoleWrite("2nd" & @LF)
                            IniWrite($inifile, $set, ($read[0][0]) + $d, $gaDropFiles[$d])
                        Else
                            ConsoleWrite("3rd" & @LF)
                            IniWrite($inifile, $set, ($read[0][0]) + $d, $file)
                        EndIf

                    Else
                        $ss = StringSplit($file, "\")
                        $s_ = $ss[0]
                        If StringInStr($ss[$s_], ".", 0, -1) > 0 Then
                            $str = StringTrimRight($ss[$s_], 4)
                        Else
                            $str = $ss[$s_]
                            ConsoleWrite("Kept String format 2nd" & $str & @LF)
                        EndIf
                        ConsoleWrite("Saving 2nd iniwrite" & @LF)
                        IniWrite($inifile, $set, ($read[0][0]) + $d, $sct & "|" & $str & "|" & $sct)
                    EndIf
                EndIf
                If StringRight($gaDropFiles[$d], 4) = ".lnk" Then
                    FileCopy($gaDropFiles[$d], @DesktopDir & "\Shortcuts\", 9)
                    FileDelete($gaDropFiles[$d])
                EndIf
            Else
                $lost = $d
                lost()
            EndIf
        EndIf
    Next

EndFunc   ;==>Dropped

Func delete()
    IniDelete($inifile, $set, $sel)
    $read = IniReadSection($inifile, $set)
    If @error = 1 Then
        IniWrite($inifile, $set, 0, 0)
    Else
        IniDelete($inifile, $set)
        For $x = 1 To $read[0][0]
            IniWrite($inifile, $set, $x - 1, $read[$x][1])
        Next
    EndIf
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
    load()
EndFunc   ;==>delete

Func rename()
    $get = _GUICtrlListView_GetItemText($hListView, $sel)
    If StringInStr($get, "Error!") = 0 Then

        $re_ = GUICreate("???", 150, 30, $ms_[0], $ms_[1] - 15, $WS_POPUP, $WS_EX_TOPMOST)
        GUISetBkColor(0x000000, $re_)

        $inp = GUICtrlCreateInput("", 2, 2, 145, 25)
        GUICtrlSetBkColor(-1, 0xC8C8FF)
        GUICtrlSetFont(-1, 14)
        GUISetState(@SW_SHOW, $re_)

        Do
            Sleep(50)
            If _IsPressed("DC") And _IsPressed("10") Then
                MsgBox(0, "", "Do NOT use the | Key", 0)
                WinActivate("???")
                WinWaitActive("???")
                Send("{BACKSPACE}")
            EndIf
        Until _IsPressed("0D")
        $rd_ = IniRead($inifile, $set, $sel, "")
        If StringInStr($rd_, "|") = 0 Then
            IniWrite($inifile, $set, $sel, $rd_ & "|" & GUICtrlRead($inp))
            _GUICtrlListView_SetItemText($hListView, $sel, GUICtrlRead($inp))
        Else
            $ss2 = StringSplit($rd_, "|")
            If $ss2[0] = 2 Then
                IniWrite($inifile, $set, $sel, $ss2[1] & "|" & GUICtrlRead($inp))
            ElseIf $ss2[0] = 3 Then
                IniWrite($inifile, $set, $sel, $ss2[1] & "|" & GUICtrlRead($inp) & "|" & $ss2[3])
            EndIf

            _GUICtrlListView_SetItemText($hListView, $sel, GUICtrlRead($inp))
        EndIf

        GUIDelete($re_)
    Else
        MsgBox(0, "", "You cannot rename a broken link", 0)
    EndIf
EndFunc   ;==>rename

Func info()
    $g_clicked = False
    $re_ = GUICreate("???", 350, 30, $ms_[0], $ms_[1] - 15, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x000000, $re_)
    $inp = GUICtrlCreateLabel("", 2, 2, 300, 25)
    GUICtrlSetTip(-1, "Click to close")
    GUICtrlSetOnEvent(-1, "label_click")
    GUICtrlSetBkColor(-1, 0xC8C8FF)
    $go_ = GUICtrlCreateButton("GO", 302, 5, 45, 20)
    GUICtrlSetOnEvent(-1, "go")
    GUICtrlSetTip(-1, "Take me there")
    $rd_ = IniRead($inifile, $set, $sel, "")

    If StringInStr($rd_, "|") = 0 Then
        GUICtrlSetData($inp, $rd_)
        $ss3 = StringInStr($rd_, "\", 0, -1)
        $ss4 = StringTrimRight($rd_, StringLen($rd_) - $ss3)

        $pth = $ss4
    Else
        $ss2 = StringSplit($rd_, "|")
        GUICtrlSetData($inp, $ss2[1])
        $ss3 = StringInStr($ss2[1], "\", 0, -1)
        $ss4 = StringTrimRight($ss2[1], StringLen($ss2[1]) - $ss3)

        $pth = $ss4
    EndIf

    GUISetState(@SW_SHOW, $re_)

EndFunc   ;==>info

Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("char[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i + 1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
        $pFileName = 0
    Next
EndFunc   ;==>WM_DROPFILES_FUNC

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $iCode, $tInfo, $iItem
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $iCode
        Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
            $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
            If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
            $ir = IniRead($inifile, $set, DllStructGetData($tInfo, "Index"), "")
            If StringInStr($ir, "|") = 0 Then
                $ss3 = StringInStr($ir, "\", 0, -1)
                $ss4 = StringTrimRight($ir, StringLen($ir) - $ss3)
                $ms_ = MouseGetPos()
                $re_ = GUICreate("???", 160, 30, $ms_[0], $ms_[1] - 15, $WS_POPUP, $WS_EX_TOPMOST)
                GUISetBkColor(0x000000, $re_)

                $inp = GUICtrlCreateInput("", 2, 2, 155, 25)
                GUICtrlSetBkColor(-1, 0xff0000)
                GUICtrlSetFont(-1, 14)
                GUISetState(@SW_SHOW, $re_)
                GUICtrlSetData($inp,"PLEASE WAIT!!!")
                ShellExecute($ir, "", $ss4)
                Sleep(2000)
                GUIDelete($re_)
            Else
                $ss2 = StringSplit($ir, "|")
                $ss3 = StringInStr($ss2[1], "\", 0, -1)
                $ss4 = StringTrimRight($ss2[1], StringLen($ss2[1]) - $ss3)
                $ms_ = MouseGetPos()
                $re_ = GUICreate("???", 160, 30, $ms_[0], $ms_[1] - 15, $WS_POPUP, $WS_EX_TOPMOST)
                GUISetBkColor(0x000000, $re_)

                $inp = GUICtrlCreateInput("", 2, 2, 155, 25)
                GUICtrlSetBkColor(-1, 0xff00000)
                GUICtrlSetFont(-1, 14)
                GUISetState(@SW_SHOW, $re_)
                GUICtrlSetData($inp,"PLEASE WAIT!!!")
                ShellExecute($ss2[1], "", $ss4)
                Sleep(2000)
                guidelete($re_)
            EndIf


        Case $NM_RCLICK
            $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
            If $iItem = _GUICtrlListView_GetColumnCount($hListView) - 1 Then Return 1
            $sel = DllStructGetData($tInfo, "Index")
            $ms_ = MouseGetPos()
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func lost()
    ConsoleWrite("LOST" & @LF)
    $read = IniRead($inifile, $set, $lost, "")
    ConsoleWrite("read " & $read & @LF)
    If StringInStr($read, "|") = 0 Then
        $ss = StringSplit($read, "\")
        $s_ = $ss[0]
        $str = StringTrimRight($ss[$s_], 4)
        If StringLeft($read, 2) = "\\" Then
            ConsoleWrite("icon via 1st" & @LF)
            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\33_SyncCenter.ico", 0, True)
            _GUICtrlListView_AddItem($hListView, "Error! - " & $ss[$s_], $index)
        Else
            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\093_imageres.ico", 0, True)
            _GUICtrlListView_AddItem($hListView, "Error! - " & $str, $index)
        EndIf
    Else
        $ss2 = StringSplit($read, "|")
        If StringLeft($ss2[1], 2) = "\\" Then
            ConsoleWrite("icon via 2nd" & @LF)
            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\33_SyncCenter.ico", 0, True)
            _GUICtrlListView_AddItem($hListView, "Error! - " & $ss[$s_], $index)
        Else
            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\093_imageres.ico", 0, True)
            _GUICtrlListView_AddItem($hListView, "Error! - " & $ss2[2], $index)
        EndIf
    EndIf
EndFunc   ;==>lost

Func label_click()
    GUIDelete($re_)
EndFunc   ;==>label_click

Func go()
    GUIDelete($re_)
    ConsoleWrite(@LF & $pth & @LF)
    ShellExecute("Explorer", $pth)
EndFunc   ;==>go

Func load()

    $read = IniReadSection($inifile, $set)
    $network = True
    For $x = 1 To $read[0][0]

        If $read[$x][1] <> "0" Then


            If StringLeft($read[$x][1], 2) = "\\" Then

                $strings = _StringBetween($read[$x][1], "\\", "\")

                If Not @error Then
                    ConsoleWrite($strings[0] & "   " & $network_f & @LF)
                    If $strings[0] <> $network_f Then
                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\12_comres.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, "Checking Network", $index)

                        ConsoleWrite(" checking network " & $strings[0] & @LF)
                        $ping = Ping($strings[0], 2000)
                        If $ping = 0 Then
                            $network = False

                        Else
                            $network = True
                        EndIf
                        $network_f = $strings[0]
                        ConsoleWrite("Ping complete " & @LF)
                        _GUICtrlListView_DeleteItem(GUICtrlGetHandle($hListView), $x - 1)
                    EndIf
                EndIf
            Else
                $network = True
            EndIf

            If StringInStr($read[$x][1], "|") = 0 And $network = True Then
                If FileExists($read[$x][1]) = 1 Then
                    $ss = StringSplit($read[$x][1], "\")
                    $s_ = $ss[0]
                    $str = StringTrimRight($ss[$s_], 4)
                    ConsoleWrite($x & "X<---    1st on load()" & @LF)
                    If StringRight($read[$x][1], 4) = ".mp3" Then
                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\125_imageres.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, $str, $index)
                    ElseIf StringLeft($read[$x][1], 2) = "\\" Then
                        $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\32_SyncCenter.ico", 0, True)
                        _GUICtrlListView_AddItem($hListView, $ss[$s_], $index)
                    Else
                        $tst = _WinAPI_ExtractIconEx($read[$x][1], 0, 0, 0, 0)
                        If $tst <> 0 Then
                            $index = _GUIImageList_AddIcon($hImage, $read[$x][1], 0, True)
                            _GUICtrlListView_AddItem($hListView, $str, $index)
                        Else
                            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\23_wmploc.ico", 0, True)
                            _GUICtrlListView_AddItem($hListView,$read[$x][1], $index)
                        EndIf
                    EndIf
                Else
                    $lost = $x - 1
                    ConsoleWrite("Before lost" & @LF)
                    lost()
                EndIf
            ElseIf $network = True Then
                $ss2 = StringSplit($read[$x][1], "|")
                $ss2_ = $ss2[0]
                If FileExists($ss2[1]) = 1 Then
                    ConsoleWrite("2nd on load() " & @LF)
                    If $ss2[0] = 3 Then
                        ConsoleWrite($x & "X<---    2nd on load()  1st if " & @LF)
                        $index = _GUIImageList_AddIcon($hImage, $ss2[3], 0, True)
                        _GUICtrlListView_AddItem($hListView, $ss2[2], $index)

                    Else
                        If StringRight($ss2[1], 4) = ".mp3" Then
                            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\125_imageres.ico", 0, True)
                            _GUICtrlListView_AddItem($hListView, $ss2[2], $index)
                        ElseIf StringLeft($ss2[1], 2) = "\\" Then
                            $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\32_SyncCenter.ico", 0, True)
                            _GUICtrlListView_AddItem($hListView, $ss[$s_], $index)
                        Else
                            $tst = _WinAPI_ExtractIconEx($ss2[1], 0, 0, 0, 0)
                            If $tst <> 0 Then
                                $index = _GUIImageList_AddIcon($hImage, $ss2[1], 0, True)
                                _GUICtrlListView_AddItem($hListView, $ss2[2], $index)
                            Else
                                $index = _GUIImageList_AddIcon($hImage, @ScriptDir & "\icons\23_wmploc.ico", 0, True)
                                _GUICtrlListView_AddItem($hListView, $ss2[$ss2_], $index)
                            EndIf
                        EndIf
                    EndIf
                Else
                    $lost = $x - 1
                    lost()
                EndIf
            ElseIf $network = False Then
                $lost = $x - 1
                lost()
            EndIf

        EndIf

    Next
    ;_GUICtrlListView_SortItems(GUICtrlGetHandle($hListView),1)
EndFunc   ;==>load

Func change_icon()
    Local $iD = @GUI_CtrlId
    ConsoleWrite("ID " & Int($iD / 4) & @LF)
    $fo = FileOpenDialog("Chose an Icon", "", "Icons(*.ico)")
    If Not @error Then
        GUICtrlSetImage($but[Int($iD / 4)], $fo, 0, 1)
        FileCopy($fo, @ScriptDir & "\Icons", 0)
        $z0 = StringSplit($fo, "\")
        $z1 = $z0[0]

        IniWrite($inifile, "icons", Int($iD / 4), @ScriptDir & "\icons\" & $z0[$z1])
    EndIf
EndFunc   ;==>change_icon
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...