C cstangor Member Licensed User Longtime User Aug 26, 2014 #1 I end up opening the same form twice with frm.show. I'd like to know if it's already open so I don't. Thanks in advance.
I end up opening the same form twice with frm.show. I'd like to know if it's already open so I don't. Thanks in advance.
giga Well-Known Member Licensed User Longtime User Aug 26, 2014 #2 If I understand your question. You could open the task manager and look for javaw.exe and how many times it's listed. if you opened it twice it would be there twice. Upvote 0
If I understand your question. You could open the task manager and look for javaw.exe and how many times it's listed. if you opened it twice it would be there twice.
C cstangor Member Licensed User Longtime User Aug 26, 2014 #3 Thanks for the idea, but I need to do it programatically. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 27, 2014 #4 Create a single instance of this form and you will never have two forms displayed. Upvote 0
jmon Well-Known Member Licensed User Longtime User Aug 27, 2014 #5 giga said: You could open the task manager and look for javaw.exe and how many times it's listed. if you opened it twice it would be there twice. Click to expand... Actually with this method there is no way of knowing if this is that same program opened or another one. If you want to make sure you only run one instance of the program, you should compile your jar with Launch4J and check the "Allow only a single instance of the application" checkbox in the "single instance" tab. cstangor said: I end up opening the same form twice with frm.show. I'd like to know if it's already open so I don't. . Click to expand... It seems that it is actually not possible to show the MainForm.Show twice or more. Now if you actually built a class that displays another child form, then in your class you should contain a boolean variable that contains the "show" state of your window, a bit like this: Code: Copy Sub Class_Globals Private frm As Form Private isShown As Boolean = False End Sub Public Sub Show If Not(isShown) Then frm.Show isShown = True End If End Sub [edit] By the way, check my signature for "jAutoItX", there is a processList function that returns a list of the current processes. Upvote 0
giga said: You could open the task manager and look for javaw.exe and how many times it's listed. if you opened it twice it would be there twice. Click to expand... Actually with this method there is no way of knowing if this is that same program opened or another one. If you want to make sure you only run one instance of the program, you should compile your jar with Launch4J and check the "Allow only a single instance of the application" checkbox in the "single instance" tab. cstangor said: I end up opening the same form twice with frm.show. I'd like to know if it's already open so I don't. . Click to expand... It seems that it is actually not possible to show the MainForm.Show twice or more. Now if you actually built a class that displays another child form, then in your class you should contain a boolean variable that contains the "show" state of your window, a bit like this: Code: Copy Sub Class_Globals Private frm As Form Private isShown As Boolean = False End Sub Public Sub Show If Not(isShown) Then frm.Show isShown = True End If End Sub [edit] By the way, check my signature for "jAutoItX", there is a processList function that returns a list of the current processes.