Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
Declare Function CreateFileW Lib "Kernel32" (FileName As WString, DesiredAccess As Integer, ShareMode As Integer, SecurityAttributes As Integer, _
|
||||
CreateDisposition As Integer, Flags As Integer, Template As Integer) As Integer
|
||||
Declare Function WriteFile Lib "Kernel32" (fHandle As Integer, writeData As Ptr, numOfBytes As Integer, ByRef numOfBytesWritten As Integer, _
|
||||
overlapped As Ptr) As Boolean
|
||||
Declare Function GetLastError Lib "Kernel32" () As Integer
|
||||
Declare Function CloseHandle Lib "kernel32" (hObject As Integer) As Boolean
|
||||
|
||||
Const FILE_SHARE_READ = &h00000001
|
||||
Const FILE_SHARE_WRITE = &h00000002
|
||||
Const OPEN_EXISTING = 3
|
||||
|
||||
Dim fHandle As Integer = CreateFileW("C:\foo.txt", 0, FILE_SHARE_READ Or FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0)
|
||||
If fHandle > 0 Then
|
||||
Dim mb As MemoryBlock = "Hello, World!"
|
||||
Dim bytesWritten As Integer
|
||||
If Not WriteFile(fHandle, mb, mb.Size, bytesWritten, Nil) Then
|
||||
MsgBox("Error Number: " + Str(GetLastError))
|
||||
End If
|
||||
Call CloseHandle(fHandle)
|
||||
Else
|
||||
MsgBox("Error Number: " + Str(GetLastError))
|
||||
End If
|
||||
Loading…
Add table
Add a link
Reference in a new issue