[DllImport("coredll")]
static extern Boolean WriteFile(IntPtr fFile, Byte[] lpBuffer, UInt32 nNumberOfBytesToWrite,
out UInt32 lpNumberOfBytesWritten, IntPtr lpOverlapped);
Declare Function WriteFile Lib "coredll.dll" (TODO) As TODO
Public Declare Function WriteFile Lib "coredll" ( _
ByVal hFile As Long, _
ByVal lpBuffer As String, _
ByVal nNumberOfBytesToWrite As Long, _
lpNumberOfBytesWritten As Long, _
ByVal lpOverlapped As Long) As Long
Public Const CREATE_ALWAYS = 2
Public Const OPEN_ALWAYS = 4
Public Const GENERIC_READ = &H80000000
Public Const GENERIC_WRITE = &H40000000
Public Const FILE_END As Long = 2
None.
Please add some!
Private Function WriteString(MyString As String) As Boolean
Dim lWritten As Long
Dim flag As Long
Dim hFile As Long
If optOverwrite Then
flag = CREATE_ALWAYS
Else
flag = OPEN_ALWAYS
End If
hFile = CreateFile(txtFileName.Text, GENERIC_READ + GENERIC_WRITE, _
0, 0, flag, 0, 0)
If optAppend.Value Then
SetFilePointer hFile, 0, 0, FILE_END
End If
If hFile <> -1 Then
WriteFile hFile, MyString, LenB(MyString), lWritten, 0
CloseHandle hFile
End If
End Function
TODO