Autor Tema: Ayuda, No reconoce en filename  (Leído 2620 veces)

0 Usuarios y 1 Visitante están viendo este tema.

NsTeam

  • Kilobyte
  • **
  • Mensajes: 54
  • Reputación: +1/-2
    • Ver Perfil
Ayuda, No reconoce en filename
« 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

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:Ayuda, No reconoce en filename
« Respuesta #1 en: Febrero 12, 2010, 12:52:33 am »
usa app.path es mas seguro.

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

sAludos.