LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CheckForDuplicateAppInstance under Windows XP

Is there any problem with CheckForDuplicateAppInstance running under Windows XP?

I have just tried running oneinst sample project and found I was able torun it mulple times without problems Smiley Surprised Smiley Frustrated

 

checkforduplicateappinstance.PNG

The system is WIndows XP PRO SP3 with full updates installed; the project is standard CVI2012 sample compiled and run multiple times. Ide is CVI2012 SP1 [ 12.0.1.127 ] the same as the run-time engine. CheckForDuplicateAppInstance returns no error and of course it returns no other instance running.

 

This is annoying since several of my customers are still using XP and I have this call in every application exactly to prevent more than one instance running...



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 5
(4,370 Views)

Hi Roberto,

 

I have tried this on my WinXP Pro SP3 after compiling from CVI IDE 8.5.1 and 2013 SP1.

(Well, IDE version were different but probably the run-time was the same for both)

 

I can repeat that behaviour only if I do not explicitly terminate the program.

If you do nothing explicitly in your code, the function does not automatically turn off your application.

 

The functions outputs (second parameter pass by reference) whether there is already another instance is running or not.

You need to take action if that value is 1.

 

Hope this helps,

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 5
(4,334 Views)

Hi eren,

thanks for looking into it but I don't understand your comment: I do not want to stop my application, I want that while the application is running I cannot launch it another time!

At present, immediately after starting the PC (so no program was launched and killed improperly before that moment) I can launch oneinst application several times. without quitting any of them, and this is undesirable.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 5
(4,325 Views)

Maybe I did not understand you in the first place 😉 I will try to make myself clear.

 

What I am trying to say is, CheckForDuplicateAppInstance does not prevent or block other instances from executing.

It just informs you that there is another instance running. Whether you take action or not depends on you.

 

You can terminate that instance of your program when you realize (using the output of the function) that another instance is already running.

You can call the function immediately after InitCVIRTE and you will return from main if the second parameter returns true.

This will quit your second instance.

 

I attached my project.

If you compile and run it, you will see that extra instances can not display their panel.

If you comment line 50, then you can run multiple instances.

 

There is a very similar sample code in NI online help also.

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 5
(4,322 Views)

Ok, all is clear now.

I am experimenting with a sample project from NI (samples\utility\oneinst.prj) that is intended exactly to demonstrate CheckForDuplicateAppInstance features; its code is very similar to yours: it should prevent other instances to run but it does not on my machine. Smiley Frustrated

 

It could be that my machine is faulty, but as far as I know this is the only strange thing I'm seeing; or that particular run-time could have problems under Xp; it could even be due to something else I cannot figure at the moment. Till now I record that on your machine all works well. In the next days I will visit a customer of mine and I will make some checks there.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(4,317 Views)