Jump to content

Problem with CUICtrlList


Recommended Posts

Hello.

I'm working in an utility to delete networks drive from a list. I have a problem with the list, i can't select the first element in list. What I'm doing wrong? Thanks a lot. This is the code:

CODE

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#include <GuiConstants.au3>

#include <File.au3>

#include <Array.au3>

#Include <GuiList.au3>

#include <Misc.au3>

Opt("TrayIconDebug",1)

Opt('MustDeclareVars',1)

Opt('GUIOnEventMode',1)

global $LlistaUnitatsXarxa,$lstUnitatsXarxa,$lblLlista,$lblUnitatsXarxa

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Programa principal

FormulariSeleccio()

LlistarUnitatsXarxa()

GUISetOnEvent($GUI_EVENT_CLOSE,'Events')

GUISetOnEvent($GUI_EVENT_MINIMIZE,'Events')

GUISetOnEvent($GUI_EVENT_RESTORE,'Events')

While 1

Sleep(100)

WEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; FUNCIONS

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

func FormulariSeleccio()

; Formulari de selecció

GuiCreate('Servidor',450,350,(@DesktopWidth-450)/2,(@DesktopHeight-350)/2)

$lblUnitatsXarxa=GuiCtrlCreateLabel("Unitats de xarxa",200,20,150,50)

GUICtrlSetFont(-1,10,800)

$lstUnitatsXarxa=GuiCtrlCreateList('',200,50,200,100,$LBS_SORT)

GuiSetState()

endfunc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func LlistarUnitatsXarxa()

$LlistaUnitatsXarxa=DriveGetDrive('NETWORK')

_ArrayDisplay($LlistaUnitatsXarxa,'unitats')

GUICtrlSetData($lstUnitatsXarxa,$LlistaUnitatsXarxa[1] & DriveMapGet($LlistaUnitatsXarxa[1]))

for $i=1 to $LlistaUnitatsXarxa[0]

_GUICtrlListAddItem($lstUnitatsXarxa,$LlistaUnitatsXarxa[$i] & DriveMapGet($LlistaUnitatsXarxa[$i]))

next

;msgbox(0,'numero discos red en lista',_GUICtrlListCount($lstUnitatsXarxa))

EndFunc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func Events()

Switch @GUI_CTRLID

Case $GUI_EVENT_CLOSE

Exit

Case $GUI_EVENT_MINIMIZE

;;;

Case $GUI_EVENT_RESTORE

;;;

EndSwitch

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...