Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 2 of 2

Thread: Single Instance

  1. #1
    Join Date
    Feb 2007
    Posts
    4

    Single Instance

    Hi. I've made an AutoPlay CD browser. I notice that if the user clicks on the CD more than once, multiple instances of the CD browser will be launched. Is there a way to limit my AutoPlay executable so only a single instance will run at a time?

    Thanks in advance.

    --Jim

  2. #2
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    Try this:

    It's from the AMS Help file.

    You will need to modify to fit your needs.

    As an example, let us assume that you want to run your program, only if there is not another autorun.exe running on the system. To accomplish this, use the Window.EnumerateProcesses action, and check every process against the filename autorun.exe.


    Code:
    instances_of_file = 0;
    file_to_check_for = "autorun.exe"; --have all lowercase
    processes = Window.EnumerateProcesses();
    
    for j, file_path in processes do
        file = String.SplitPath(file_path);
        if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
            instances_of_file = instances_of_file + 1;
        end
    end
    
    if instances_of_file > 1 then
        Window.Hide(Application.GetWndHandle());
        Dialog.Message("Error", "Autorun already running: code: already running");
        Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE);
    else
        Window.Show(Application.GetWndHandle());
    end

Similar Threads

  1. AMS6/PHP Single Sign On Control Panel
    By travis in forum AutoPlay Media Studio 6.0
    Replies: 0
    Last Post: 11-25-2005, 01:19 AM
  2. Single setup from current setup
    By utomo in forum Setup Factory 6.0
    Replies: 3
    Last Post: 05-25-2004, 12:51 PM
  3. Problem with IF and setting-files for single executables
    By SonG0han in forum AutoPlay Media Studio 5.0
    Replies: 6
    Last Post: 12-16-2003, 04:13 AM
  4. PROBLEM: Setup Requests Disk 2 in a Single File Setup
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-09-2002, 02:04 PM
  5. Mp3s on a Single Page
    By Michael in forum AutoPlay Menu Studio 3.0
    Replies: 2
    Last Post: 10-15-2001, 10:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts