1

I have an ElectronJS app with 2 buttons: "FF" and "IE", when I click on them, it opens the related browser via Node Childprocess spawn function.

Now, I want, somehow, to resize the opened browser window to be 600*600px (for instance).

I tried to looks if Electron has some functionality to do that but I can't find nothing, I also tried to understand if I can do it thru windows CLI but also didn't find anything.

Do anyone have some idea how to perform this such behavior?

Thank you!

Shlomi
  • 3,622
  • 5
  • 23
  • 34

1 Answers1

1

The answers in How do I change another program's window's size? should give you some ideas, you can call Win32 APIs in Electron using node-ffi or from a native Node module.

Vadim Macagon
  • 14,463
  • 2
  • 52
  • 45
  • Thanks Vadim, with `node-ffi` i assume you meant to call some DLL file that make the resizing/reposition, right? – Shlomi Mar 10 '17 at 09:27
  • @ShlomiSasson Correct, the `MoveWindow` function for example lives in `User32.dll`, so you could use `node-ffi` to load that dll and then call the function. – Vadim Macagon Mar 10 '17 at 09:30
  • Sounds good, ill try soon. BTW, if i have the PID of the browser window, is it enough to get the window handler inside the DLL? – Shlomi Mar 10 '17 at 09:34