|
-
Jul 27th, 2009, 07:12 PM
#1
Thread Starter
Member
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.
-
Jul 27th, 2009, 08:17 PM
#2
Junior Member
Re: All API
"Also i need a program to put my Vb.net program in the startup"
vb Code:
Public Class clsCheckRegistry
Private bolSave As Boolean
Protected strRegKey As String = "Software\Microsoft\Windows\CurrentVersion\Run"
Public WriteOnly Property _bolSave() As Boolean
Set(ByVal value As Boolean)
Me.bolSave = value
If Me.bolSave = True Then
Reg(True)
Else
Reg(False)
End If
End Set
End Property
''' <summary>
''' true if the user wants
''' </summary>
''' <param name="bolValue"></param>
''' <remarks></remarks>
Protected Sub Reg(ByVal bolValue As Boolean)
Dim reg As Microsoft.Win32.RegistryKey
Try
If bolValue Then
If Not ReadRegEntry() Then
'so the registry doesnt exists so we need to input some values inside
reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strRegKey, True)
reg.SetValue(My.Application.Info.Title, My.Application.Info.DirectoryPath & "\Nameofyourapplication.exe")
reg.Close()
Else
Return
End If
Else
If ReadRegEntry() Then
'so delete the registy entry
Dim strValues() As String = {}
reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strRegKey, True)
strValues = reg.GetValueNames()
For Each newstrValues In strValues
If newstrValues.Contains(My.Application.Info.Title.ToString()) Then
' reg.DeleteSubKey(My.Application.Info.Title.ToString())
reg.DeleteValue(My.Application.Info.Title.ToString())
End If
Next
Else
Return
End If
End If
Catch ex As Exception
Dim strRaiseError As String = String.Format("Error: {0}" & vbCrLf & "Exception {1}", ex.Message, ex.InnerException)
MessageBox.Show(strRaiseError, My.Application.Info.Title, MessageBoxButtons.OK)
End Try
End Sub
''' <summary>
''' return true if exists
''' return false if doesnt
''' ill be reading registy values here
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Private Function ReadRegEntry() As Boolean
Dim reg As Microsoft.Win32.RegistryKey
Dim strValue As String() = {}
Try
reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strRegKey, True)
strValue = reg.GetValueNames
If Not strValue.Contains(My.Application.Info.Title) Then
Return False
Else
Return True
End If
Catch ex As Exception
Dim strRaiseError As String = String.Format("Error: {0}" & vbCrLf & "Exception {1}", ex.Message, ex.InnerException)
MessageBox.Show(strRaiseError, My.Application.Info.Title, MessageBoxButtons.OK)
End Try
End Function
End Class
-
Jul 27th, 2009, 08:51 PM
#3
Re: All API
 Originally Posted by ttsdinesh
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.
 Originally Posted by ttsdinesh
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.
-
Jul 27th, 2009, 08:52 PM
#4
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
-
Jul 28th, 2009, 05:14 AM
#5
Thread Starter
Member
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
-
Jul 28th, 2009, 08:21 AM
#6
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.
-
Jul 28th, 2009, 08:33 AM
#7
Thread Starter
Member
Re: All API
ok half. i wil look for that. thank u
-
Jul 28th, 2009, 08:40 AM
#8
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.
-
Jul 28th, 2009, 06:51 PM
#9
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|