Public Function FormsRunning(ByVal FormName As String) As Integer
' Return number of forms with name FormName in this application
Dim Count As Integer
Dim i As Integer
Count = 0
For i = 0 To My.Application.OpenForms.Count - 1
If My.Application.OpenForms.Item(i).Text = FormName Then
Count += 1
Now you can test if the form should be opened:
If FormsRunning("File Download") = 0 Then
' Open your form
Hi! Sorry for inadequate explanation. I'll give you an example with Notepad:
If ProcessesRunning("Notepad") = 0 Then
' Notepad is not running
If ProcessesRunning("Notepad") = 1 Then
' Notepad is running (one instance)
If ProcessesRunning("Notepad") > 1 Then
' User has started more than one Notepad intances
And the process name in Task Manager is Notepad.exe.
Start one download and check from Task Manager/Processess how it's displayed in there. You should find it from there, just like "Notepad.exe"->"Notepad".
When processes running "File Download" is > 1 then it means that the download is not running?
No, it means that one download is running and the user has started a second (or third...) download, see the examples above.
im having a hard time to figure out what i have to put in place of the "Notepad". could you possibly make a rapidshare download and see if you can find out how to check if the download dialog is running
Open the Task Manager, check which processes are running. Start download with RapidShare and re-check processes in Task Manager.
If I understand it right, "File Download" dialog comes from the browser (?). In that case you won't see it in the process list. For example, if you have two Firefox instances running, you'll see only one Firefox process. If this is the case, you'll have to use some other approach to check "File Download" dialog. What that would be, doesn't come in to mind straight away. But I'm sure there's some way to find out if you have "File Download" dialog open, it's just not a process like I assumed in the first place.