"CreateFile" APIl

  • Thread starter Thread starter Lou
  • Start date Start date
L

Lou

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
 
Lou said:
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?

You mustn't use the same code because it's a different language.
Probably you took the VB6 API declaration.


Armin
 
Back
Top