ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


4 posters

    case $msg=$listview ทำไมทำไม่ได้

    avatar
    pureexe
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty
    จำนวนข้อความ : 73
    ความนิยม : 8
    เข้าร่วมเมื่อ : 27/04/2011

    case $msg=$listview ทำไมทำไม่ได้ Empty case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by pureexe 19/11/11, 12:26 pm

    หลังจากได้เปลี่ยน listbox เป็น listview แน่นอนว่าแสดงรูปได้
    แต่ listbox มันใช้ case $msg=$lisbox ได้
    แล้วทำไม listview มันทำไม่ได้ เกิดอะไรขึ้น?? แก้ยังไง ??
    avatar
    Fast
    PSsix Member Super Class III
    PSsix Member Super Class III


    case $msg=$listview ทำไมทำไม่ได้ Empty PSsix Program Coder
    จำนวนข้อความ : 217
    ความนิยม : 54
    เข้าร่วมเมื่อ : 19/06/2011

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by Fast 19/11/11, 02:02 pm

    จะทำอะไร งง???? ไหนโค๊ด em234 ListView ใช้ _GUICtrlListView โค๊ด ListBox ใช้_GUICtrlListBox คนละอย่างนิน่า
    avatar
    pureexe
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty
    จำนวนข้อความ : 73
    ความนิยม : 8
    เข้าร่วมเมื่อ : 27/04/2011

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by pureexe 19/11/11, 06:40 pm

    หมายถึงคำสั่ง GUI get msg ตอนแรก ผมใช้list boxแล้วมัน จะ ทำงานใน caseแต่ admin ให้ใช้ list viewจะไดไม่มีปัญหาเรื่องรูป แต่ทว่า มันพอคลิกแล้วไม่ ยอมเข้าไปทำงานcase $ msg =$ listbox ผู้รู้ ช่วยด้วย
    max30012540
    max30012540
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty PSsix Program Coder
    จำนวนข้อความ : 98
    ความนิยม : 10
    เข้าร่วมเมื่อ : 10/10/2011
    อายุ : 26

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by max30012540 19/11/11, 07:40 pm

    pureexe พิมพ์ว่า:หมายถึงคำสั่ง GUI get msg ตอนแรก ผมใช้list boxแล้วมัน จะ ทำงานใน caseแต่ admin ให้ใช้ list viewจะไดไม่มีปัญหาเรื่องรูป แต่ทว่า มันพอคลิกแล้วไม่ ยอมเข้าไปทำงานcase $ msg =$ listbox ผู้รู้ ช่วยด้วย
    ผมว่าเอาโค้ดเต็มๆมาให้ดูดีกว่าครับ ผมว่าคนตอบก็คงจะไม่ค่อยเข้าใจคำถามซักเท่าไรถ้าไม่มีโค้ดเต็มๆ
    POS
    POS
    PSsix
    PSsix


    case $msg=$listview ทำไมทำไม่ได้ Empty case $msg=$listview ทำไมทำไม่ได้ Empty case $msg=$listview ทำไมทำไม่ได้ Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by POS 20/11/11, 07:20 am

    คุณต้องการคลิกที่ชื่อโฟลเดอร์แล้วมีการนำเอาค่าชื่อโฟลเดอร์ไปใช้ ใช่หรือไม่ ถ้าใช่ ลองดูสคริปต์ด้านล่างนี้

    ถ้าไม่ใช่ก็ถามใหม่ แล้วนำโค้ดที่มีปัญหา และอธิบายความต้องการมาให้ชัดเจนที่สุดเท่าที่จะทำได้ ผมเห็นหลายท่านจะช่วยตอบ แต่ไม่รู้จะตอบอย่างไร เพราะอ่านคำถามของคุณแล้วไม่เข้าใจว่าต้องการอะไร แถมไม่มีโค้ดที่ติดปัญหาอะไรสักอย่าง จะให้คนอื่นมาไล่โค้ดเก่าของคุณ เป็นตัวคุณเอง ถ้าคนอื่นมาถามแบบนี้ คุณจะมีจิตอาสาถึงขนาดไปไล่ตรวจโค้ดช่วยแก้ให้หรือไม่

    ***หมายเหตุ ศึกษาดูคำสั่งในหมวด ListView ลองรันตัวอย่างคำสั่งแต่ละอันดูครับ แม้ไม่ได้ใช้ตอนนี้ แต่ก็มีประโยชน์เวลาจะเพิ่มเติมความสามารถ หรือทำโปรแกรมใหม่ภายหลัง


    Code:

    #include <WindowsConstants.au3>
    #include <GUIListBox.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>


    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("PSsix", 400, 300, -1, -1)
    $listview1 = GUICtrlCreateListView("", 2, 2, 394, 290, BitOR($WS_VSCROLL, $LBS_EXTENDEDSEL), _
          BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))

    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4)
    _GUICtrlListView_SetImageList($listview1, $hImage, 1)
    _GUICtrlListView_AddColumn($listview1, "คลิกเลือกโฟลเดอร์", 350)

    Global $s2
    $listF = @DesktopDir
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $listF = ' & $listF & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console


    SrFolder($listF)


    While 1
       Sleep(10)
       $nMsg = GUIGetMsg()
       Switch $nMsg
          Case $GUI_EVENT_CLOSE
             Exit
       EndSwitch

       $s1 = _GUICtrlListView_GetSelectedIndices($listview1)
       If $s1 <> "" And $s1 <> $s2 Then
          GUICtrlSetData($listview1, _GUICtrlListView_GetItemText(GUICtrlGetHandle($listview1), _GUICtrlListView_GetSelectedIndices($listview1)))
          $s2 = $s1
       EndIf

    WEnd



    Func SrFolder($listF)
       Local $search = FileFindFirstFile($listF & "\*.*")
       While 1
          $file = FileFindNextFile($search)
          If @error Or StringLen($file) < 1 Then ExitLoop
          If StringInStr(FileGetAttrib($listF & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
    ;~             _GUICtrlListView_AddItem($listview1, $listF & "\" & $file, 0)
             _GUICtrlListView_AddItem($listview1, $file, 0)
    ;~          SrFolder($listF & "\" & $file)
          EndIf
       WEnd
    EndFunc  ;==>SrFolder
    avatar
    pureexe
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty
    จำนวนข้อความ : 73
    ความนิยม : 8
    เข้าร่วมเมื่อ : 27/04/2011

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by pureexe 20/11/11, 02:55 pm

    code ของ admin ใช้ได้แล้วจะลองประยุกนะครับ ข้างล่างเป็นcodeผม em229
    อันนี้code ผมตอนเป็น Listbox (คลิกได้แต่ไม่มีรูปจะเป็นคำว่า<--folder-->ข้างหน้าแทนรูป)
    Code:

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <StaticConstants.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include<File.au3>

    Opt('MustDeclareVars', 1)
    Global $data,$ret,$file,$Folders,$retx,$Foldersx,$btchkx,$fileold[200],$dataview,$uvx=0,$hListBox,$aItems,$hImage,$iI,$ctopen=0,$ctopenstr="",$dirwrite="<---Folder--->  ",$dirwritelen=StringLen($dirwrite),$filelen,$Label_1,$Combo_2,$Buttonback
    Global $backword=">--กลับไปก่อนหน้า--<"
    _Main()

    Func _Main()
       Local $Label_1, $Combo_2, $button1, $msg,$Button2
    #Region ### START Koda GUI section ### Form=
    $ret  =""
    if $CmdLine[0]=0 Then
    $btchkx=MsgBox(4,"คำเตือน","ไม่พบการส่งค่าต้องการเลือกโฟลเดอร์เองหรือไม่")
    if $btchkx<>7 Then
    $file=FileSelectFolder("กรุณาเลือกfolderที่จะทำการดู","","","")
    Else
    Exit
    EndIf
    Else
    $file=$CmdLine[1]
    EndIf
    $Folders =_FileListToArray($file,"*.")
    for $i =1 to $Folders[0]
          $ret &=$Folders[$i] &"|"
          Next

    GUICreate("Explorer[Safe Mode]::Flash Drive Safe Check", 403, 470, -1, -1)
    $Label_1 = GUICtrlCreateLabel("Please select folder", -2, 0, 403, 21, $SS_SUNKEN)
    $Combo_2 = GUICtrlCreateCombo("", 0, 20, 402, 25)
       GUICtrlSetData($Combo_2, $ret)
    $hListBox = GUICtrlCreateList("", 0, 42, 404, 396, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
    $Button2 = GUICtrlCreateButton("เปิดไฟล์", 72, 442, 122, 20, $WS_GROUP)
    $Buttonback = GUICtrlCreateButton("Back", 200, 442, 122, 20, $WS_GROUP)
    _readfileall()
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
          $msg = GUIGetMsg()
          Select

             Case $msg = $GUI_EVENT_CLOSE
                Exit
             Case $msg = $Combo_2
                $data = GUICtrlRead($Combo_2)
                   $dataview=$data
                if $data = $backword And $uvx>0 then
                   $file = ""
                   $uvx=$uvx-1
                   $data =$fileold[$uvx]
                   $dataview=$fileold
                endif
                _readfileindir()
                   GUICtrlSetData($Combo_2, "")
                   GUICtrlSetData($Combo_2, $retx)
                   GUICtrlSetData($Label_1, $dataview)
                Case  $msg=$hListBox
                   $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
                   Local $stockaItems=""
                   if $aItems[0]<>0 Then
                   $filelen=StringLen($aItems[1])

                   If StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3) Then
                   for $i=$dirwritelen+1 to $filelen
                      $stockaItems&=StringMid($aItems[1],$i,1)
                   Next
                   $data=$stockaItems

                EndIf

                   if $ctopenstr<>$aItems[1] Then
                      $ctopen=0
                      Endif
                   $dataview=$data

                if $aItems[1] = $backword  And $uvx>0 then
                   $file = ""
                   $uvx=$uvx-1
                   $data =$fileold[$uvx]
                   $dataview=$fileold
                      _readfileindir()
                      GUICtrlSetData($Label_1, $dataview)
                            GUICtrlSetData($Combo_2, "")
                               GUICtrlSetData($Combo_2, $retx)
                endif

                      if $aItems[0]=1  And $ctopenstr=$aItems[1]  And $ctopen=1 And StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)Then
                            _readfileindir()
                      GUICtrlSetData($Label_1, $dataview)
                            GUICtrlSetData($Combo_2, "")
                               GUICtrlSetData($Combo_2, $retx)
                            ElseIf $aItems[0]=1  And $ctopenstr=$aItems[1]  And $ctopen=1 And $aItems[1]=$backword Then
                               $ctopenstr=""
                   elseif $aItems[0]=1  And $ctopenstr=$aItems[1]  And $ctopen=1 Then
                      ShellExecute($file&"\"&$aItems[1])
                      $ctopenstr=""
                      EndIf
                   if $aItems[0]=1  And $ctopenstr<>$aItems[1] And $ctopen=0 Then
                      $ctopenstr=$aItems[1]
                      $ctopen=1
                   EndIf
                   EndIf
                Case $msg=$Buttonback
                   If $uvx>0 Then
                   $file = ""
                   $uvx=$uvx-1
                   $data =$fileold[$uvx]
                   $dataview=$fileold
                _readfileindir()
                   GUICtrlSetData($Combo_2, "")
                   GUICtrlSetData($Combo_2, $retx)
                   GUICtrlSetData($Label_1, $dataview)
                   Else
                   MsgBox(64,"คำเตือน","ไม่สามารถกลับไปไกลได้มากกว่านี้อีกแล้ว")
                   EndIf


                   Case $msg=$Button2
                   if $aItems[0]=0  Then
                      MsgBox(64,"คำเตือน","คุณยังไม่ได้เลือกอะไรเลย")
                      ElseIf  (StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)) Then
                      MsgBox(64,"คำเตือน","เพื่อความปลอดภัยจึงไม่สามารถเปิดfolderได้")
                      Else
                      For $iI = 1 To $aItems[0]
                         ShellExecute($file&"\"&$aItems[$iI])
                         Next
                      EndIf

          EndSelect
       WEnd
    EndFunc

    Func _readfile()
          _GUICtrlListbox_BeginUpdate($hListBox)
       _GUICtrlListBox_ResetContent($hListBox)
       _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
       _GUICtrlListBox_Dir($hListBox, $file&"\*.*")

       _GUICtrlListBox_EndUpdate($hListBox)
       _GUICtrlListBox_Sort($hListBox)
       EndFunc

    Func _readfileall()
       $ret  =""
       $Folders =_FileListToArray($file,"*.*")
       $Foldersx =_FileListToArray($file,"*.")
       if $Foldersx="" Or $Folders="" Then
       Else
       #cs
       For $i=0  To $Folders[0]
          For $j=0  To $Foldersx[0]
             If $Folders[$i]=$Foldersx[$j] Then
                $Folders[$i]=$dirwrite&$Folders[$i]
             EndIf
          Next
       Next
       #ce
          For $i=1  To $Foldersx[0]
                $Foldersx[$i]=$dirwrite&$Foldersx[$i]
          Next
    EndIf


          _GUICtrlListBox_BeginUpdate($hListBox)

    _GUICtrlListBox_ResetContent($hListBox)
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
       if $Foldersx="" Then
             _GUICtrlListBox_Dir($hListBox, $file&"\*.*")
             Else
       for $i =1 to $Foldersx[0]
          _GUICtrlListBox_InsertString($hListBox,$Foldersx[$i])
       Next
       _GUICtrlListBox_Dir($hListBox, $file&"\*.*")
    EndIf
    if $uvx>0 Then
       _GUICtrlListBox_InsertString($hListBox,$backword)
    EndIf
       _GUICtrlListBox_EndUpdate($hListBox)
       _GUICtrlListBox_Sort($hListBox)
       EndFunc
       Func _readfileindir()
          $retx=""


                         if $file ="" Then
                            $file =$data
                            $fileold[$uvx]=$data
                         else

                            $fileold[$uvx]=$file
                            $uvx=$uvx+1
                         $file &="/"&$data
                      EndIf

                         $dataview=$file
                      GUICtrlSetData($Label_1, $dataview)
                         $Foldersx=""
                         $Foldersx =_FileListToArray($file,"*.")
                         if $Foldersx="" Then

                         else
                         for $i =1 to $Foldersx[0]
                               $retx &=$Foldersx[$i] &"|"
                            Next
                         endif
                         $retx&=$backword
                            $retx &="|"
                            GUICtrlSetData($Combo_2, "")
                               GUICtrlSetData($Combo_2, $retx)
                               _readfileall()
          EndFunc


    อันนี้ตอนเป็นListviewแล้ว(มีรูปแต่คคลิกไม่ได้)(ยังแก้codeไม่เสร็จดี)
    Code:

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <StaticConstants.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include<File.au3>

    Opt('MustDeclareVars', 1)
    Global $data,$ret,$file,$Folders,$retx,$Foldersx,$btchkx,$fileold[200],$dataview,$uvx=0,$hListBox,$aItems,$hImage,$iI,$ctopen=0,$ctopenstr="",$dirwrite="<---Folder--->  ",$dirwritelen=StringLen($dirwrite),$filelen,$Label_1,$Combo_2,$Buttonback
    Global $backword=">--กลับไปก่อนหน้า--<"
    _Main()

    Func _Main()
       Local $Label_1, $Combo_2, $button1, $msg,$Button2
    #Region ### START Koda GUI section ### Form=
    $ret  =""
    if $CmdLine[0]=0 Then
    $btchkx=MsgBox(4,"คำเตือน","ไม่พบการส่งค่าต้องการเลือกโฟลเดอร์เองหรือไม่")
    if $btchkx<>7 Then
    $file=FileSelectFolder("กรุณาเลือกfolderที่จะทำการดู","","","")
    Else
    Exit
    EndIf
    Else
    $file=$CmdLine[1]
    EndIf
    $Folders =_FileListToArray($file,"*.")
    for $i =1 to $Folders[0]
          $ret &=$Folders[$i] &"|"
          Next

    GUICreate("Explorer[Safe Mode]::Flash Drive Safe Check", 403, 470, -1, -1)
    $Label_1 = GUICtrlCreateLabel("Please select folder", -2, 0, 403, 21, $SS_SUNKEN)
    $Combo_2 = GUICtrlCreateCombo("", 0, 20, 402, 25)
       GUICtrlSetData($Combo_2, $ret)
    $hListBox = GUICtrlCreateListView("", 0, 42, 404, 396, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
    $Button2 = GUICtrlCreateButton("เปิดไฟล์", 72, 442, 122, 20, $WS_GROUP)
    $Buttonback = GUICtrlCreateButton("Back", 200, 442, 122, 20, $WS_GROUP)

    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4)
    _GUICtrlListView_SetImageList($hListBox, $hImage, 1)
    _GUICtrlListView_AddColumn($hListBox, "รายชื่อไฟล์", 350)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 1)
    _readfileandfolderviewlist($file)

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
          $msg = GUIGetMsg()
          Select

             Case $msg = $GUI_EVENT_CLOSE
                Exit
             Case $msg = $Combo_2
                $data = GUICtrlRead($Combo_2)
                   $dataview=$data
                if $data = $backword And $uvx>0 then
                   $file = ""
                   $uvx=$uvx-1
                   $data =$fileold[$uvx]
                   $dataview=$fileold
                endif
                _readfileindir()
                   GUICtrlSetData($Combo_2, "")
                   GUICtrlSetData($Combo_2, $retx)
                   GUICtrlSetData($Label_1, $dataview)
                Case  $msg=$hListBox
                   MsgBox(64,"","44444")
                   $aItems = _GUICtrlListView_GetItemText($hListBox,1)
                   Local $stockaItems=""
                   $filelen=StringLen($aItems[1])

                   If StringInStr(FileGetAttrib($file & "\" & $aItems), "D") And ($file <> "." Or $file <> "..")  Then
                   for $i=$dirwritelen+1 to $filelen
                      $stockaItems&=StringMid($aItems[1],$i,1)
                   Next
                   $data=$stockaItems

                EndIf

                   if $ctopenstr<>$aItems Then
                      $ctopen=0
                      Endif
                   $dataview=$data

                if $aItems = $backword  And $uvx>0 then
                   $file = ""
                   $uvx=$uvx-1
                   $data =$fileold[$uvx]
                   $dataview=$fileold
                      _readfileindir()
                      GUICtrlSetData($Label_1, $dataview)
                            GUICtrlSetData($Combo_2, "")
                               GUICtrlSetData($Combo_2, $retx)
                endif

                      if If StringInStr(FileGetAttrib($listF & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
                            _readfileindir()
                      GUICtrlSetData($Label_1, $dataview)
                            GUICtrlSetData($Combo_2, "")
                               GUICtrlSetData($Combo_2, $retx)
                            ElseIf $aItems<>""  And $ctopenstr=$aItems[1]  And $ctopen=1 And $aItems[1]=$backword Then
                               $ctopenstr=""
                   elseif $aItems<>""  And $ctopenstr=$aItems  And $ctopen=1 Then
                      ShellExecute($file&"\"&$aItems)
                      $ctopenstr=""
                      EndIf
                   if $aItems<>""  And $ctopenstr<>$aItems And $ctopen=0 Then
                      $ctopenstr=$aItems
                      $ctopen=1
                   EndIf
                Case $msg=$Buttonback
                   If $uvx>0 Then
                   $file = ""
                   $uvx=$uvx-1
                   $data =$fileold[$uvx]
                   $dataview=$fileold
                _readfileindir()
                   GUICtrlSetData($Combo_2, "")
                   GUICtrlSetData($Combo_2, $retx)
                   GUICtrlSetData($Label_1, $dataview)
                   Else
                   MsgBox(64,"คำเตือน","ไม่สามารถกลับไปไกลได้มากกว่านี้อีกแล้ว")
                   EndIf


                   Case $msg=$Button2
                   if $aItems=""  Then
                      MsgBox(64,"คำเตือน","คุณยังไม่ได้เลือกอะไรเลย")
                      ElseIf  (StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)) Then
                      MsgBox(64,"คำเตือน","เพื่อความปลอดภัยจึงไม่สามารถเปิดfolderได้")
                      Else
                         ShellExecute($file&"\"&$aItems)

                      EndIf

          EndSelect
       WEnd
    EndFunc

    Func _readfile()
          _GUICtrlListbox_BeginUpdate($hListBox)
       _GUICtrlListBox_ResetContent($hListBox)
       _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
       _GUICtrlListBox_Dir($hListBox, $file&"\*.*")

       _GUICtrlListBox_EndUpdate($hListBox)
       _GUICtrlListBox_Sort($hListBox)
       EndFunc

    Func _readfileall()
       $ret  =""
       $Folders =_FileListToArray($file,"*.*")
       $Foldersx =_FileListToArray($file,"*.")
       if $Foldersx="" Or $Folders="" Then
       Else
       #cs
       For $i=0  To $Folders[0]
          For $j=0  To $Foldersx[0]
             If $Folders[$i]=$Foldersx[$j] Then
                $Folders[$i]=$dirwrite&$Folders[$i]
             EndIf
          Next
       Next
       #ce
          For $i=1  To $Foldersx[0]
                $Foldersx[$i]=$dirwrite&$Foldersx[$i]
          Next
    EndIf


          _GUICtrlListBox_BeginUpdate($hListBox)
    _GUICtrlListBox_ResetContent($hListBox)
    _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
       if $Foldersx="" Then
             _GUICtrlListBox_Dir($hListBox, $file&"\*.*")
             Else
       for $i =1 to $Foldersx[0]
          _GUICtrlListBox_InsertString($hListBox,$Foldersx[$i])
       Next
       _GUICtrlListBox_Dir($hListBox, $file&"\*.*")
    EndIf
    if $uvx>0 Then
       _GUICtrlListBox_InsertString($hListBox,$backword)
    EndIf
       _GUICtrlListBox_EndUpdate($hListBox)
       _GUICtrlListBox_Sort($hListBox)
       EndFunc
       Func _readfileindir()
          $retx=""


                         if $file ="" Then
                            $file =$data
                            $fileold[$uvx]=$data
                         else

                            $fileold[$uvx]=$file
                            $uvx=$uvx+1
                         $file &="/"&$data
                      EndIf

                         $dataview=$file
                      GUICtrlSetData($Label_1, $dataview)
                         $Foldersx=""
                         $Foldersx =_FileListToArray($file,"*.")
                         if $Foldersx="" Then

                         else
                         for $i =1 to $Foldersx[0]
                               $retx &=$Foldersx[$i] &"|"
                            Next
                         endif
                         $retx&=$backword
                            $retx &="|"
                            GUICtrlSetData($Combo_2, "")
                               GUICtrlSetData($Combo_2, $retx)
                               _readfileandfolderviewlist($file)
          EndFunc

    Func _readfileandfolderviewlist($listF)

    Local $search = FileFindFirstFile($listF & "\*.*"),$filea
       While 1
          $filea = FileFindNextFile($search)
          If @error Or StringLen($filea) < 1 Then ExitLoop
          If StringInStr(FileGetAttrib($listF & "\" & $filea), "D") And ($filea <> "." Or $filea <> "..") Then
    ;~             _GUICtrlListView_AddItem($listview1, $listF & "\" & $file, 0)

             _GUICtrlListView_AddItem($hListBox, $filea, 0)
    ;~          SrFolder($listF & "\" & $file)
          ElseIf StringInStr(FileGetAttrib($listF & "\" & $filea), "A") And ($filea <> "." Or $filea <> "..") Then
             _GUICtrlListView_AddItem($hListBox, $filea, 1)
    EndIf

       WEnd
    EndFunc  ;==>SrFolder




    แก้ไขล่าสุดโดย pureexe เมื่อ 20/11/11, 03:32 pm, ทั้งหมด 1 ครั้ง
    max30012540
    max30012540
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty PSsix Program Coder
    จำนวนข้อความ : 98
    ความนิยม : 10
    เข้าร่วมเมื่อ : 10/10/2011
    อายุ : 26

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by max30012540 20/11/11, 03:14 pm

    case $msg=$listview ทำไมทำไม่ได้ KG1ux
    avatar
    pureexe
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty
    จำนวนข้อความ : 73
    ความนิยม : 8
    เข้าร่วมเมื่อ : 27/04/2011

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by pureexe 20/11/11, 03:28 pm

    แหะๆๆ แต่เอา if ออกไปตัวหนึ่งก็ไม่เห็นหายเลยครับ
    max30012540
    max30012540
    PSsix Member High Class
    PSsix Member High Class


    case $msg=$listview ทำไมทำไม่ได้ Empty PSsix Program Coder
    จำนวนข้อความ : 98
    ความนิยม : 10
    เข้าร่วมเมื่อ : 10/10/2011
    อายุ : 26

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by max30012540 20/11/11, 03:34 pm

    Error $listF ??????
    avatar
    Fast
    PSsix Member Super Class III
    PSsix Member Super Class III


    case $msg=$listview ทำไมทำไม่ได้ Empty PSsix Program Coder
    จำนวนข้อความ : 217
    ความนิยม : 54
    เข้าร่วมเมื่อ : 19/06/2011

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by Fast 20/11/11, 03:59 pm

    โค๊ด admin คลิ๊กlistviewก็ขึ้นนะ เหมือนรูปนี้ดูที่วงกลมดำ

    ทำไมไม่ขึ้น หรือว่าเอาไปแก้ไขไม่เป็น??

    case $msg=$listview ทำไมทำไม่ได้ A69Zt
    POS
    POS
    PSsix
    PSsix


    case $msg=$listview ทำไมทำไม่ได้ Empty case $msg=$listview ทำไมทำไม่ได้ Empty case $msg=$listview ทำไมทำไม่ได้ Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    case $msg=$listview ทำไมทำไม่ได้ Empty Re: case $msg=$listview ทำไมทำไม่ได้

    ตั้งหัวข้อ by POS 20/11/11, 06:35 pm

    โค้ดซึ่งผมใส่เพิ่มเติมจากของเดิมมี 6 บรรทัดเท่านั้น (ดูด้านล่าง)โค้ดด้านล่างนี้สงสัยคำสั่งไหน คลิกที่ตัวคำสั่งนั้นแล้วกดปุ่ม F1 จะมีคำอธิบายออกมา

    หากไม่เข้าใจหรือไม่สามารถประยุกต์ใช้ ก็เลิกทำไปก่อน หันไปเริ่มต้นหัดทำโปรแกรมง่ายๆ พวก Yes, No, OK ให้เข้าใจรูปแบบการทำงานของสคริปต์คำสั่งจนกระจ่าง เพราะเท่าที่ผมสังเกตุดู เมื่อคุณเขียนสคริปต์ติดปัญหาคุณมักจะบอกว่า ไม่ได้ ซึ่งคำว่า "ไม่ได้" ในความหมายของคุณ ไม่ใช่สคริปต์ทำงานไม่ได้ แต่คุณไม่รู้จะจัดการกับสคริปต์อย่างไร เหล่านี้เกิดจากพื้นฐานไม่แน่น อ่านรูปแบบสคริปต์ไม่ชำนาญจึงปรับเปลี่ยนสคริปต์ไม่เป็น



    Code:
        $s1 = _GUICtrlListView_GetSelectedIndices($listview1)
       If $s1 <> "" And $s1 <> $s2 Then
          GUICtrlSetData($listview1, _GUICtrlListView_GetItemText(GUICtrlGetHandle($listview1), _GUICtrlListView_GetSelectedIndices($listview1)))
          $s2 = $s1
       EndIf

      เวลาขณะนี้ 28/04/24, 07:19 pm