Dir Function


Dir[( path,attributes )]

Returns a file/directory name that matches the given path  and attributes.

Example:

    '=========================================================

    ' Bitmap sample using the Dir Function

    '=========================================================

    Sub DrawBitmapSample

        Dim MyList()

        Begin Dialog BitmapDlg 60, 60, 290, 220, "BlueZone Basic bitmap sample", _

       .DlgFunc

            ListBox 10, 10, 80, 180, MyList(), .List1, 2

            Picture 100, 10, 180, 180, "Forest.bmp", 0, .Picture1

            CancelButton 42, 198, 40, 12    

            OKButton 90, 198, 40, 12

        End Dialog

        Dim frame As BitmapDlg

        ' Show the bitmap dialog

        Dialog frame

    End Sub

    Function DlgFunc( controlID As String, action As Integer, suppValue _

    As Integer )

        DlgFunc = 1   ' Keep dialog active

        Select Case action

        Case 1   ' Initialize

            temp = Dir( "c:\Windows\*.bmp" )

            count = 0

            While temp <> ""

                count = count + 1

                temp = Dir

            Wend

            Dim x() As String

            ReDim x(count)

            x(0) = Dir( "c:\Windows\*.bmp" )

            For i = 1 To count

                x(i) = dir

            Next i

            DlgListBoxArray "List1", x()

        Case 2   ' Click

            fileName = "c:\windows\" & DlgText("List1")

            DlgSetPicture "Picture1", fileName

        End Select

    End Function