回覆列表
  • 1 # 使用者3120385727362

    Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long

    Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As Long) As Long

    Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

    Private Type OFSTRUCT

    cBytes As Byte

    fFixedDisk As Byte

    nErrCode As Integer

    Reserved1 As Integer

    Reserved2 As Integer

    szPathName As String * 128

    End Type

    Private Const OF_READWRITE = &H2

    Private Const OF_CREATE = &H1000

    Dim fs As OFSTRUCT

    Dim hFile As Long

    Private Sub Command1_Click()

    Dim i As Long

    Dim s As String

    i = 0

    s = "Hello World"

    fs.cBytes = Len(fs)

    hFile = OpenFile("c:\tt.txt", fs, OF_CREATE Or OF_READWRITE)

    WriteFile hFile, ByVal s, Len(s), i, ByVal 0

    CloseHandle hFile

    End Sub

  • 中秋節和大豐收的關聯?
  • 如何提高信度和效度?