Visual Basic Foro

Programación => Visual Basic 6 => Mensaje iniciado por: NsTeam en Febrero 12, 2010, 12:41:01 am

Título: Ayuda, No reconoce en filename
Publicado por: NsTeam en Febrero 12, 2010, 12:41:01 am
hola a todos

tengo una duda...

Código: [Seleccionar]
Public Function Image2Hex(ByVal sFileName As String) As String
    Dim hFile As Integer, bArr() As Byte
   
    On Error Resume Next
    If Len(Dir$(sFileName, vbHidden Or vbSystem)) = 0 Then
        Call MsgBox("Can't find the file", vbCritical, "Error")
        Exit Function
    End If
    hFile = FreeFile
    Open sFileName For Binary Access Read As #hFile
        If Err.Number = 0 Then
            ReDim bArr(LOF(hFile) - 1)
            Get #hFile, , bArr
            Image2Hex = ByteArr2Hex(bArr)
        Else
            Call MsgBox("Can't open the file", vbCritical, "Error")
        End If
    Close #hFile
End Function

Private Sub Command1_Click()

RichTextBox1.Text = Image2Hex("\skin.dll")

End Sub


lo que pasa es que cuando le doy clik al command1

no reconoce (\skin.dll)

claro que con la direccion completa si lo abre

(c:\skin.dll)
(C:\Documents and Settings\Giovanni\Escritorio\aim\skin.dll)

peru supuestamente cuando pongo \skin.dll deveria leerlo desde la misma carpeta

pero no lo abre

ERROR(Can't find the file)

=/ q ago mal
Título: Re:Ayuda, No reconoce en filename
Publicado por: LeandroA en Febrero 12, 2010, 12:52:33 am
usa app.path es mas seguro.

RichTextBox1.Text = Image2Hex(app.path & "\skin.dll")

sAludos.