goodbye
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCitarAdemás estamos tambien haciendo de photoshop y vamos a hacer sobre mas cosas.
Citarsolo piden como joder y leer poco.
Private Sub Form_Load()
On Error GoTo line1
Open "c:\Lista.txt" For Input As #1
Dim nombre As String
While Not EOF(1)
Line Input #1, nombre
List1.AddItem nombre
Wend
Close
Exit Sub
line1:
MsgBox Err.Description, vbCritical, "Error " & Err.Number
End Sub
Private Sub Command1_Click()
Dim i, V As Boolean
For i = 0 To List1.ListCount - 1
If UCase(Text1) = UCase(List1.List(i)) Then V = True
Next
If V = True Then
MsgBox "El nombre '" & Text1 & "' aparece en la lista"
Else
MsgBox "'" & Text1 & "' no aparece en la lista"
End If
End Sub
CitarYo podria montar un foro delphi en mi portal
Citarel problema es que cuando quiero acceder a alguna propiedad de la estructura en especial a ftCreationTime, me dice que no coinciden los tipos.
Private Const OPEN_EXISTING = 3
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Type BY_HANDLE_FILE_INFORMATION
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
dwVolumeSerialNumber As Long
nFileSizeHigh As Long
nFileSizeLow As Long
nNumberOfLinks As Long
nFileIndexHigh As Long
nFileIndexLow As Long
End Type
Private Declare Function GetFileInformationByHandle Lib "kernel32" _
(ByVal hFile As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As Long
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As _
FILETIME, lpLocalFileTime As FILETIME) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As _
FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Dim hFile As Long, FileInfo As BY_HANDLE_FILE_INFORMATION
Dim CTime As FILETIME, STime As SYSTEMTIME
hFile = CreateFile("c:\autoexec.bat", 0, 0, ByVal 0&, OPEN_EXISTING, 0, ByVal 0&)
If hFile = -1 Then
MsgBox "Archivo no encontrado", vbOKOnly + vbInformation
Exit Sub
End If
GetFileInformationByHandle hFile, FileInfo
FileTimeToLocalFileTime FileInfo.ftCreationTime, CTime
FileTimeToSystemTime CTime, STime
MsgBox STime.wDay & "." & STime.wMonth & "." & _
STime.wYear & vbCrLf & STime.wHour & ":" & STime.wMinute & ":" & _
STime.wSecond, vbInformation,"File Creation Time"
CloseHandle hFile
End Sub
Private Const OPEN_EXISTING = 3
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type BY_HANDLE_FILE_INFORMATION
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
dwVolumeSerialNumber As Long
nFileSizeHigh As Long
nFileSizeLow As Long
nNumberOfLinks As Long
nFileIndexHigh As Long
nFileIndexLow As Long
End Type
Private Declare Function GetFileInformationByHandle Lib "kernel32" (ByVal hFile As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Dim hFile As Long, FileInfo As BY_HANDLE_FILE_INFORMATION
'create a handle to the file 'c:\autoexec.bat'
hFile = CreateFile("c:\autoexec.bat", 0, 0, ByVal 0&, OPEN_EXISTING, 0, ByVal 0&)
'retrieve the file information
GetFileInformationByHandle hFile, FileInfo
'close the handle
CloseHandle hFile
'show the result
MsgBox "File size: " + CStr(FileInfo.nFileSizeLow), vbInformation
End Sub