|
-
Jun 6th, 2008, 09:58 AM
#1
Thread Starter
Hyperactive Member
Using APIs
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????
Code:
Public Const ABN_STATECHANGE = &H0
-
Jun 6th, 2008, 10:24 AM
#2
Re: Using APIs
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 11th, 2008, 04:17 AM
#3
Thread Starter
Hyperactive Member
Re: Using APIs
http://www.geocities.com/practicalvb...load/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?
-
Jun 11th, 2008, 05:05 AM
#4
Re: Using APIs
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 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.
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.
-
Jun 11th, 2008, 05:09 AM
#5
Re: Using APIs
 Originally Posted by Moorzee
Don't know how everyone else feels about using a typelib instead of the function declaration
Isn'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.
-
Jun 11th, 2008, 05:20 AM
#6
Thread Starter
Hyperactive Member
Re: Using APIs
 Originally Posted by Ellis Dee
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 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.
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?
-
Jun 11th, 2008, 05:25 AM
#7
Re: Using APIs
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.
-
Jun 11th, 2008, 05:37 AM
#8
Thread Starter
Hyperactive Member
Re: Using APIs
 Originally Posted by Ellis Dee
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?
-
Jun 11th, 2008, 05:38 AM
#9
Re: Using APIs
Why google when msdn has everything?
For example if you search for FindWindow on msdn you get...
http://search.msdn.microsoft.com/Def...us&refinement=
Thread Moved
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 11th, 2008, 05:50 AM
#10
Thread Starter
Hyperactive Member
Re: Using APIs
So if say I search MSDN for http://msdn.microsoft.com/en-us/libr...69(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.
-
Jun 11th, 2008, 05:56 AM
#11
Re: Using APIs
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/Sho...54639&SiteID=1
Last post
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 11th, 2008, 08:15 AM
#12
Re: Using APIs
 Originally Posted by Moorzee
Do you have the API Viewer that comes with Visual Studio?
-
Jun 11th, 2008, 08:19 AM
#13
Re: Using APIs
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.
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Jun 11th, 2008, 08:21 AM
#14
Thread Starter
Hyperactive Member
Re: Using APIs
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.
-
Jun 11th, 2008, 07:51 PM
#15
Re: Using APIs
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 11th, 2008, 09:42 PM
#16
Re: Using APIs
http://pinvoke.net/
Has types, constants and function signatures.
 Originally Posted by Ellis Dee
IMO, all dependencies are bad and should be avoided like the plague.
That's a laugh, when you're using VB! 
Everything has dependencies.
-
Jun 11th, 2008, 10:08 PM
#17
Re: Using APIs
pinvoke sucks. I havent had a single API either found or found to be correct. Booooo!
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|