Showing results for May 2013 - The Old New Thing

May 31, 2013
0
0

Posted messages are processed ahead of input messages, even if they were posted later

Raymond Chen
Raymond Chen

Regardless of which interpretation you use, it remains the case that posted messages are processed ahead of input messages. Under the MSDN interpretation, posted messages and input messages all go into the message queue, but posted messages are pulled from the queue before input messages. Under the Raymond interpretation, posted messages and in...

Code
May 30, 2013
0
0

The posted message queue vs the input queue vs the message queue

Raymond Chen
Raymond Chen

There are multiple ways of viewing the interaction between posted messages and input messages. MSDN prefers to view posted messages and input messages as part of one giant pool of messages in a message queue, with rules about which ones get processed first. I, on the other hand, prefer to think of posted messages and input messages as residing in ...

Code
May 29, 2013
0
0

What’s the point of SecureZeroMemory?

Raymond Chen
Raymond Chen

The function zeroes out memory in a way that the compiler will not optimize out. But what's the point of doing that? Does it really make the application more secure? I mean, sure the data could go into the swap file or hibernation file, but you need to have Administrator access to access those files anyway, and you can't protect yourself against a...

Code
May 28, 2013
0
0

Why don’t hotkeys for items on my Start menu work when I am in a fullscreen application?

Raymond Chen
Raymond Chen

You can set a hotkey on the shortcuts in your Start menu, and Explorer will launch that shortcut when you press the hotkey, but not if you are in a fullscreen application, like when you set Paint into fullscreen mode, or when you are displaying a PowerPoint presentation. Why are shortcut hotkeys ignored when a fullscreen application is running? T...

Tips/Support
May 27, 2013
0
0

What are the scoping rules for variables in nested courtyards?

Raymond Chen
Raymond Chen

I dreamed that I had to fix a bug caused by variable redeclaration inside a nested courtyard. Had to move the horses out of the way first. And then it got weird. I won't go into the orchestra rehearsal that turned out to be just a recording played on a loudspeaker in an empty concert hall. Because you wouldn't believe that part.

OtherDream
May 27, 2013
0
0

How do I customize the console properties for a shortcut to a console application?

Raymond Chen
Raymond Chen

You already know how to create a shortcut: #include <windows.h> #include <tchar.h> #include <shlobj.h> #include <atlbase.h> // class CCoInitialize incorporated here by reference int __cdecl _tmain(int argc, TCHAR **argv) { // error checking elided for expository purposes CCoInitialize init; CComPtr<IShellLink> ...

Code
May 24, 2013
0
0

What happens if I manually post an auto-generated message into my message queue?

Raymond Chen
Raymond Chen

As we well know, the window manager generates various messages on-demand rather than posting them into the queue at the time the event occurs. But what happens if you manually post one of these messages, like ? Does that clear the internal flag that says "This window needs a paint message?" Nope. The window manager does not have a prank call...

Code
May 23, 2013
0
0

Even though mouse-move, paint, and timer messages are generated on demand, it’s still possible for one to end up in your queue

Raymond Chen
Raymond Chen

We all know that the generated-on-demand messages like , , and messages are not posted into the queue when the corresponding event occurs, but rather are generated by or when they detect that they are about to conclude that there is no message to return and the generated-on-demand message can be returned. When this happens, the window manager c...

Code
May 22, 2013
0
0

How do I get a window back on the screen when it moved far, far away? Windows 7 (and 8) edition

Raymond Chen
Raymond Chen

Some time ago, I showed how to get a window back on the screen when it moved far, far away. That technique still works in Windows 7 and 8, but there's an easier shortcut that takes advantage of window arrangement features added in Windows 7. First, you switch to the application by whatever means. Then hit Win+UpArrow to maximize t...

Tips/Support
May 21, 2013
0
0

A question about proper disposal of unwanted items with an unhelpful answer

Raymond Chen
Raymond Chen

On an internal mailing list about home maintenance and ownership, somebody asked: I have a handful of items that I need to get rid of and probably should not toss into the regular garbage. Any thoughts? The best reply was an unhelpful one. You've pretty much got all the components you need to build a bomb. Why dispose of them?

Non-Computer