Visual Basic Online Course - VB .NET Make sure application is running and installed

Visual Basic Online Course

How to make sure that an Application is Running and Installed

VB 2010 Make sure application is running
Visual Basic Online Course - Tips

When you create a Visual Basic 2010 or generally a VB.Net application that relies on another VB.Net application for example an Updater.exe application, you will have to code both sides in order no to enable the user to run Updater.exe without the existence of the Main application, and in order to do so, you will have to make sure that :
1) Your Main application is Running.
2) Your Main application is Installed.
3) Your Main application does exist in the installation folder.
After making sure of all the above points, then you can compile your updater.exe file with your Main Application knowing that updater.exe won't run alone, especially if you're sending updates to the Main application for the user to receive using Updater.exe.

Here are the Codes to do so :

1) VB 2010 Get list of all installed applications
'Visual Basic Online Course
'VB 2010 Make sure application is installed
Imports Microsoft.Win32
Public Class Form1
Private Sub Form1_Load(sender As System.Object, _
e As System.EventArgs) Handles MyBase.Load
GetInstalledApps(ListBox1)
End Sub
Function GetInstalledApps(ilst As ListBox) As String
Dim DestKey As String = _
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
For Each App As String In _
Registry.LocalMachine.OpenSubKey(DestKey).GetSubKeyNames
ilst.Items.Add(App)
Next
Return ilst.Items.ToString
End Function
End Class
view raw gistfile1.vb hosted with ❤ by GitHub


2) VB 2010 Get list of all running applications
'Visual Basic Online Course
'VB 2010 Get list of all running applications
Function GetAllRunningApps(ilst As ListBox) As String
'For every process which is running on the computer
For Each p As Process In Process.GetProcesses
'If it doesn't have a title
If p.MainWindowTitle <> String.Empty Then
ilst.Items.Add(p.ProcessName)
End If
Next
Return ilst.Items.ToString
End Function
view raw gistfile1.vb hosted with ❤ by GitHub


3) VB 2010 Make sure application exists
'Visual Basic Online Course
'VB 2010 Make sure a file exists
Function AppExists() As Boolean
Dim AppPath As String = ("C:\folder\sample\app.exe")
If IO.File.Exists(AppPath) = True Then
Return True
Else
Return False
End If
End Function
view raw gistfile1.vb hosted with ❤ by GitHub


Thank you for reading, download VB 2010 Project from here

Here are some online Visual Basic lessons and courses :

Popular posts from this blog

VB .NET DropBox Api Source Code Example

VB .NET Google Drive Api Source Code Example

VB.NET Access 2007 Hierarchical TreeView

VB.NET How to properly close a windows application Form

DAO in VB .NET MS ACCESS Database

Solution - There is already an open DataReader associated with this Command which must be closed first.