Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

"CreateFile" APIl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lou - 02 Oct 2007 20:10 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 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.