Showing results for February 2011 - Page 2 of 3 - The Old New Thing

Feb 18, 2011
Post comments count0
Post likes count0

WM_NCHITTEST is for hit-testing, and hit-testing can happen for reasons other than the mouse being over your window

Raymond Chen
Raymond Chen

The message is sent to your window in order determine what part of the window corresponds to a particular point. The most common reason for this is that the mouse is over your window. Although triggers most often for mouse activity, that is not the only reason why somebody might want to ask, "What part of the window does this point correspond...

Code
Feb 17, 2011
Post comments count0
Post likes count0

What is the highest numerical resource ID permitted by Win32?

Raymond Chen
Raymond Chen

A customer asked the following question: What is the maximum legal value of a resource identifier? Functions like take a as the resource ID, which suggests a full 32-bit range, but in practice, most resource IDs appear to be in the 16-bit range. Is there any particular history/precedent for avoiding large numbers as resource IDs? (I have a progr...

Code
Feb 16, 2011
Post comments count0
Post likes count0

What is the difference between a directory and a folder?

Raymond Chen
Raymond Chen

Windows 95 introduced Windows Explorer and along with it the term folder. What is the relationship between folders and directories? Some people believe that Windows 95 renamed directories to folders, but it's actually more than that. Windows Explorer lets you view folders, which are containers in the shell namespace. Directories are on...

Other
Feb 15, 2011
Post comments count0
Post likes count0

Window message parameters do not come with metaphysical certitude

Raymond Chen
Raymond Chen

The MSDN documentation for window messages describes what each of the parameters means, but just because it means something doesn't mean that it is that something; it merely means it. But you knew this already. If you have a window handle, you can send it whatever message you like, with whatever parameters you like, even if those parameters contra...

Code
Feb 14, 2011
Post comments count0
Post likes count0

What happens when you email the people in the I'm a PC commercial?

Raymond Chen
Raymond Chen

In 2008, the first I'm a PC ad aired, opening with Sean Siler doing an impression of John Hodgman portraying a PC, and continuing with montage of people proudly announcing, "I'm a PC!" Accompanying the first four people to appear on screen are email addresses. The addresses are live (or at least they were when the campaign launched), and if you ...

History
Feb 11, 2011
Post comments count0
Post likes count0

Any intelligent human being

Raymond Chen
Raymond Chen

The story of The Best reminded me of a classmate from school who was inordinately fond of the phrase any intelligent human being. For example, our classmate would say, "Any intelligent human being would do X" or "It's obvious to any intelligent human being that Y." (I often—but not always—consider myself to be an intelligent ...

Non-Computer
Feb 11, 2011
Post comments count0
Post likes count0

How do specify that a shortcut should not be promoted as newly-installed on the Start menu?

Raymond Chen
Raymond Chen

Windows XP employed a number of heuristics to determine which Start menu shortcuts should be promoted when an application is newly-installed. But what if those heuristics end up guessing wrong? You can set the property to to tell the Start menu, "I am not the primary entry point for the program; I'm a secondary shortcut, like a help file." ...

Code
Feb 10, 2011
Post comments count0
Post likes count0

Psychic debugging: Because of course when something doesn't work, it's because the program was sabotaged from above

Raymond Chen
Raymond Chen

When something stops working, you begin developing theories for why it doesn't work, and normally, you start with simple theories that involve things close to you, and only after you exhaust those possibilities do you expand your scope. Typically, you don't consider that there is a global conspiracy against you, or at least that's not usually you...

Other
Feb 9, 2011
Post comments count0
Post likes count0

Why does SHGetKnownFolderPath return E_FAIL for a known folder?

Raymond Chen
Raymond Chen

A customer reported having problems with the function. I've left in the red herrings. On Windows 7, I'm trying to retrieve the Internet folder with the following code: The call always fails with . What am I doing wrong? I tried passing as the token, but that didn't help. The reason the call fails has nothing to do with Windows ...

Code