Results 1 to 17 of 17

Thread: Using APIs

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    269

    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

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    269

    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?

  4. #4
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    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.

  5. #5
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Using APIs

    Quote 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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    269

    Re: Using APIs

    Quote 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?

  7. #7
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    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.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    269

    Re: Using APIs

    Quote 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?

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    269

    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.

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  12. #12
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Using APIs

    Quote Originally Posted by Moorzee
    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.
    Do you have the API Viewer that comes with Visual Studio?

  13. #13
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    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.

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    269

    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.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  16. #16
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Using APIs

    http://pinvoke.net/
    Has types, constants and function signatures.


    Quote 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.

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width