Hi,

I wonder if there is any syntax that can detect if any Browserwindow is open on the computer and then close this/these windows.

I use Firefox and then would want to detect if any Firefox browserwindow is opened and then close them if any is open.

Thank you!

Usually, one would get the list of applications running and check if a particular application is in the list. In your case, you may want to check whether "firefox.exe" is running (or any other browsers). Once detected, kill the process and the browser will close.

NOTE: It may be too invasive to forcefully close the browser. It is better to prompt user to close it before proceeding.

I have started an instance like this and how would it be possible to programatically close this instance that was opened ?

Process::Start("Firefox.exe", "http://www.google.com");

Thanks...

Usually, one would get the list of applications running and check if a particular application is in the list. In your case, you may want to check whether "firefox.exe" is running (or any other browsers). Once detected, kill the process and the browser will close.

NOTE: It may be too invasive to forcefully close the browser. It is better to prompt user to close it before proceeding.

I think I am looking after this method where I will start a process and detect this opened process and kill() it but something with this code is not correct ?

I get this error:
(string, string) cannot be accessed with an instance reference; qualify it with a type name instead

Process^ myProcess = gcnew Process();
            myProcess->Start("Firefox.exe", "http://www.google.com");


            myProcess->Kill();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.