How to make application only run one copy at a time? 
Author Message
 How to make application only run one copy at a time?

Hi,
can any one tell me how to make an application so that only one copy copy
can be run per machine at a time?
(I am using VB 5 on Windows NT)

Thanks in Advance
Arvinder Sansoa



Mon, 23 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
[This followup was posted to microsoft.public.vb.syntax and a copy was
sent to the cited author.]



Quote:
> Hi,
> can any one tell me how to make an application so that only one copy copy
> can be run per machine at a time?
> (I am using VB 5 on Windows NT)

> Thanks in Advance
> Arvinder Sansoa


Hello,

use the property App.PrevInstance: this one returns true if there is
already a copyt of your program running

--
Wanna thank me? Sign my GuestBook.
FlyKiller's Coding Room: http://users.atmosphere.be/flykiller
HomePage: http://home.tvd.be/ws36009



Mon, 23 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
Check out article Q142937 of the KB or else have a look at the
App.PrevInstance property.

HTH
--
VB-Joker
MCSE

Please post all replies to newsgroup!


Quote:
>Hi,
>can any one tell me how to make an application so that only one copy copy
>can be run per machine at a time?
>(I am using VB 5 on Windows NT)

>Thanks in Advance
>Arvinder Sansoa




Mon, 23 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
Check the VB syntax for

        App.PrevInstance



Quote:
> Hi,
> can any one tell me how to make an application so that only one copy copy
> can be run per machine at a time?
> (I am using VB 5 on Windows NT)

> Thanks in Advance
> Arvinder Sansoa




Tue, 24 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
You can download a good example of the PrevInstance property from my web
site.  This also shows how to deal with the application after you have
determined if it is already running.

www.cease.demon.co.uk

Good luck

Colin Anderson
www.cease.demon.co.uk


Quote:
>Hi,
>can any one tell me how to make an application so that only one copy copy
>can be run per machine at a time?
>(I am using VB 5 on Windows NT)

>Thanks in Advance
>Arvinder Sansoa




Tue, 24 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
Check to see if an instance is already running use the app.previnstance.

if App.PrevInstance then
    msgbox "Program is already running"
    end
end if

It will return TRUE if the application is already running, FALSE if it is
not.


Quote:
>Hi,
>can any one tell me how to make an application so that only one copy copy
>can be run per machine at a time?
>(I am using VB 5 on Windows NT)

>Thanks in Advance
>Arvinder Sansoa




Tue, 24 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?

Quote:

> Hi,
> can any one tell me how to make an application so that only one copy copy
> can be run per machine at a time?
> (I am using VB 5 on Windows NT)

> Thanks in Advance
> Arvinder Sansoa


If the app is already running this routine will shift the focus to
that first instance of the app, if it is minimized, it will be restored.
Place it in Form1's load event.  This is VB3 code.  Not sure
if it will run as is.

    If App.PrevInstance Then
        ProgramName$ = App.Title
        App.Title = "second instance"
        Form1.Caption = "second instance"
        AppActivate ProgramName$
        SendKeys "% R", True
        End
    End If

Happy programming...



Tue, 24 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
For years, I was successful in using the documented approach with my VB3
app.  In NT 4.0 if we check the run in separate memory space, the code no
longer works. What happens is the new copy doesn't see the previous one
because it is in a separate portion of memory.

We need a newer solution to this problem.
I wonder if a VB6 implementation will fix it?

- IanO -

Quote:
>Hi,
>can any one tell me how to make an application so that only one copy copy
>can be run per machine at a time?
>(I am using VB 5 on Windows NT)



Fri, 27 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
Check out this Knowledge Base Article: Q185730, HOWTO: Prevent Multiple
Instances of a 32-bit VB Application

Jeff


Quote:
>Hi,
>can any one tell me how to make an application so that only one copy copy
>can be run per machine at a time?
>(I am using VB 5 on Windows NT)

>Thanks in Advance
>Arvinder Sansoa




Sun, 29 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
You might also want to check out couple other samples listed at CodeGuru

http://www.codeguru.com/vb

Quote:

> Check out this Knowledge Base Article: Q185730, HOWTO: Prevent Multiple
> Instances of a 32-bit VB Application

> Jeff



> >Hi,
> >can any one tell me how to make an application so that only one copy copy
> >can be run per machine at a time?
> >(I am using VB 5 on Windows NT)

> >Thanks in Advance
> >Arvinder Sansoa




Mon, 30 Apr 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
Sorry If I have missed something here, but isn't app.previnstance enough ?
--
=============================================================
Hakuna Matata

Stumphunters Bike Page ... Land of the Norfolk Mountain Biker

http://www.geocities.com/Pipeline/Ramp/5486



Tue, 01 May 2001 03:00:00 GMT  
 How to make application only run one copy at a time?
Try this in your startup code (e.g. Sub Main):

--------------
Const MAIN_WINDOW_CAPTION As String = "...your main window caption..."

'Verify if the application is already running, if yes then
'switch to the old instance and kill this one.
If App.PrevInstance Then
  App.Title = "Dup of " & App.Title
  'Must use MAIN_WINDOW_CAPTION, (App.Title won't work if window
  'is minimized)
  AppActivate MAIN_WINDOW_CAPTION
  DoEvents
  'Alt <space> R will restore the old instance
  SendKeys "% R", True
  End
End If
'Here we know there are no previous instances, open the main form
...your main form....Show
--------------

This code works for Win 9x, you may have to adjust it for NT.

Good luck,

Wojtek


Quote:
>Hi,
>can any one tell me how to make an application so that only one copy copy
>can be run per machine at a time?
>(I am using VB 5 on Windows NT)

>Thanks in Advance
>Arvinder Sansoa




Wed, 02 May 2001 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Prevent running my.exe in more than one copy @ same time

2. Copying one picture to another at run-time...

3. calling one application from one running

4. How to run the VB application and Acces application in the same time

5. Problem making references at run-time to Startup templates

6. Run-time error when making selection in Word from Access

7. Making custom Run-Time files in PDS

8. making a mdi form a form during run time with click event

9. Making a Run-Time Compiler

10. Making controls at run-time

11. Making a window non-sizeable at run-time (VB5)

12. making an array of labels at run time

 

 
Powered by phpBB® Forum Software