Are there any programming changes, or does the api delcaration stay the same in .NET opposed to v6.0 Thanks a bunch!
Printable View
Are there any programming changes, or does the api delcaration stay the same in .NET opposed to v6.0 Thanks a bunch!
Well the api stuff is changed in vb.net. Like for bitblt you would:
dim gr as graphics
gr = me.creategraphics
gr.drawimage(image, etc ...)
and forlike open "c:\text.txt" for output as #1 its changed to:
filesystem.fileopen(filenumber,filename)
filesystem.print(filenumber, string)
filesystem.fileclose
those are just a few program changes in the code in vb.net
Well the API has not changed all that much, except some things like data types might be different. But .NET provides alot of Namespaces that do things you used to use the API for, so before you use an API make sure there is no framework way to do it as this makes it unmanaged code and will not take full advantage of the framework, particularly security.
how do you declare an API in VB.NET (lets say you don't want to use the framework, or you want to use a dll;) )
Same way basically except you declare string return type(Ansi or Unicode...you would generally use Ansi as this is VB6 default)
Declare Function Ansi functionname blah blah
plus wherever you used longs before in Vb6 for the calls parameters or return value, change those to integers as they should be. Keeping them as longs can, and probably will, cause memory leaks and memory exception errors.
Also in .NET you CANNOT declare parameters in functions or return types "as any." this is a tad obnoxious, but not a big deal.
Don't forget that Integers are VB6 Long's so where you would declare a function in VB6 like
it's nowCode:Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Code:Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Integer, ByVal dwReserved As Integer) As Integer
Hey thats what I said! :p
long = integer now