|
-
Feb 26th, 2002, 10:31 AM
#11
Here is what I have for the API question. Anyone see anything I need to add or made a mistake on?
How do I use API calls in .NET?
There seems to be the big myth running around that you cannot use API calls in .NET applications.
This is false. You can use API functions in your .NET apps pretty much the same way you always
have before, BUT, there are some rules you need to know first. First off, the .NET framework
already provides classes to many functions that you used to use the API for previously. So before
you use a call, make sure there is no .NET way to do it as adding API calls makes your app
unmanaged by the framework and it loses some of the benfits(such as security) of it. You can
check http://www.allapi.net for a list of functions that are provided by the framework to replace
using the API. NOTE: As of this time they have not included anything in the list, but bookmark
it for later reference when they do.
If you do end up having to use and API call, here is what is different.
a) When calling a function, you can specify if it will return Ansi or Unicode. VB6 by default
returned Ansi.
VB Code:
Public Declare Ansi functionname .....
b) You will need to change return value and parameter datatypes. Dataypes have changed, so you
will need to change them as appropriate. For instance:
If it was Long in VB6, change it to Integer
If it was Integer, change it to Short
If it was Any, you will need to find out what the correct data type will be.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|