djjd47130 / sql-executer

Execute Large SQL Scripts with GO Statements Using ADO
5 stars 2 forks source link

Enforcing single application instance #7

Open djjd47130 opened 9 years ago

djjd47130 commented 9 years ago

Implement the enforcement of a single instance of the application

When user opens a new instance of the application, it first needs to check to see if another instance is already open within current Windows user login session. If so, get the handle of that existing process and send a message "WM_REUSE_INSTANCE" to handle whatever command line parameters were called (such as open file, new file, new connection, etc.).

djjd47130 commented 9 years ago

Things to accomplish in this task:

  1. Get list of current processes
  2. Check list of current processes for this application
  3. Upon detecting another instance...
    • Forward command line to existing instance via Windows Messages
    • Terminate this new instance

When the other instance receives command line from new instance:

  1. Open file if provided as first parameter
  2. Parse the rest of the command line param switches
    • Handle each switch in either new or existing script file
djjd47130 commented 9 years ago

Added conditional USE_V3 because I've decided this should wait until Version 3.