Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » Applications » Downloads
 
Add your own
alternative version

VB 9.0, C# 3.0 API Viewer

, 24 May 2012
This is a remake of Pramod Kumar Sing's 2002 API Viewer.
VSAPIVIEWER.zip
APIViewer12
APIViewer12
APIViewer12.sln.docstates.suo
APIViewer12.suo
APIviewer.ICO
APIViewer12.vbproj.user
bin
Debug
API
APIViewer12.exe
APIViewer12.pdb
APIViewer12.vshost.exe
APIViewer12.vshost.exe.manifest
GlassButtonVB.dll
Release
My Project
Application.myapp
Settings.settings
obj
x86
Debug
APIViewer12.exe
APIViewer12.FormSplash.resources
APIViewer12.frmAbout.resources
APIViewer12.frmViewer.resources
APIViewer12.pdb
APIViewer12.Resources.resources
APIViewer12.vbproj.GenerateResource.Cache
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
My Project.Resources.Designer.vb.dll
Release
Resources
arrow_in.png
arrow_left.png
arrow_out.png
arrow_right.png
backgroundGradient_BOB-1.png
Fullscreen.png
OilcanHarry.jpg
Imports System.Threading
Imports System.Environment
Imports System.IO
Imports System

Public Class frmViewer


#Region "Public Strings"

    Public strFile1 As String = Application.StartupPath & "\API\API32Const.txt"
    Public strFile2 As String = Application.StartupPath & "\API\API32Functions.txt"
    Public strFile3 As String = Application.StartupPath & "\API\API32Subs.txt"
    Public strFile4 As String = Application.StartupPath & "\API\API32Types.txt"

    Public strTemp As String = String.Empty
#End Region

