Groups | Blog | Home
all groups > vb.net > october 2007 >

vb.net : DeviceIoControl error message


Lou
10/2/2007 5:22:58 PM
Anybody have any ideas on this cryptic error message when calling this:
bRet = DeviceIoControl(hGpiFile, IOCTL_BLIO_READ_BYTE, lpBufferIn,
Len(lpBufferIn), lpBufferOut, Len(lpBufferOut), lpBytesReceived, Nothing)


A first chance exception of type 'System.ArgumentException' occurred in
Microsoft.VisualBasic.dll

at Microsoft.VisualBasic.CompilerServices.StructUtils.EnumerateUDT(ValueType
oStruct, IRecordEnum intfRecEnum, Boolean fGet)

at Microsoft.VisualBasic.CompilerServices.StructUtils.GetRecordLength(Object
o, Int32 PackSize)

at Microsoft.VisualBasic.Strings.Len(Object Expression)

at BlastronicsGpi.cGpi.CheckForInput() in E:\VB
Projects.Net\BlastronicsGpi\BlastronicsGpi\cGpi.vb:line 126

Argument 'oStruct' is not a valid value.





-Lou

Mattias Sjögren
10/3/2007 8:39:15 PM

[quoted text, click to view]


Looks like the Len function can't handle the type you're passing to
it. What's the data type of lpBufferIn and lpBufferOut?

You might want to try using Marshal.SizeOf instead of Len.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Lou
10/3/2007 11:14:01 PM
Thanks, that worked!

[quoted text, click to view]

AddThis Social Bookmark Button