locked
VB.NET LAUNCH FIREFOX LIKE IE RRS feed

  • Question

  • I currently have code that launches IE via

    IE2 = NewSHDocVw.InternetExplorer


    Is there any way like this to launch Firefox or chrome browser using the same object type so I can tell when it is closed and fire off an event?

    Thursday, April 9, 2015 7:48 PM

Answers

  • Is there any way like this to launch Firefox or chrome browser using the same object type so I can tell when it is closed and fire off an event?

    You can find the current running processes using the Process class.  If you identify the process you are interested in, such as Firefox, then you can monitor it using the methods of that class.

    For instance, to get a process object for a named process, see:
    https://msdn.microsoft.com/en-us/library/z3w4xdc9(v=vs.110).aspx

    You can test the return value to see whether or not the process exists and start it if it doesn't.   Once you have the process, you can tie event handlers into the events that the process can raise. For instance, to get an event raised when the process exits, use this:
    https://msdn.microsoft.com/en-us/library/system.diagnostics.process.exited(v=vs.110).aspx

    • Proposed as answer by Rbie Friday, April 10, 2015 8:01 AM
    • Marked as answer by Carl Cai Monday, April 20, 2015 10:04 AM
    Friday, April 10, 2015 7:42 AM

All replies

  • Hi,

    The Vb.net forum is a better place for this question. I’ve moved it there for you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 10, 2015 6:07 AM
  • Afaik No, the internetexplorer object as the name suggest, only supports IE, there are alternative ways, but I don't know any.
    • Edited by Rbie Friday, April 10, 2015 8:07 AM
    Friday, April 10, 2015 6:37 AM
  • Is there any way like this to launch Firefox or chrome browser using the same object type so I can tell when it is closed and fire off an event?

    You can find the current running processes using the Process class.  If you identify the process you are interested in, such as Firefox, then you can monitor it using the methods of that class.

    For instance, to get a process object for a named process, see:
    https://msdn.microsoft.com/en-us/library/z3w4xdc9(v=vs.110).aspx

    You can test the return value to see whether or not the process exists and start it if it doesn't.   Once you have the process, you can tie event handlers into the events that the process can raise. For instance, to get an event raised when the process exits, use this:
    https://msdn.microsoft.com/en-us/library/system.diagnostics.process.exited(v=vs.110).aspx

    • Proposed as answer by Rbie Friday, April 10, 2015 8:01 AM
    • Marked as answer by Carl Cai Monday, April 20, 2015 10:04 AM
    Friday, April 10, 2015 7:42 AM
  • Using PIDs only works when the window is not tabbed. FireFox and Chrome drop their PIDs when they combine the tabs making the original launching PID useless. So that idea is off the table.

    The issue here is that I need to find the exact frame that is launched by my program and only kill that one frame not any other firefox or chrome frames open. I can do it with the DLL that IE provides because that DLL ties the object to that window only and when the object is closed it fires off a closed event that I can handle. I need to find a way to do this with the other 2 browsers also.

    Thursday, April 30, 2015 5:51 PM
  • I need to find a way to do this with the other 2 browsers also.

    The above responses refer to the resources available in .Net.  If you want to resolve the issue using interprocess communication facilities provided by FireFox or Chrome then the appropriate place to ask about those interfaces would be forums for those products.

    Thursday, April 30, 2015 10:50 PM