How to use API in VB.net?

night_prince

Member
Joined
Dec 17, 2006
Messages
24
Programming Experience
Beginner
hi everybody :cool:

im trying to use api functions in vb.net but the proplem is that
i have an APIGuide program which describes how to use API in vb 6
how can i convert the constants or any other parameters to vb.net?

i figured out those only
Long ----> Integer
Hwnd ---> IntPtr
String----> String
but i need more informations?

can anyone help me??

thanks
 
APIviewer reference application could be useful to you, you can set language style to VB.Net in options. There is also the Pinvoke.net site.

Since Win32 API has been around long before .Net you have found there is also much VB6 (and C++ and every other Win programming language) examples on web, so you also got this: Upgrade Visual Basic 6 Code Dialog Box Plus aeons of information related to VB6 -> VB.Net: Help for Visual Basic 6.0 Users Getting some base knowledge about other programming languages is useful when you go outside the managed .Net world, so reading some tutorials about this and that could come in very handy, reading and understanding other languages is usually much easier than writing new code yourself with them.
 
Sorry For Late
I dont know how to thank you "John"
I already have APIViewer but i werent know that it can help me in .net

THanks a lot
i'll try it
once again thank you :)
 
If you just need to know whether to place and Int or Long ect then use Microsoft's MSDN listings and type the name of the API Function in the search bar. It will usually show you what parameters and parameter types you need.
 
That's exactly the problem APIviewer application addresses, because the MSDN documentation for Win32 API functions is in C++ it is not apparent for a VB programmer how to declare things. The MSDN documentation is still invaluable for learning more about how the functions works and interact. Best is use of combination of sources and some common sense and knowledge; MSDN official documentation, references with VB.Net style code like APIviewer, resource sites like Pinvoke and APIguide, examples and articles you can find on the web even for other programming languages, and not to forget use of forums like this one.

Here the topic is use of unmanaged resource libraries, but also sometimes when looking for a solution you will find old webpages that use only those, don't forget to search for specialized and integrated solution in the ever growing managed .Net library - its still rather 'young' library in programming terms and the old functionality might have been given a userfriendly interface in .Net you're not aware of.
 
That is right. Now that I think about it I have used API Viewer in the past. I haven't needed it in a long time and don't currently have it do to a computer format but I have used it.
 
Hey EveryBody :)
i figured out how to get the Fuction pointer to use it in Some API function
such as : SetWindowLong
in old days we were using AddressOf operator in VB6.
But this operator has a different meaning , in VB.net

it doesnt return the Function Pointer , instead it returns a delegate to that Function

now , you can use "Marshal.GetFunctionPointerForDeleGate(value as Delegate)as integer"
which returns an integer.


Hope i give something usefull!!

bye
 
Back
Top