Showing results for March 2013 - The Old New Thing

Mar 29, 2013
0
0

How do I convert a method name to a method index for the purpose of INTERFACEINFO?

Raymond Chen
Raymond Chen

The IMessage­Filter::Handle­Incoming­Call method describes the incoming call by means of an INTERFACE­INFO structure: typedef struct tagINTERFACEINFO { LPUNKNOWN pUnk; IID iid; WORD wMethod; } INTERFACEINFO, *LPINTERFACEINFO; The wMethod is a zero-based index of the method within the interface. For example, IUnknown...

Code
Mar 28, 2013
0
0

The C language specification describes an abstract computer, not a real one

Raymond Chen
Raymond Chen

If a null pointer is zero, how do you access the memory whose address is zero? And if C allows you to take the address one past the end of an array, how do you make an array that ends at , since adding one to that value would wrap around? First of all, who says that there is a byte zero? Or a byte ? The C language does not describe an actual c...

Other
Mar 27, 2013
0
3

“Adjust visual effects for best performance” should really be called “Adjust visual effects for crappiest appearance”

Raymond Chen
Raymond Chen

In the Performance Options control panel, on the tab labeled Visual Effects, there is a radio button called Adjust for best performance. If you select it, then all the visual effects are disabled. But the name of that radio button has been wrong for a long time. It doesn't actually adjust your visual effects for best performance. It just adjusts ...

Tips/Support
Mar 26, 2013
0
0

There’s no law that says two people can’t have the same thing to eat

Raymond Chen
Raymond Chen

Some time ago, my group went out for a team lunch. It was to a restaurant we were not familiar with, so there was quite a bit of time studying the menu. As everybody looked over the menu, discussion naturally turned to "So what are you going to have?" "I think I'll have the salmon sandwich." One of my colleagues replied, "Oh, rats. I was think...

Non-Computer
Mar 25, 2013
0
0

Dreaming about a rather unusual guitar rehearsal

Raymond Chen
Raymond Chen

I dreamed that I watched a long-time colleague of mine rehearse the guitar in preparation for the new "hot pants" competition of the Miss Universe pageant. The scary thing is that the pageant may actually do it.

Non-ComputerDream
Mar 25, 2013
0
0

Using accessibility to monitor windows as they come and go

Raymond Chen
Raymond Chen

Today's Little Program monitors windows as they come and go. When people contemplate doing this, they come up with ideas like installing a WH_CBT hook or a WH_SHELL hook, but one of the major problems with those types of hooks is that they are injected hooks. Injection is bad for a number of reasons. It forces the hook to be in a DLL so it can be...

Code
Mar 22, 2013
0
1

When will GetMessage return -1?

Raymond Chen
Raymond Chen

A source of great consternation is the mysterious return value from : If there is an error, the return value is −1. For example, the function fails if is an invalid window handle or is an invalid pointer. That paragraph has caused all sorts of havoc, because it throws into disarray the standard message pump: But don't worry, the standard m...

Code
Mar 21, 2013
0
0

Does this operation work when file system redirection is disabled? The default answer is NO

Raymond Chen
Raymond Chen

A customer reported that when their program called to get the icon for a folder, the call failed. "It works on some machines but not others. We don't know what the difference is between the working and non-working machines." They included the offending function from their program, but everything in the function looked good. The problem was somethi...

Code
Mar 20, 2013
0
0

The x86 architecture is the weirdo: Structured exception handling

Raymond Chen
Raymond Chen

If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it's the other way around: The x86 architecture is the weirdo. I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured exception handling, "It would be int...

Other