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 message:
A call to PInvoke function 'BlastronicsGpi!BlastronicsGpi.cGpi::CreateFile'
has unbalanced the stack. This is likely because the managed PInvoke
signature does not match the unmanaged target signature. Check that the
calling convention and parameters of the PInvoke signature match the target
unmanaged signature.
Same code works great in VB6?
-Lou
Armin Zingler - 02 Oct 2007 20:22 GMT
> i am using CreateFile in a VB6 app but it doesn't work in VB .NET
> COM dll. hGpiFile = CreateFile("\\.\BLIO1", GENERIC_READ Or
[quoted text clipped - 9 lines]
>
> Same code works great in VB6?
You mustn't use the same code because it's a different language.
Probably you took the VB6 API declaration.
Armin
Anand Mukundan - 02 Oct 2007 20:23 GMT
Looks like your Pinvoke defn is wrong. Check pinvoke.net for the right
signature.
http://pinvoke.net/default.aspx/kernel32/CreateFile.html

Signature
Rgds,
Anand
http://www.dotnetindia.com
> 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,
[quoted text clipped - 10 lines]
>
> -Lou