"CreateFile" APIl

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
 
A

Armin Zingler

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error Message 1
LPCGUID and System.Guid 1
Windos XP/2000 reboot 1
Send raw data to the printer 4
printing with rawprinter helper 1
GetKeyState 5
CreateToolhelp32Snapshot 2
reboot windows 18

Top