<p dir="auto">There are many native features that will require listening to windows messages and alter them.<br>
It's important to hook to the original wndproc so we'll be able to alter messages as well.<br>
After digging in I noticed there is a PreHandleMSG in here <a href="https://github.com/atom/electron/blob/master/atom/browser/native_window_views_win.cc#L81">https://github.com/atom/electron/blob/master/atom/browser/native_window_views_win.cc#L81</a><br>
And after a bit of testings I managed to affect the messages a windows is receiving.</p>
<p dir="auto">I wonder if it is the best way to hook into the wndproc<br>
Any thoughts?</p>
<p dir="auto">There are many native Windows features that will require listening to some <code class="notranslate">WM</code> or another. Right now there isn't a great way in Atom Shell to do this. AFAICT, your best bet is to:</p>
<ol dir="auto">
<li>Create your own native node module</li>
<li>Include <code class="notranslate">&lt;windows.h&gt;</code></li>
<li>Create a message-only <code class="notranslate">Hwnd</code> that is a child of your Atom window</li>
<li>Hook <code class="notranslate">WndProc</code> for whatever message you're interested in</li>
<li>Fire a callback to the JS</li>
</ol>
<p dir="auto">It would be <em>awesome</em> if there was a generic way to add a handler for a window message, and Atom Shell took care of the above steps natively. Something like:</p>
<div class="highlight highlight-source-coffee notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="messageCode = 262 # WM_SYSCHAR
browserWindow.hookWindowMessage messageCode, (wParam, lParam) -&gt;
  # Do your dirty work"><pre class="notranslate"><span class="pl-v">messageCode</span> <span class="pl-k">=</span> <span class="pl-c1">262</span> <span class="pl-c"><span class="pl-c">#</span> WM_SYSCHAR</span>
<span class="pl-smi">browserWindow</span>.<span class="pl-en">hookWindowMessage</span> messageCode, (<span class="pl-smi">wParam</span>, <span class="pl-smi">lParam</span>) <span class="pl-k">-&gt;</span>
  <span class="pl-c"><span class="pl-c">#</span> Do your dirty work</span></pre></div>