473,387 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Translation of CreateFile dll in dot net

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.
Mar 29 '06 #1
8 2093
You need to be aware of data type mapping between .Net and the API calls and also be aware that if you are using declarations from
VB5/6 that a VB5/6 Long maps to a VB.Net Integer.

Without looking in any detail, first try changing all Long to Integer in the CreateFile declaration.

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message news:u8**************@tk2msftngp13.phx.gbl...
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.

Mar 29 '06 #2
I've changed the code with no luck:

Declaration:
*********
Const FILE_READ_DATA = 1
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As IntPtr, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

Call:
****
Dim fh As IntPtr

fh = CreateFile("c:\test\test.txt", FILE_READ_DATA, FILE_SHARE_READ,
IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)

If fh.ToInt32 = -1 Then
MessageBox.Show("Invalid")
End If
I don't see what's wrong ...

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You need to be aware of data type mapping between .Net and the API calls and also be aware that if you are using declarations from VB5/6 that a VB5/6 Long maps to a VB.Net Integer.

Without looking in any detail, first try changing all Long to Integer in the CreateFile declaration.
--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message

news:u8**************@tk2msftngp13.phx.gbl...
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.


Mar 29 '06 #3
That's because you changed the Longs to Int32, which was no change at all. You need to use either Integer or Int16. A DWORD is two
(2) 8 bit words or a 16-bit integer.

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message news:eC**************@tk2msftngp13.phx.gbl...
I've changed the code with no luck:

Declaration:
*********
Const FILE_READ_DATA = 1
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As IntPtr, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

Call:
****
Dim fh As IntPtr

fh = CreateFile("c:\test\test.txt", FILE_READ_DATA, FILE_SHARE_READ,
IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)

If fh.ToInt32 = -1 Then
MessageBox.Show("Invalid")
End If
I don't see what's wrong ...

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You need to be aware of data type mapping between .Net and the API calls

and also be aware that if you are using declarations from
VB5/6 that a VB5/6 Long maps to a VB.Net Integer.

Without looking in any detail, first try changing all Long to Integer in

the CreateFile declaration.

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message

news:u8**************@tk2msftngp13.phx.gbl...
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.



Mar 29 '06 #4
I tried it but that doesn't work either.
thanks.

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
That's because you changed the Longs to Int32, which was no change at all. You need to use either Integer or Int16. A DWORD is two (2) 8 bit words or a 16-bit integer.

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message

news:eC**************@tk2msftngp13.phx.gbl...
I've changed the code with no luck:

Declaration:
*********
Const FILE_READ_DATA = 1
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As IntPtr, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

Call:
****
Dim fh As IntPtr

fh = CreateFile("c:\test\test.txt", FILE_READ_DATA, FILE_SHARE_READ,
IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)

If fh.ToInt32 = -1 Then
MessageBox.Show("Invalid")
End If
I don't see what's wrong ...

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You need to be aware of data type mapping between .Net and the API
calls and also be aware that if you are using declarations from
VB5/6 that a VB5/6 Long maps to a VB.Net Integer.

Without looking in any detail, first try changing all Long to Integer
in the CreateFile declaration.

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message

news:u8**************@tk2msftngp13.phx.gbl...
> 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.
>
>



Mar 29 '06 #5
"news.microsoft.com" <Yv**********@hotmail.com> schrieb:
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.


Any reason for using 'CreateFile' instead of .NET's 'System.IO.FileStream'
class or similar classes?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 29 '06 #6
See inline

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
That's because you changed the Longs to Int32, which was no change at all.
You need to use either Integer or Int16. A DWORD is two
(2) 8 bit words or a 16-bit integer.

Ehh, no. A DWORD is 32 bits, same as Long in VB6 and Int32/Integer in VB.NET

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message
news:eC**************@tk2msftngp13.phx.gbl...
I've changed the code with no luck:

Declaration:
*********
Const FILE_READ_DATA = 1
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As IntPtr, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

Call:
****
Dim fh As IntPtr

fh = CreateFile("c:\test\test.txt", FILE_READ_DATA, FILE_SHARE_READ,
IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)

If fh.ToInt32 = -1 Then
MessageBox.Show("Invalid")
End If
I don't see what's wrong ...


Try this:

Const FILE_READ_DATA As Int32 = 1
Const OPEN_EXISTING As Int32 = 3
Const FILE_SHARE_READ As Int32 = &H1
Const FILE_SHARE_WRITE As Int32 = &H2
Const FILE_ATTRIBUTE_NORMAL As Int32 = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
<MarshalAs(UnmanagedType.LPTStr)> ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

If this doesn't work try changing the lpSecurityAttributes parameter to
ByVal instead of ByRef

/claes
Mar 29 '06 #7
Sorry, ehh, you're right. My bad. Anyhow, when converting VB5/6 Declarations, the VB5/6 Long converts to a VB.Net Integer.

Also the SECURITY_ATTRIBUTES structure needs to be adjusted as well.

--
Al Reid

"Claes Bergefall" <cl*************@nospam.nospam> wrote in message news:em**************@tk2msftngp13.phx.gbl...
See inline

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
That's because you changed the Longs to Int32, which was no change at all.
You need to use either Integer or Int16. A DWORD is two
(2) 8 bit words or a 16-bit integer.


Ehh, no. A DWORD is 32 bits, same as Long in VB6 and Int32/Integer in VB.NET

--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message
news:eC**************@tk2msftngp13.phx.gbl...
I've changed the code with no luck:

Declaration:
*********
Const FILE_READ_DATA = 1
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As IntPtr, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

Call:
****
Dim fh As IntPtr

fh = CreateFile("c:\test\test.txt", FILE_READ_DATA, FILE_SHARE_READ,
IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)

If fh.ToInt32 = -1 Then
MessageBox.Show("Invalid")
End If
I don't see what's wrong ...


Try this:

Const FILE_READ_DATA As Int32 = 1
Const OPEN_EXISTING As Int32 = 3
Const FILE_SHARE_READ As Int32 = &H1
Const FILE_SHARE_WRITE As Int32 = &H2
Const FILE_ATTRIBUTE_NORMAL As Int32 = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
<MarshalAs(UnmanagedType.LPTStr)> ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

If this doesn't work try changing the lpSecurityAttributes parameter to
ByVal instead of ByRef

/claes

Mar 29 '06 #8
That did it.
Thank you all.

"Claes Bergefall" <cl*************@nospam.nospam> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
See inline

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
That's because you changed the Longs to Int32, which was no change at all. You need to use either Integer or Int16. A DWORD is two
(2) 8 bit words or a 16-bit integer.

Ehh, no. A DWORD is 32 bits, same as Long in VB6 and Int32/Integer in

VB.NET
--
Al Reid

"news.microsoft.com" <Yv**********@hotmail.com> wrote in message
news:eC**************@tk2msftngp13.phx.gbl...
I've changed the code with no luck:

Declaration:
*********
Const FILE_READ_DATA = 1
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FILE_ATTRIBUTE_NORMAL = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As IntPtr, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

Call:
****
Dim fh As IntPtr

fh = CreateFile("c:\test\test.txt", FILE_READ_DATA, FILE_SHARE_READ,
IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)

If fh.ToInt32 = -1 Then
MessageBox.Show("Invalid")
End If
I don't see what's wrong ...


Try this:

Const FILE_READ_DATA As Int32 = 1
Const OPEN_EXISTING As Int32 = 3
Const FILE_SHARE_READ As Int32 = &H1
Const FILE_SHARE_WRITE As Int32 = &H2
Const FILE_ATTRIBUTE_NORMAL As Int32 = &H80

<StructLayout(LayoutKind.Sequential)> _
Structure SECURITY_ATTRIBUTES
Public nLength As Int32
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Structure

Declare Auto Function CreateFile Lib "kernel32" ( _
<MarshalAs(UnmanagedType.LPTStr)> ByVal lpFileName As String, _
ByVal dwDesiredAccess As Int32, _
ByVal dwShareMode As Int32, _
ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByVal dwCreationDistribution As Int32, _
ByVal dwFlagsAndAttributes As Int32, _
ByVal hTemplateFile As IntPtr _
) As IntPtr

If this doesn't work try changing the lpSecurityAttributes parameter to
ByVal instead of ByRef

/claes

Mar 30 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nitin Narang | last post by:
I have a piece of code which is moved to .NET VC7 recently from VC6 and there has been an apparent change in behavior using CreateFile/Writefile functionality. I am creating a file on a shared...
3
by: Antoine | last post by:
Hello, I'm writing a program to send requests to my wlan pocket pc device (UIO1: driver) in C#. Here how I import CreateFile functions from coredll.dll with DllImport: public static extern...
4
by: JLW | last post by:
I'm having alot of difficulty with this one. I have seen no less than 20 different ways to use this function with a named pipe. I'm trying to use \\.\TAPE0 (TapeDrive). Here's my decleration: ...
5
by: Andrew Clark | last post by:
Hello, Thanks for all replies on this subject. I still cannot get CreateFile to retun a good value though. I went to PInvoke.net and saw the VB.NET declaration of this function: ...
5
by: Fla | last post by:
Hy! I'm a newbie to VB 2005 and I have to connect my program to a driver previously developed for a custom ISA card. With my old VB 6 code I used the routine CreateFileA exported from kernel32...
3
by: Scott Bell | last post by:
Hello all, What is the equivalent in the .NET Framework for accessing a device at the block/sector level such as one would when using CreateFile on a device like "\\.\D:"? Attempting to create...
2
by: Jim Flanagan | last post by:
Hi... I am using VB.net Express to experiment with the Win32 API functions that are available. The current project is an application that will read the raw sectors of a logical drive so that a...
5
by: =?Utf-8?B?R2FyeQ==?= | last post by:
Been struggling with the code below for the last couple of days: m_hSerialHandle = CreateFile("COM1:", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, /*FILE_FLAG_OVERLAPPED*/0, NULL); ...
2
by: Lou | last post by:
i am using CreateFile in a VB6 app but it doesn't work in VB .NET COM dll. hGpiFile = CreateFile("\\.\BLIO1", GENERIC_READ Or GENERIC_WRITE, 0, gblSecurity, OPEN_EXISTING, 0, 0) I get an error...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.