Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Check Instance Of App

Posted on December 14, 2013October 26, 2015 By David Kittell
Imports System.Diagnostics

Private Sub CheckInstanceOfApp()
        Dim appProc() As Process

        Dim strModName, strProcName As String
        strModName = Process.GetCurrentProcess.MainModule.ModuleName
        strProcName = System.IO.Path.GetFileNameWithoutExtension(strModName)


        appProc = Process.GetProcessesByName(strProcName)
        If appProc.Length > 1 Then
            MessageBox.Show("There is an instance of this application running.", "<Application Name>")
            Application.Exit()

        Else
            'MessageBox.Show("There are no other instances running.", "<Application Name>")
        End If
    End Sub
using System.Diagnostics;
private void CheckInstanceOfApp()
        {
            Process[] appProc = null;

            string strModName = null;
            string strProcName = null;
            strModName = Process.GetCurrentProcess().MainModule.ModuleName;
            strProcName = System.IO.Path.GetFileNameWithoutExtension(strModName);


            appProc = Process.GetProcessesByName(strProcName);
            if (appProc.Length > 1)
            {
                MessageBox.Show("There is an instance of this application running.", "<Application Name>");
                Application.Exit();

            }
            else
            {
                //MessageBox.Show("There are no other instances running.", "<Application Name>")
            }
        }

Originally Posted on December 14, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code CSharp VB.NET

Post navigation

Previous post
Next post

Related Posts

UNIX – Laptop Setup

Posted on April 9, 2018April 9, 2018

This is my basic setup for a laptop/desktop that I have for my family to use. Debian Based Should work on Debian, Ubuntu (all Ubuntu flavors) sudo apt-get –assume-yes install ntp sudo timedatectl set-timezone America/Detroit sudo service ntp stop sudo ntpdate us.pool.ntp.org sudo service ntp start echo nameserver 208.67.222.123 >…

Read More

SELinux Configuration Change

Posted on July 21, 2016December 21, 2017

clear sudo cp /etc/selinux/config /etc/selinux/config.bk sudo sed -i ‘/^#/d’ /etc/selinux/config sudo sed -i ‘/^$/d’ /etc/selinux/config SELinuxStatus=$(cat /etc/selinux/config | grep SELINUX=|cut -d’=’ -f2) echo Current Status: $SELinuxStatus clear # SELinux – Enforcing sudo sed -i "s|SELINUX=$SELinuxStatus|SELINUX=enforcing|" /etc/selinux/config SELinuxStatus=$(cat /etc/selinux/config | grep SELINUX=|cut -d’=’ -f2) echo New Status: $SELinuxStatus clear # SELinux…

Read More

PowerShell – Check DNS For Skype For Business

Posted on May 21, 2018

## CallTower PowerShell DNS Checker, This script checks all that you have all your DNS entries in place and displays the final route for DNS lookups. ## ## Usage .\Check-SRVRecords.ps1 -domain calltower.com ## ## Original Script Obtained From: https://www.uc.solutions/Skype_for_Business/Skype4B_Set_Up/How_to_verify_or_set_DNS_records_for_Skype_for_Business ## param($domain = (Get-WmiObject win32_computersystem).Domain) $cnameresult = Resolve-DnsName sip.$domain -Server 8.8.8.8…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes