Vb6.0 Open an array of Images


I'm trying to save a list of image names and then open them, but it does not work.

"For now, just open an image of each guide."

You can help me, this is my code.

Public Function ObtenerImagePath(id As Long) As String
Dim rtn As String
Dim ctrl As New SqliteHelper
Dim rs As cRecordset
Dim query As String
Dim unaimagen As String
Dim variasimagenes As String
query = "SELECT * FROM IMEI WHERE Codigo = " & CStr(id) & ";"
Set rs = ctrl.ExecuteRecordset(query)
If (Not rs.EOF) Then
    Dim guia As String
    Dim fecha As String
    Dim tmp() As String
    guia = Trim(rs("Guia"))
    fecha = rs("FechaEmi")
    tmp = Split(fecha, "/")
    unaimagen = Dir(cdPhysicalPath & "Imagenes\" & tmp(2) & tmp(1) & "\" & 
    guia & ".*")
    variasimagenes = Dir(cdPhysicalPath & "Imagenes\" & tmp(2) & tmp(1) & 
    "\" & guia & "_*") 'Aqui deberia guardar varios nombres de imagen o algo 
    'así. ejemplo. 

    If Len(unaimagen) > 0 Then

    rtn = cdPhysicalPath & "Imagenes\" & tmp(2) & tmp(1) & "\" & unaimagen
    ElseIf Len(variasimagenes) > 0 Then

    rtn = cdPhysicalPath & "Imagenes\" & tmp(2) & tmp(1) & "\" & 
    rtn = ""
    End If

    End If
    ObtenerImagePath = rtn   '--> Aquí es donde debería alojar los nombres 
    'de imagen y abrirlos.
    End Function

And this code, shows the image:

Private Sub btnVer_Click()
     On Error GoTo btnVer_error
     Dim id As Long
     id = ObtenerIdSeleccionado()

     If (id <= 0) Then
     MsgBox "Seleccione un registro.", vbInformation, "INFO"
     Exit Sub
     End If

     If (Not ValidInCD(id)) Then
     Exit Sub
     End If

     Dim path As String
     path = ObtenerPath(id)

     If (Dir(path) <> "") Then
    'Dim f As New FrmImagen
    'f.PhysicalPath = path
    'f.Show True, Me
    'Shell path 'ShellExecute hWnd, "open", path, vbNullString, 
     vbNullString, SW_SHOWNORMAL
    Debug.Print ShellExecute(hWnd, "open", path, vbNullString, vbNullString, 
    MsgBox "La imagen no existe.", vbInformation + vbOKOnly, "INFO"
    End If

    Exit Sub
    MsgBox "No se encontró la imagen.", vbInformation + vbOKOnly, "INFO"
    End Sub
asked by Gonzalo Rios 19.12.2018 в 19:08

0 answers