N
news.microsoft.com
Hello,
i'm having problems to call a api dll in vb dot net.
I absolutely want to use this api call and none of the frame calls.
This is my declaration:
*****************
Public Structure SECURITY_ATTRIBUTES
Public nLength As UInt32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Int32
End Structure
' Desired Access
Public Const FILE_READ_DATA = 1
Public Const FILE_WRITE_DATA = 2
Public Const FILE_APPEND_DATA = 4
' ShareMode
Public Const FILE_SHARE_READ = &H1
Public Const FILE_SHARE_WRITE = &H2
' CreationDisposition
Public Const CREATE_NEW = 1
Public Const OPEN_EXISTING = 3
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As IntPtr) _
As Long
This is the call:
***********
Dim lFile As Long = LibWrap.CreateFile("c:\test\myfile.dat",
LibWrap.FILE_READ_DATA, LibWrap.FILE_SHARE_READ, Nothing,
LibWrap.OPEN_EXISTING, 0, Nothing)
Anyone an idea?
This is my first api call.
Grtz.
i'm having problems to call a api dll in vb dot net.
I absolutely want to use this api call and none of the frame calls.
This is my declaration:
*****************
Public Structure SECURITY_ATTRIBUTES
Public nLength As UInt32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Int32
End Structure
' Desired Access
Public Const FILE_READ_DATA = 1
Public Const FILE_WRITE_DATA = 2
Public Const FILE_APPEND_DATA = 4
' ShareMode
Public Const FILE_SHARE_READ = &H1
Public Const FILE_SHARE_WRITE = &H2
' CreationDisposition
Public Const CREATE_NEW = 1
Public Const OPEN_EXISTING = 3
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As IntPtr) _
As Long
This is the call:
***********
Dim lFile As Long = LibWrap.CreateFile("c:\test\myfile.dat",
LibWrap.FILE_READ_DATA, LibWrap.FILE_SHARE_READ, Nothing,
LibWrap.OPEN_EXISTING, 0, Nothing)
Anyone an idea?
This is my first api call.
Grtz.