I need to be able to start Firefox from my app and then get a handle to the Firefox browser window in order to move it, resize it, etc. In the app, Firefox is started using CreateProcessAsUser()
.
The problem is, Firefox uses a launcher process by default:
In Windows builds of Firefox, the Launcher Process is the initial process that is started when the user runs Firefox. Its sole purpose is to create the browser process in a suspended state, configure the browser process, resume the browser process, and then hand off GUI foreground to the browser. Once the launcher process has completed this objective, it exits.
Because Firefox uses a launcher process to launch the browser window, the PID returned by CreateProcessAsUser()
is not the PID of the browser window. So I can't use EnumWindows()
and match PIDs. I know that the Window class type for the browser window is MozillaWindowClass
, but it's possible there will be multiple windows of this type in my context.
How can I get a handle on the browser window in order to manipulate it programmatically?