Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The reason your window was not receiving the <code>WM_TIMECHANGE</code> messages is that your window is created from a secondary thread.</p> <p>Each thread in a process has its own message queue. Synchronous messages are delivered when you service the message queue, so ever for a non-queued message like <code>WM_TIMECHANGE</code> you do need to service the secondary threads message queue in order for messages to be delivered.</p> <p>For example, look at the documentation for <a href="http://msdn.microsoft.com/en-gb/library/windows/desktop/ms644936.aspx" rel="noreferrer"><code>GetMessage</code></a>, the most common way to pull messages of the queue:</p> <blockquote> <p>The function dispatches incoming sent messages until a posted message is available for retrieval.</p> </blockquote> <p>The same is true for <code>PeekMessage</code>. It dispatches incoming sent messages before peeking the queue.</p> <p>There are a handful of other ways for sent messages to be dispatched, but these are the primary ones.</p> <p>Now, I suspect that it may be inconvenient for you to periodically dispatch messages from your secondary thread. If your secondary thread does nothing else then it can simply sit in the traditional <code>GetMessage</code>, <code>TranslateMessage</code>, <code>DispatchMessage</code> loop. And most of the time it will happily block in <code>GetMessage</code> dispatching any incoming sent messages. But if your secondary thread does more work then that's probably not a viable option.</p> <p>You are already running and servicing a message queue on the main service thread. It may make more sense to make your listener window have affinity with the main service thread. Do that by creating it from code that runs in the main service thread.</p> <p>Note also that <code>AllocateHWnd</code> is documented not to be thread-safe. You must not call it from any thread other than the main thread of the process. So, if you do wish to remain on a secondary thread, you'll need to use <code>CreateWindow</code> rather than <code>AllocateHWnd</code>. But this is perhaps yet another good reason to move this window onto the main thread.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload