-
Hi!
To learn a file's size and last modified date I open it with FileOpen API and get its hFile then use GetFileInformationByHandle to get its size and date. It's ok, but I couldn't close the file :) Is there a way to close it or is there another way to get file's size and date?
-
Use the WM_CLOSE message. Here is an example. It will close our App.
Code for module.
Code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_CLOSE = &H10
Put this in a CommandButton on the Form.
Code:
Private Sub Command1_Click()
retval = SendMessage(Me.hwnd, WM_CLOSE, ByVal CLng(1), ByVal "C:\")
End Sub
-
Does this work?
Declaration:
Public Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Long) As Long
Usage:
CloseHandle hFile
-
Yep! CloseHandle worked...