Click to See Complete Forum and Search --> : Using APIs
Moorzee
Jun 6th, 2008, 09:58 AM
I read a response to a Q the other day from Ellis Dee and they put some code up using APIs. My question. Where Do I learn what APIs are useful and how they can be implemented? Also how do I find out what constants I use for what API???? I.e. What is this for???? Public Const ABN_STATECHANGE = &H0
RobDog888
Jun 6th, 2008, 10:24 AM
This is a site with most declarations and code examples. also if you download th API Viewer (link in my sig) it contains amost all API information in VB, but msdn.microsoft.com is the original complete source although its mainly in C++.
http://allapi.mentalis.org/index2.shtml
Moorzee
Jun 11th, 2008, 04:17 AM
http://www.geocities.com/practicalvb/vb/download/win32.zip
Found this which has helped. Don't know how everyone else feels about using a typelib instead of the function declaration but it makes life a lot easier seeing the constants enum'ed in the function call?
Ellis Dee
Jun 11th, 2008, 05:05 AM
Honestly, all the API I know I have learned from various threads on here and other similar sites over the years.
If it was this post (http://www.vbforums.com/showpost.php?p=3252556&postcount=3) that prompted this thread, I learned those particular API calls -- as well as many, many more that I incorporated into the XP library in my signature -- from VBnet (http://vbnet.mvps.org/code/fileapi/pathfileexists.htm).
I personally consider VBnet to be a tremendous resource for good code examples of using API calls in VB6, though I find the site a bit unwieldy to navigate.
Overall, I'd say I learned the most API calls from right here, just doing searches in the CodeBank and Classic VB forums.
Ellis Dee
Jun 11th, 2008, 05:09 AM
Don't know how everyone else feels about using a typelib instead of the function declarationIsn't a typelib a dependency? IMO, all dependencies are bad and should be avoided like the plague.
But that's probably just due to my irrational fear of installation.
Moorzee
Jun 11th, 2008, 05:20 AM
Honestly, all the API I know I have learned from various threads on here and other similar sites over the years.
If it was this post (http://www.vbforums.com/showpost.php?p=3252556&postcount=3) that prompted this thread, I learned those particular API calls -- as well as many, many more that I incorporated into the XP library in my signature -- from VBnet (http://vbnet.mvps.org/code/fileapi/pathfileexists.htm).
I personally consider VBnet to be a tremendous resource for good code examples of using API calls in VB6, though I find the site a bit unwieldy to navigate.
Overall, I'd say I learned the most API calls from right here, just doing searches in the CodeBank and Classic VB forums.
T'was indeed that there post ED. But my issue was more about once you have found what looks like a decent API call to help you achive your goal where to get all the correct constant values from. There doesn't seem to be any correlation between all the API constants and the functions. The typelib has them all enumerated and, for instance, if I was using the SetWindowLong function, the second param is a long in the VB api text viewer whereas this typelib has enumerated all the constants in an enum named WinGetWindowLongOffsets. I can view all the constants of this enum in the object browser which is spot on I reckon?
I see where you are coming from with the dependancy issue but I feel that the benefits outway the cons?
Ellis Dee
Jun 11th, 2008, 05:25 AM
To find constant values, I google the API function name and look for code samples. Once I find one or more constant names used in a code sample, I then look up that prefix in the API viewer to see the rest.
Moorzee
Jun 11th, 2008, 05:37 AM
To find constant values, I google the API function name and look for code samples. Once I find one or more constant names used in a code sample, I then look up that prefix in the API viewer to see the rest.
Fair do's. Your way is obviously the correct/purest way. But for people like myself who have never messed about near API functions this is a belting way of sussing some things out.
BTW, what if whoever posted the code you google has used their own names for the constants? You would only have their version doing whatever they wanted with their constants and would be scuppered no?
RobDog888
Jun 11th, 2008, 05:38 AM
Why google when msdn has everything?
For example if you search for FindWindow on msdn you get...
http://search.msdn.microsoft.com/Default.aspx?query=FindWindow&brand=msdn&locale=en-us&refinement=
Thread Moved
Moorzee
Jun 11th, 2008, 05:50 AM
So if say I search MSDN for http://msdn.microsoft.com/en-us/library/ms632669(VS.85).aspx how can I find out the values for the dwFlags members? AW_SLIDE, AW_ACTIVATE etc..??? This is the part I was struggling with at the first post.
RobDog888
Jun 11th, 2008, 05:56 AM
I would take teh AW_SLIDE and search it next to get something like this link (although its .NET the constant values are whats inportant)
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=54639&SiteID=1
Last post ;)
Ellis Dee
Jun 11th, 2008, 08:15 AM
So if say I search MSDN for http://msdn.microsoft.com/en-us/library/ms632669(VS.85).aspx how can I find out the values for the dwFlags members? AW_SLIDE, AW_ACTIVATE etc..??? This is the part I was struggling with at the first post.Do you have the API Viewer that comes with Visual Studio?
Dnereb
Jun 11th, 2008, 08:19 AM
A nice resource for API's in VB6.0 is Allapi.net
they support limited VB.Net documentation
but the viewer software was handy to me in the past.
Using API's in .Net is in most cases not neccesary in my humble opinion.
Moorzee
Jun 11th, 2008, 08:21 AM
Yes. I now have the api guide which someone on here pointed me towards which is much better with examples. Cheers for your help and advice people.
RobDog888
Jun 11th, 2008, 07:51 PM
Yea and also for .NET there is the pinvoke.net "addin" but its very llimited and is more like a wiki style. I havent had much sucess with it at all. The API Viewer utility has a language choiceoption to switch to vb.net syntax. ;)
penagate
Jun 11th, 2008, 09:42 PM
http://pinvoke.net/
Has types, constants and function signatures.
IMO, all dependencies are bad and should be avoided like the plague.
That's a laugh, when you're using VB! :)
Everything has dependencies.
RobDog888
Jun 11th, 2008, 10:08 PM
pinvoke sucks. I havent had a single API either found or found to be correct. Booooo!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.