#Region "The loading From File Subs."

    Public Sub LoadConstants()
        Dim m As RSP.ParseAPI = New RSP.ParseAPI(strFile1)
        Dim ThreadConst As Thread

        RSP.Constants = New RSP.CConst()

        ThreadConst = New Thread(AddressOf m.GetConstInfo)
        ThreadConst.Start()

        Try
            ThreadConst.Join()
        Catch e As Exception
            MessageBox.Show("Error occured reading file..." & vbCrLf & strFile1, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

        Thread.Sleep(250)
    End Sub

    Public Sub LoadFunctions()
        Dim m As RSP.ParseAPI = New RSP.ParseAPI(strFile2)
        Dim ThreadDeclare As Thread

        RSP.Declares = New RSP.CDeclare()

        ThreadDeclare = New Thread(AddressOf m.GetDeclareInfo)
        ThreadDeclare.Start()

        Try
            ThreadDeclare.Join()
        Catch eError As Exception
            MessageBox.Show("Error occured reading file..." & vbCrLf & strFile2, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

        Thread.Sleep(250)
    End Sub

    Public Sub LoadSubs()
        Dim m As RSP.ParseAPI = New RSP.ParseAPI(strFile3)
        Dim ThreadSubs As Thread

        RSP.Torpedoes = New RSP.CSubs()

        ThreadSubs = New Thread(AddressOf m.GetSubsInfo)
        ThreadSubs.Start()

        Try
            ThreadSubs.Join()
        Catch eError As Exception
            MessageBox.Show("Error occured reading file..." & vbCrLf & strFile3, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

        Thread.Sleep(250)
    End Sub

    Public Sub LoadTypes()
        Dim m As RSP.ParseAPI = New RSP.ParseAPI(strFile4)
        Dim ThreadType As Thread

        RSP.Types = New RSP.CTypes()

        ThreadType = New Thread(AddressOf m.GetTypeInfo)
        ThreadType.Start()

        Try
            ThreadType.Join()
        Catch eError As Exception
            MessageBox.Show("Error occured reading file..." & vbCrLf & strFile4, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

        Thread.Sleep(250)
    End Sub

#End Region 'The loading From File Subs.

#Region "Radio Button Events"

    Private Sub rbVB_CheckedChanged(sender As Object, e As System.EventArgs) Handles rbVB.CheckedChanged
        If lstItems.Items.Count > 0 Then
            Select Case cmbAPI.Text
                Case RSP.CMB_TYPES
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Types.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                    End If
                Case RSP.CMB_CONSTANTS
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Constants.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                    End If
                Case RSP.CMB_DECLARES
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Declares.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                    End If
                Case RSP.CMB_SUBS
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Declares.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub rbCS_CheckedChanged(sender As Object, e As System.EventArgs) Handles rbCS.CheckedChanged
        If lstItems.Items.Count > 0 Then
            Select Case cmbAPI.Text
                Case RSP.CMB_TYPES
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Types.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                    End If
                Case RSP.CMB_CONSTANTS
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Constants.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                    End If
                Case RSP.CMB_DECLARES
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Declares.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                    End If
                Case RSP.CMB_SUBS
                    If Not lstItems.SelectedItem Is Nothing Then
                        txtSelectedItems.Text = Replace(RSP.Declares.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub rbPublic_CheckedChanged(sender As Object, e As System.EventArgs) Handles rbPublic.CheckedChanged
        If txtSelectedItems.Text <> "" Then
            txtSelectedItems.Text = txtSelectedItems.Text.ToString.Replace(IIf(rbCS.Checked, RSP.APIPRIVATECSHARP, RSP.APIPRIVATE), IIf(rbCS.Checked, RSP.APIPUBLICCSHARP, RSP.APIPUBLIC))
            txtSelectedItems.Text = txtSelectedItems.Text.ToString.Replace(IIf(rbCS.Checked, RSP.APIPRIVATE, RSP.APIPRIVATECSHARP), IIf(rbCS.Checked, RSP.APIPUBLICCSHARP, RSP.APIPUBLIC))
        End If
    End Sub

    Private Sub rbPrivate_CheckedChanged(sender As Object, e As System.EventArgs) Handles rbPrivate.CheckedChanged
        If txtSelectedItems.Text <> "" Then
            txtSelectedItems.Text = txtSelectedItems.Text.ToString.Replace(IIf(rbCS.Checked, RSP.APIPUBLICCSHARP, RSP.APIPUBLIC), IIf(rbCS.Checked, RSP.APIPRIVATECSHARP, RSP.APIPRIVATE))
            txtSelectedItems.Text = txtSelectedItems.Text.ToString.Replace(IIf(rbCS.Checked, RSP.APIPUBLIC, RSP.APIPUBLICCSHARP), IIf(rbCS.Checked, RSP.APIPRIVATECSHARP, RSP.APIPRIVATE))
        End If
    End Sub

#End Region 'Radio Button Events.

#Region "Form Load Event"

    Private Sub frmViewer_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        'Clean-Up
        wb1.Dispose()
        lstItems.Dispose()
        dc1.Dispose()
        dc2.Dispose()
        dc3.Dispose()
        dc4.Dispose()
    End Sub

    Private Sub frmViewer_Load(sender As Object, e As System.EventArgs) Handles Me.Load

        lblHost.Text = ""

        'Load all API's, Constants, and Structures
        FormSplash.Status("Loading Constants!")
        LoadConstants()

        FormSplash.Status("Loading Functions!")
        LoadFunctions()

        FormSplash.Status("Loading Subs!")
        LoadSubs()

        FormSplash.Status("Loading Types!")
        LoadTypes()

    End Sub

#End Region 'Form Load Event.

#Region "Combo Box Index Cahaged Event."

    Private Sub cmbAPI_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles cmbAPI.SelectedIndexChanged
        txtSelectedItems.Text = ""
        'Load the listbox from the selected arrayed strings.
        Select Case cmbAPI.Text
            Case RSP.CMB_CONSTANTS
                lstItems.Items.Clear()
                For i As Integer = 0 To RSP.Constants.Count - 1
                    Dim sKey As String
                    sKey = RSP.Constants.GetKey(i)
                    If sKey <> "" Then lstItems.Items.Add(RSP.Constants.GetKey(i).ToString())
                Next
            Case RSP.CMB_DECLARES
                lstItems.Items.Clear()
                For i As Integer = 0 To RSP.Declares.Count - 1
                    Dim sKey As String
                    sKey = RSP.Declares.GetKey(i)
                    If sKey <> "" Then lstItems.Items.Add(RSP.Declares.GetKey(i).ToString())
                Next
            Case RSP.CMB_TYPES
                lstItems.Items.Clear()
                For i As Integer = 0 To RSP.Types.Count - 1
                    Dim sKey As String
                    sKey = RSP.Types.GetKey(i)
                    If sKey <> "" Then lstItems.Items.Add(RSP.Types.GetKey(i).ToString())
                Next
            Case RSP.CMB_SUBS
                lstItems.Items.Clear()
                For i As Integer = 0 To RSP.Torpedoes.Count - 1
                    Dim sKey As String
                    sKey = RSP.Torpedoes.GetKey(i)
                    If sKey <> "" Then lstItems.Items.Add(RSP.Torpedoes.GetKey(i).ToString())
                Next
            Case Else

        End Select
    End Sub

#End Region 'Combo Box Index Cahaged Event.

#Region "Listbox Events"

    Private Sub lstItems_Click(sender As Object, e As System.EventArgs) Handles lstItems.Click
        If lstItems.Items.Count > 0 Then
            Select Case cmbAPI.Text
                Case RSP.CMB_TYPES
                    If Not lstItems.SelectedItem Is Nothing Then
                        If rbCS.Checked Then
                            txtSelectedItems.Text = Replace(RSP.Types.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                        Else
                            txtSelectedItems.Text = Replace(RSP.Types.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                        End If
                    End If
                Case RSP.CMB_CONSTANTS
                    If Not lstItems.SelectedItem Is Nothing Then
                        If rbCS.Checked Then
                            txtSelectedItems.Text = Replace(RSP.Constants.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                        Else
                            txtSelectedItems.Text = Replace(RSP.Constants.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                        End If
                    End If
                Case RSP.CMB_DECLARES
                    If Not lstItems.SelectedItem Is Nothing Then
                        If rbCS.Checked Then
                            txtSelectedItems.Text = Replace(RSP.Declares.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                        Else
                            txtSelectedItems.Text = Replace(RSP.Declares.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                        End If
                    End If
                Case RSP.CMB_SUBS
                    If Not lstItems.SelectedItem Is Nothing Then
                        If rbCS.Checked Then
                            txtSelectedItems.Text = Replace(RSP.Torpedoes.GetDataCSharp(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLICCSHARP, RSP.APIPRIVATECSHARP))
                        Else
                            txtSelectedItems.Text = Replace(RSP.Torpedoes.GetData(lstItems.SelectedItem()), RSP.APISCOPE, IIf(rbPublic.Checked, RSP.APIPUBLIC, RSP.APIPRIVATE))
                        End If
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub lstItems_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles lstItems.SelectedIndexChanged
        wb1.Navigate("http://www.google.com/search?hl=en&q=" + lstItems.SelectedItem.ToString() + "&btnG=Google+Search")
    End Sub

#End Region 'Listbox Events.

#Region "Textbox TextChanged Event"

    Private Sub txtSearch_TextChanged(sender As Object, e As System.EventArgs) Handles txtSearch.TextChanged
        If lstItems.Items.Count > 0 Then
            lstItems.SelectedIndex = lstItems.FindString(txtSearch.Text)
        End If
    End Sub

#End Region 'Textbox TextChanged Event.

#Region "All Button Click Events"

    Private Sub btnAdd_Click(sender As Object, e As System.EventArgs) Handles btnAdd.Click
        If lstItems.Items.Count > 0 Then
            Select Case cmbAPI.Text
                Case RSP.CMB_TYPES, RSP.CMB_CONSTANTS, RSP.CMB_DECLARES, RSP.CMB_SUBS
                    If txtSelectedItems.Text = "" Then
                        Exit Sub
                    Else
                        strTemp = Trim(txtSelectedItems.Text)
                        If InStr(txtAddSelected.Text(), strTemp) > 0 Then   'Checking for duplicates.
                            MessageBox.Show("Selection already exists...", "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Information)
                            txtSelectedItems.Text = ""  'Clearing the textbox.
                        Else
                            txtAddSelected.Text += txtSelectedItems.Text & vbCrLf & vbCrLf
                            txtSelectedItems.Text = ""  'Clearing the textbox.
                        End If
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub btnClear_Click(sender As Object, e As System.EventArgs) Handles btnClear.Click
        txtAddSelected.Text = ""  'Clearing the textbox.
    End Sub

    Private Sub btnClose_Click(sender As Object, e As System.EventArgs) Handles btnClose.Click
        Application.Exit()
    End Sub

    Private Sub btnCopy_Click(sender As Object, e As System.EventArgs) Handles btnCopy.Click
        Clipboard.SetText(txtAddSelected.Text)  'Add text to clipboard for pasting.
    End Sub

    Private Sub btnMinimize_Click(sender As Object, e As System.EventArgs) Handles btnMinimize.Click
        Me.WindowState = FormWindowState.Minimized
    End Sub

    Private Sub btnMaximize_Click(sender As System.Object, e As System.EventArgs) Handles btnMaximize.Click
        If Me.WindowState = FormWindowState.Normal Then
            Me.WindowState = FormWindowState.Maximized
            btnMaximize.Image = My.Resources.arrow_in
        ElseIf Me.WindowState = FormWindowState.Maximized Then
            Me.WindowState = FormWindowState.Normal
            btnMaximize.Image = My.Resources.arrow_out
        End If
    End Sub

    Private Sub btnAbout_Click(sender As System.Object, e As System.EventArgs) Handles btnAbout.Click
        Dim frm As New frmAbout
        frm.Show()
    End Sub

#End Region 'All Button Click Events.

    Private Sub btnBack_Click(sender As System.Object, e As System.EventArgs) Handles btnBack.Click
        If wb1.CanGoBack Then
            wb1.GoBack()
        End If
    End Sub

    Private Sub btnForward_Click(sender As Object, e As System.EventArgs) Handles btnForward.Click
        If wb1.CanGoForward Then
            wb1.GoForward()
        End If
    End Sub

    Private Sub wb1_DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb1.DocumentCompleted
        lblHost.Text = wb1.Url.Host.ToString
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

rspercy65
Retired
United States United States
I am currently retired.
I have no degree but I have some programming experience
when I was in college(Cobol, Pascal).
 
My accomplishments thus far are;
Best VB.Net article for January(2009)
Best VB.Net article for July(2009)

| Advertise | Privacy | Mobile
Web04 | 2.8.140814.1 | Last Updated 24 May 2012
Article Copyright 2010 by rspercy65
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid