By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,250 Members | 1,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,250 IT Pros & Developers. It's quick & easy.

Device Driver VB 2005 [2]

P: n/a
Fla
Hy!
I'm newbie to VB 2005 and I'm trying to read value from a device
driver, as I used in VB6 with CreateFile and DeveiceIoControl. I get a
correct driver handle with CreateFile but I can't read values with
ReadFile, as reported in this URL
http://support.microsoft.com/default...79&Product=vb6

I tried with ReadFile with the following code lines:

Try
Success = ReadFile(hSerialPort, Buffer, BytesWritten,
BytesRead, IntPtr.Zero)
MessageBox.Show("Last Win32 Error" & vbCrLf &
CStr(System.Runtime.InteropServices.Marshal.GetLas tWin32Error()))
If Result = 0 Then
Throw New CommException("Unable to read from driver")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
End Try

but I couldn't get values from device driver 'cause I get an exception
("Unable to read from driver") and I get value 6 from
GetLastWin32Error.

What does it me 6 for GetLastWin32Error? What am I doing wrong?

Thanks for your replies.

Feb 8 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.