Results 1 to 9 of 9

Thread: All API

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2009
    Location
    Erode,TN,India
    Posts
    52

    Question All API

    Can anybody show the page where i can get all the APIs used in vb.net? Also i need a program to put my Vb.net program in the startup.

  2. #2
    Junior Member
    Join Date
    May 2007
    Posts
    23

    Re: All API

    "Also i need a program to put my Vb.net program in the startup"

    vb Code:
    1. Public Class clsCheckRegistry
    2.  
    3.     Private bolSave As Boolean
    4.  
    5.     Protected strRegKey As String = "Software\Microsoft\Windows\CurrentVersion\Run"
    6.  
    7.     Public WriteOnly Property _bolSave() As Boolean
    8.  
    9.         Set(ByVal value As Boolean)
    10.  
    11.             Me.bolSave = value
    12.  
    13.  
    14.             If Me.bolSave = True Then
    15.  
    16.                 Reg(True)
    17.  
    18.             Else
    19.  
    20.                 Reg(False)
    21.  
    22.             End If
    23.  
    24.         End Set
    25.  
    26.     End Property
    27.  
    28.     ''' <summary>
    29.     ''' true if the user wants
    30.     ''' </summary>
    31.     ''' <param name="bolValue"></param>
    32.     ''' <remarks></remarks>
    33.     Protected Sub Reg(ByVal bolValue As Boolean)
    34.  
    35.         Dim reg As Microsoft.Win32.RegistryKey
    36.  
    37.         Try
    38.  
    39.             If bolValue Then
    40.  
    41.  
    42.                 If Not ReadRegEntry() Then
    43.  
    44.                     'so the registry doesnt exists so we need to input some values inside
    45.  
    46.                     reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strRegKey, True)
    47.  
    48.  
    49.                     reg.SetValue(My.Application.Info.Title, My.Application.Info.DirectoryPath & "\Nameofyourapplication.exe")
    50.  
    51.                     reg.Close()
    52.  
    53.  
    54.                 Else
    55.  
    56.                     Return
    57.  
    58.                 End If
    59.  
    60.  
    61.             Else
    62.  
    63.                 If ReadRegEntry() Then
    64.  
    65.                     'so delete the registy entry
    66.  
    67.                     Dim strValues() As String = {}
    68.  
    69.  
    70.                     reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strRegKey, True)
    71.  
    72.                     strValues = reg.GetValueNames()
    73.  
    74.  
    75.                     For Each newstrValues In strValues
    76.  
    77.  
    78.                         If newstrValues.Contains(My.Application.Info.Title.ToString()) Then
    79.  
    80.  
    81.                             '  reg.DeleteSubKey(My.Application.Info.Title.ToString())
    82.  
    83.                             reg.DeleteValue(My.Application.Info.Title.ToString())
    84.  
    85.  
    86.                         End If
    87.  
    88.                     Next
    89.  
    90.  
    91.                 Else
    92.  
    93.                     Return
    94.  
    95.                 End If
    96.  
    97.  
    98.             End If
    99.  
    100.  
    101.         Catch ex As Exception
    102.  
    103.             Dim strRaiseError As String = String.Format("Error: {0}" & vbCrLf & "Exception {1}", ex.Message, ex.InnerException)
    104.  
    105.             MessageBox.Show(strRaiseError, My.Application.Info.Title, MessageBoxButtons.OK)
    106.  
    107.         End Try
    108.  
    109.     End Sub
    110.  
    111.     ''' <summary>
    112.     ''' return true if exists
    113.     ''' return false if doesnt
    114.     ''' ill be reading registy values here
    115.     ''' </summary>
    116.     ''' <returns></returns>
    117.     ''' <remarks></remarks>
    118.     Private Function ReadRegEntry() As Boolean
    119.  
    120.         Dim reg As Microsoft.Win32.RegistryKey
    121.  
    122.  
    123.         Dim strValue As String() = {}
    124.  
    125.  
    126.         Try
    127.  
    128.  
    129.             reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strRegKey, True)
    130.  
    131.             strValue = reg.GetValueNames
    132.  
    133.  
    134.             If Not strValue.Contains(My.Application.Info.Title) Then
    135.  
    136.  
    137.                 Return False
    138.  
    139.  
    140.             Else
    141.  
    142.                 Return True
    143.  
    144.  
    145.             End If
    146.  
    147.  
    148.         Catch ex As Exception
    149.  
    150.             Dim strRaiseError As String = String.Format("Error: {0}" & vbCrLf & "Exception {1}", ex.Message, ex.InnerException)
    151.  
    152.             MessageBox.Show(strRaiseError, My.Application.Info.Title, MessageBoxButtons.OK)
    153.  
    154.  
    155.         End Try
    156.  
    157.  
    158.     End Function
    159.  
    160. End Class

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

    Re: All API

    Quote Originally Posted by ttsdinesh View Post
    Can anybody show the page where i can get all the APIs used in vb.net?
    If you mean that you want VB.NET signatures for Windows API functions then your best bet is PInvoke.net.
    Quote Originally Posted by ttsdinesh View Post
    Also i need a program to put my Vb.net program in the startup.
    Please ask unrelated questions in separate threads in future. The fact that the questions are short is irrelevant. One thread per topic and one topic per thread.
    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

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: All API

    The best place to get information about what you have available to you in the .net framework is msdn.microsoft.com.

    You can start with the VB Language Reference to get the basics of VB, if you don't already have it. To get more information on the framework itself, there is plenty of help on that as well:

    http://msdn.microsoft.com/en-us/library/a4t23ktk.aspx

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2009
    Location
    Erode,TN,India
    Posts
    52

    Re: All API

    jin29 neci....!! i am a beginer to vb.net. i struggle in using class and accessing the methods. So can u show me any zip file, so that i directly get an example? i can manipulate that myself

  6. #6
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: All API

    There are no APIs used in .net and no APIs not used in .net, there are just APIs. Microsoft made an OS and decided to give developers a way to command that OS through functions. These functions are called API. If you want to know the handle of a window you must provide either the Name of that Window, its Class Name or both. You then give those to the FindWindow api and it returns you the handle. The programming language does not matter, only the syntax is language specific.

    in C++ it is
    Code:
    HWND FindWindow(     
        LPCTSTR lpClassName,
        LPCTSTR lpWindowName
    );
    in VB it is:
    Code:
        Private Declare Auto Function FindWindow Lib "user32" _
        (ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
    There are thousands of APIs and a zip file with examples is just not economically possible. So you take a look at the MSDN API reference(as suggested) then you find an api that suits your current needs and read about it. Since the syntax there will most likely be C++ you go to Pinvoke.net(as suggested) and fetch the VB syntax.

    For FindWindow that would be:
    FindWindow at MSDN
    FindWndow at Pinvoke
    Additionally and if needed you google around for more code examples.

    As an additional note, APIs should only be used if your programming language does not already offer the functionality. If you are a beginner you will have great difficulties and the result will probably not work. You end up spending nights trying to figure out a simple concept which nevertheless requires at least intermediate programming skills.
    VB 2005, Win Xp Pro sp2

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2009
    Location
    Erode,TN,India
    Posts
    52

    Re: All API

    ok half. i wil look for that. thank u

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

    Re: All API

    Let's just be clear about what an API is. "API" stands for "application programming interface". Any programmatic interface that an application developer can access is an API. The .NET Framework class library provides an API. Microsoft Office provides an API. Internet Explorer provides an API. Firefox provides an API. The Windows OS also provides an API. We tend to use the term "API" to specifically refer to the Windows API but it doesn't really mean that.

    Some of us have assumed that you mean the Windows API and some of us have considered that that might be what you mean. Others have assumed you mean the .NET Framework API. Perhaps you could clear it up for us.
    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

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2009
    Location
    Erode,TN,India
    Posts
    52

    Re: All API

    Mr.jmcilhinney i want to shut down my system, restart, animate the window, animate my own form, and so on. what API should i use?

Tags for this Thread

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