title: How use the returned "buffer" of Electronjs function "getNativeWindowHandle()" in native functions?
body: <p>I use the electronjs function <code>getNativeWindowHandle()</code> to find the HWND of electron main window.</p>
  
  <p>I.e. one log was: <code>&lt;Buffer@0x00000293A66F0450 ec 02 07 00 00 00 00 00&gt;</code></p>
  
  <p>Converted to HEX: <code>ec02070000000000</code></p>
  
  <p>But the real HWND is: <code>459500</code>, obtained doing </p>
  
  <p><code>handleElectron.substring(0, 6).match(/.{1,2}/g)</code>, to have the three first couples of the string, then</p>
  
  <p><code>newhandle = handleElectron[2] + handleElectron[1] + handleElectron[0];</code> because the handle has the the fist two and the third two chars inverted.</p>
  
  <p>Then I use <code>parseInt(handleElectron, 16) &lt;&lt; 8) / 256</code> to obtain the decimal</p>
  
  <p>Same result doing: <code>user32.FindWindowW(TEXT('Chrome_WidgetWin_1'), null);</code> (native function via node-ffi), </p>
  
  <p>but I need to put it in a while loop because the <code>FindWindowW</code> sometimes gives 0.</p>
  
  <p>Is there a cleaner and correct way to convert the result of <code>getNativeWindowHandle()</code> in HWND usable by <code>FindWindowW</code> or any other native functions?</p>