|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Multiple exe instances by versionI have developed code to determine if my application is open or not thereby
eliminating multiple instances of the same application. However I wish to allow different versions of the same application to be opened. For example if version 1 is open then version 2 can open, however if version 1 is open and the user tries to openup another version 1 then this is not allowed. Can this be done using app.major, minor and revision ??? Kind regards Martin D. Jones (Analyst / Programmer) On Thu, 22 Sep 2005 11:44:47 +0100, "Martin D. Jones"
<mart***@keysystems.co.uk> wrote: >I have developed code to determine if my application is open or not thereby I suppose you could make a Mutex out of those numbers>eliminating multiple instances of the same application. However I wish to >allow different versions of the same application to be opened. For example >if version 1 is open then version 2 can open, however if version 1 is open >and the user tries to openup another version 1 then this is not allowed. Can >this be done using app.major, minor and revision ??? Get the downloadable API Guide from : http://www.mentalis.org/agnet/ And have a look at CreateMutex - the 'Advanced PrevInstance' example will do the trick You should be able to use the App.PrevInstance property. It will only
return true if the same file is started more than once (it not even version dependant). Show quoteHide quote "Martin D. Jones" <mart***@keysystems.co.uk> wrote in message news:ut9uMJ2vFHA.4032@TK2MSFTNGP15.phx.gbl... >I have developed code to determine if my application is open or not thereby >eliminating multiple instances of the same application. However I wish to >allow different versions of the same application to be opened. For example >if version 1 is open then version 2 can open, however if version 1 is open >and the user tries to openup another version 1 then this is not allowed. >Can this be done using app.major, minor and revision ??? > > Kind regards > > Martin D. Jones > (Analyst / Programmer) > "Ted B" <some***@microsoft.com> wrote in message Which is not much help to the OP, he want to allow instances of each news:e6dcm57vFHA.724@TK2MSFTNGP14.phx.gbl... > You should be able to use the App.PrevInstance property. It will only > return true if the same file is started more than once (it not even > version dependant). version. The suggestion of using a mutex with the version number embedded is by far the best solution to the query as posed. Regards Dave. Show quoteHide quote > "Martin D. Jones" <mart***@keysystems.co.uk> wrote in message > news:ut9uMJ2vFHA.4032@TK2MSFTNGP15.phx.gbl... >>I have developed code to determine if my application is open or not >>thereby eliminating multiple instances of the same application. However I >>wish to allow different versions of the same application to be opened. For >>example if version 1 is open then version 2 can open, however if version 1 >>is open and the user tries to openup another version 1 then this is not >>allowed. Can this be done using app.major, minor and revision ??? >> >> Kind regards >> >> Martin D. Jones >> (Analyst / Programmer) >> > > Can someone explain mutex and how I would use it ??.
Show quoteHide quote "Dave" <Nob***@Nowhere.Com> wrote in message news:efhOs4DwFHA.3864@TK2MSFTNGP12.phx.gbl... > > "Ted B" <some***@microsoft.com> wrote in message > news:e6dcm57vFHA.724@TK2MSFTNGP14.phx.gbl... >> You should be able to use the App.PrevInstance property. It will only >> return true if the same file is started more than once (it not even >> version dependant). > > Which is not much help to the OP, he want to allow instances of each > version. The suggestion of using a mutex with the version number embedded > is by far the best solution to the query as posed. > > Regards > Dave. > >> "Martin D. Jones" <mart***@keysystems.co.uk> wrote in message >> news:ut9uMJ2vFHA.4032@TK2MSFTNGP15.phx.gbl... >>>I have developed code to determine if my application is open or not >>>thereby eliminating multiple instances of the same application. However I >>>wish to allow different versions of the same application to be opened. >>>For example if version 1 is open then version 2 can open, however if >>>version 1 is open and the user tries to openup another version 1 then >>>this is not allowed. Can this be done using app.major, minor and revision >>>??? >>> >>> Kind regards >>> >>> Martin D. Jones >>> (Analyst / Programmer) >>> >> >> > > "Martin D. Jones" <mart***@keysystems.co.uk> wrote in message This sample shows how to setup and use a Mutex (plus a few other goodies)news:%23RmFDGEwFHA.664@tk2msftngp13.phx.gbl... > Can someone explain mutex and how I would use it ??. > Registering File Associations and Passing Command Line Parameters to an Existing App Instance http://www.vbaccelerator.com/home/VB/Code/Libraries/Shell_Projects/Registering_File_Associations/article.asp -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. Right, each version would be a separate exe file and App.PrevInstance would
allow only one copy of each exe file to run. So if he had version1.exe and version2.exe, one copy of each would be allowed to run. Tedb Show quoteHide quote "Dave" <Nob***@Nowhere.Com> wrote in message news:efhOs4DwFHA.3864@TK2MSFTNGP12.phx.gbl... > > "Ted B" <some***@microsoft.com> wrote in message > news:e6dcm57vFHA.724@TK2MSFTNGP14.phx.gbl... >> You should be able to use the App.PrevInstance property. It will only >> return true if the same file is started more than once (it not even >> version dependant). > > Which is not much help to the OP, he want to allow instances of each > version. The suggestion of using a mutex with the version number embedded > is by far the best solution to the query as posed. > > Regards > Dave. > >> "Martin D. Jones" <mart***@keysystems.co.uk> wrote in message >> news:ut9uMJ2vFHA.4032@TK2MSFTNGP15.phx.gbl... >>>I have developed code to determine if my application is open or not >>>thereby eliminating multiple instances of the same application. However I >>>wish to allow different versions of the same application to be opened. >>>For example if version 1 is open then version 2 can open, however if >>>version 1 is open and the user tries to openup another version 1 then >>>this is not allowed. Can this be done using app.major, minor and revision >>>??? >>> >>> Kind regards >>> >>> Martin D. Jones >>> (Analyst / Programmer) >>> >> >> > > Forgot to mention that the following will also be caught be App.PrevInstance
and one of each can be run. \App Version 1\app.exe \App Version 2\app.exe Tedb Show quoteHide quote "Ted B" <some***@microsoft.com> wrote in message news:%23am96UIwFHA.3124@TK2MSFTNGP12.phx.gbl... > Right, each version would be a separate exe file and App.PrevInstance > would allow only one copy of each exe file to run. So if he had > version1.exe and version2.exe, one copy of each would be allowed to run. > > Tedb > > > "Dave" <Nob***@Nowhere.Com> wrote in message > news:efhOs4DwFHA.3864@TK2MSFTNGP12.phx.gbl... >> >> "Ted B" <some***@microsoft.com> wrote in message >> news:e6dcm57vFHA.724@TK2MSFTNGP14.phx.gbl... >>> You should be able to use the App.PrevInstance property. It will only >>> return true if the same file is started more than once (it not even >>> version dependant). >> >> Which is not much help to the OP, he want to allow instances of each >> version. The suggestion of using a mutex with the version number embedded >> is by far the best solution to the query as posed. >> >> Regards >> Dave. >> >>> "Martin D. Jones" <mart***@keysystems.co.uk> wrote in message >>> news:ut9uMJ2vFHA.4032@TK2MSFTNGP15.phx.gbl... >>>>I have developed code to determine if my application is open or not >>>>thereby eliminating multiple instances of the same application. However >>>>I wish to allow different versions of the same application to be opened. >>>>For example if version 1 is open then version 2 can open, however if >>>>version 1 is open and the user tries to openup another version 1 then >>>>this is not allowed. Can this be done using app.major, minor and >>>>revision ??? >>>> >>>> Kind regards >>>> >>>> Martin D. Jones >>>> (Analyst / Programmer) >>>> >>> >>> >> >> > > "Ted B" <some***@microsoft.com> wrote in message Whether App.PrevInstance will or will not work is not the problem. It willnews:%23$O%23IcIwFHA.720@TK2MSFTNGP15.phx.gbl... > Forgot to mention that the following will also be caught be App.PrevInstance > and one of each can be run. > > \App Version 1\app.exe > \App Version 2\app.exe > > Tedb > work "most" of the time. However, it does have flaws, and on occasion fail. Which is the better practice? Write code that usually works, or write code that will always work? -ralph (4 lines) <snipped> I do realize that App.PrevInstance has issues and limitations and it is not
a solution for all cases, but in this specific case it will function exactly as the OP wants (as far as I am understanding the question anyways). Tedb Show quoteHide quote "Ralph" <nt_consultin***@yahoo.com> wrote in message news:4-ednToFQJdKQanenZ2dnUVZ_tCdnZ2d@arkansas.net... > > "Ted B" <some***@microsoft.com> wrote in message > news:%23$O%23IcIwFHA.720@TK2MSFTNGP15.phx.gbl... >> Forgot to mention that the following will also be caught be > App.PrevInstance >> and one of each can be run. >> >> \App Version 1\app.exe >> \App Version 2\app.exe >> >> Tedb >> > > Whether App.PrevInstance will or will not work is not the problem. It will > work "most" of the time. However, it does have flaws, and on occasion > fail. > > Which is the better practice? Write code that usually works, or write code > that will always work? > > -ralph > (4 lines) > > <snipped> > > I really need to be able to read the exe's major, minor and revision no ???
Show quoteHide quote "Ted B" <some***@microsoft.com> wrote in message news:uGJAUYYwFHA.3312@TK2MSFTNGP09.phx.gbl... >I do realize that App.PrevInstance has issues and limitations and it is not >a solution for all cases, but in this specific case it will function >exactly as the OP wants (as far as I am understanding the question >anyways). > > > > Tedb > > > "Ralph" <nt_consultin***@yahoo.com> wrote in message > news:4-ednToFQJdKQanenZ2dnUVZ_tCdnZ2d@arkansas.net... >> >> "Ted B" <some***@microsoft.com> wrote in message >> news:%23$O%23IcIwFHA.720@TK2MSFTNGP15.phx.gbl... >>> Forgot to mention that the following will also be caught be >> App.PrevInstance >>> and one of each can be run. >>> >>> \App Version 1\app.exe >>> \App Version 2\app.exe >>> >>> Tedb >>> >> >> Whether App.PrevInstance will or will not work is not the problem. It >> will >> work "most" of the time. However, it does have flaws, and on occasion >> fail. >> >> Which is the better practice? Write code that usually works, or write >> code >> that will always work? >> >> -ralph >> (4 lines) >> >> <snipped> >> >> > > On Mon, 26 Sep 2005 09:14:23 +0100, "Martin D. Jones"
<mart***@keysystems.co.uk> wrote: >I really need to be able to read the exe's major, minor and revision no ??? App.Major> >"Ted B" <some***@microsoft.com> wrote in message >news:uGJAUYYwFHA.3312@TK2MSFTNGP09.phx.gbl... >>I do realize that App.PrevInstance has issues and limitations and it is not >>a solution for all cases, but in this specific case it will function >>exactly as the OP wants (as far as I am understanding the question >>anyways). App.Minor App.Revision Me.Print App.Major; App.Minor; App.Revision Personally I use my own version, set up as a Const in the code Revision auto increments on a compile to EXE (if you let it) - so there is a temptation to manually control it anyway app.major etc calls the open version ok but how (in code) would I compare
the two open sessions ? Show quoteHide quote "J French" <erew***@nowhere.uk> wrote in message news:4337daa3.4010124@news.btopenworld.com... > On Mon, 26 Sep 2005 09:14:23 +0100, "Martin D. Jones" > <mart***@keysystems.co.uk> wrote: > >>I really need to be able to read the exe's major, minor and revision no >>??? >> >>"Ted B" <some***@microsoft.com> wrote in message >>news:uGJAUYYwFHA.3312@TK2MSFTNGP09.phx.gbl... >>>I do realize that App.PrevInstance has issues and limitations and it is >>>not >>>a solution for all cases, but in this specific case it will function >>>exactly as the OP wants (as far as I am understanding the question >>>anyways). > > App.Major > App.Minor > App.Revision > > Me.Print App.Major; App.Minor; App.Revision > > Personally I use my own version, set up as a Const in the code > > Revision auto increments on a compile to EXE (if you let it) > - so there is a temptation to manually control it anyway On Thu, 22 Sep 2005 11:44:47 +0100, "Martin D. Jones"
<mart***@keysystems.co.uk> wrote: >I have developed code to determine if my application is open or not thereby One other thing>eliminating multiple instances of the same application. However I wish to >allow different versions of the same application to be opened. For example >if version 1 is open then version 2 can open, however if version 1 is open >and the user tries to openup another version 1 then this is not allowed. Can >this be done using app.major, minor and revision ??? I normally use a 'real' DLL that I wrote in Delphi for this - it locates other Apps with the same 'ID' and alows one to chat with them http://www.jerryfrench.co.uk/ebrdcast.htm People have done the same thing in pure VB |
|||||||||||||||||||||||