Announcement

Collapse
No announcement yet.

How to ensure only one instance of a built menu can be run?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to ensure only one instance of a built menu can be run?

    Menus built from AMS3.0 can run in multiple instances. Is there any way of limiting such a menu to a single instance?

    TIA!

    ------------------
    --
    Sibelius Software Ltd, 66-68 Hills Road, Cambridge CB2 1LA, UK
    Tel: 01223 707100 (+44 1223 707100)
    Fax: 01223 707101 (+44 1223 707101)
    Web site: http://www.sibelius.com

    Also in London, San Francisco, New York, Nashville & Dallas

  • #2
    Re: How to ensure only one instance of a built menu can be run?

    You can set a temporary Registry key to use as a "there is an instance running" flag, and check for that key when your menu starts up. Something along the lines of:

    Right after the menu opens:

    1. check for Registry key, if found - exit (an instance is already running)

    2. if not found, create the Registry key (or set a value, etc.) and proceed normally

    Before the menu closes:

    3. delete the Registry key (or change the value, etc.)

    --[[ Indigo Rose Software Developer ]]

    Comment


    • #3
      Re: How to ensure only one instance of a built menu can be run?

      The only problem with this solution is if the user doesn't Exit the menu "properly", then the registry doesn't get cleared out. Therefore, the menu essentially won't run automatically again until the registry gets cleaned up/deleted.

      Any other thoughts on this?


      Comment


      • #4
        Re: How to ensure only one instance of a built menu can be run?

        Hi,
        If you are worried about that case, then simply remove the "before the menu closes" step. So basically your menu will perform steps 1, 2, and 3 in direct order.

        mark.

        MSI Factory The Next Generation Intelligent Setup Builder

        Comment


        • #5
          Re: How to ensure only one instance of a built menu can be run?

          You could add a batch file to the user's startup folder to remove that registry key on startup. (A batch file so that you can get past the prompt associated with .reg files...I don't remember the exact command line option you can pass to REGEDIT to make it suppress that prompt, but I think it's /y.) This would at least reset the registry key whenever the user reboots their system.

          I personally don't like things being added to my startup folder without my say-so, though.

          You could also write a launcher program to check for an instance of your menu, and only launch it if it isn't already running.

          --[[ Indigo Rose Software Developer ]]

          Comment


          • #6
            Re: How to ensure only one instance of a built menu can be run?

            Another solution that might be of use:

            Use a batch file to check for a temporary file or environment variable, as explained here:
            http://www.dlcwest.com/~jberkan/msdos/prevent.html

            Have the batch file run your autoplay menu if the temporary file/environment variable isn't found.

            You'll need to edit the autorun.inf file to call this batch file instead of the autoplay menu. I don't think you can call a .bat file from the autorun.inf, though -- you'll need to convert the .bat file to a .com file first, using bat2exe which you can find at:
            http://www.computerhope.com/dutil.htm

            If you need more help with this, just ask.


            [This message has been edited by Lorne (edited 09-13-2001).]
            --[[ Indigo Rose Software Developer ]]

            Comment

            Working...
            X