Results 1 to 9 of 9

Thread: [RESOLVED] [02/03] Windows API

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    137

    Resolved [RESOLVED] [02/03] Windows API

    Hello

    Can someone give me quick tutorial about how to call and use windows api calls within vb.net 2002? Maybe you could use ExitWindowsEx as an example?

    Thanks
    Jesse Bunch
    www.getbunch.com/
    If I have helped you, please rate my posts!

    Unless otherwise indicated, I am using the following Products:

    Visual Studio .NET 2010
    .NET Framework 4.0

  2. #2
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Re: [02/03] Windows API

    Have a look at this link.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [02/03] Windows API

    Quote Originally Posted by jesse_mac07
    Hello

    Can someone give me quick tutorial about how to call and use windows api calls within vb.net 2002? Maybe you could use ExitWindowsEx as an example?

    Thanks
    Hi,

    Here's a link with the explanation about ExitWindowsEx and an example;

    http://msdn.microsoft.com/library/de...twindowsex.asp

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [02/03] Windows API

    The one big hurdle to get over are the declarations. There is several in my signature where you can get the correct API declarations. The one I use most is APIViewer 2004. It has a .NET mode (if you change it in the options), where it has all of the functions, constants, types, and enumerations all declared for you, you just copy and paste into where you need it. Then its just a matter of finding examples on the net by googling the function you are needing.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    137

    Re: [02/03] Windows API

    Quote Originally Posted by gigemboy
    The one big hurdle to get over are the declarations. There is several in my signature where you can get the correct API declarations. The one I use most is APIViewer 2004. It has a .NET mode (if you change it in the options), where it has all of the functions, constants, types, and enumerations all declared for you, you just copy and paste into where you need it. Then its just a matter of finding examples on the net by googling the function you are needing.
    Thanks for that....Here is the code that ApiViewer gave me:

    VB Code:
    1. Declare Function ExitWindowsEx Lib "user32.dll" ( _
    2.      ByVal uFlags As Int32, _
    3.      ByVal dwReserved As Int32) As Int32

    I apologize but as far as api calls this is my first venture. So here are my next questions:

    Where do I plug that into my app?
    How do I call it from within a function?

    Thanks!
    Jesse Bunch
    www.getbunch.com/
    If I have helped you, please rate my posts!

    Unless otherwise indicated, I am using the following Products:

    Visual Studio .NET 2010
    .NET Framework 4.0

  6. #6
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [02/03] Windows API

    You just paste that into your form outside of any declarations, then call the function with the parameters you want...
    VB Code:
    1. Dim ReturnValue as Integer = ExitWindowsEX(SomeInteger, SomeInteger)
    The ReturnValue, which you may need or not need, is then held in the variable...

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Windows API

    It is a method declaration like any other. You put it anywhere you can put method declarations, like in a class or module definition, and you call it like you do any other method.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    137

    Re: [02/03] Windows API

    Thanks for the help I got it to work just like I wanted it to!
    Jesse Bunch
    www.getbunch.com/
    If I have helped you, please rate my posts!

    Unless otherwise indicated, I am using the following Products:

    Visual Studio .NET 2010
    .NET Framework 4.0

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Windows API

    Cool. Don't forget to resolve your thread from the Thread Tools menu.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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