Showing tag results for Code

Mar 17, 2010
Post comments count0
Post likes count0

What is DLL import hinting?

Raymond Chen
Raymond Chen

Binding and hinting are two types of optimizations to improve the load-time performance of a module (executable or DLL). We'll start with hinting, then look at binding, and then look at how it affects delay-loading. The import table for a module contains a list of DLLs and a list of functions from that DLL which the module wishes to link to. The b...

Code
Mar 12, 2010
Post comments count0
Post likes count0

Simplifying context menu extensions with IExecuteCommand

Raymond Chen
Raymond Chen

The interface is a simpler form of context menu extension which takes care of the annoying parts of so you can focus on your area of expertise, namely, doing the actual thing the user selected, and leave the shell to doing the grunt work of managing the UI part. I've never needed a scratch shell extension before, so I guess it's time to create...

Code
Mar 9, 2010
Post comments count0
Post likes count0

PSM_ISDIALOGMESSAGE is to modeless property sheets as IsDialogMessage is to modeless dialog boxes

Raymond Chen
Raymond Chen

Dialog boxes and property sheets are similar in that most of the time, you use them modally. You call or , and the function doesn't return until the user closes the dialog box or property sheet. But you can also use dialog boxes and property sheets modelessly, using or by including the flag when you call . One of the more common problems people...

Code
Mar 5, 2010
Post comments count0
Post likes count0

How do I access the magic IEEE floating point values like NaN in code?

Raymond Chen
Raymond Chen

There are functions like , , , and for detecting that a floating point value is one of the special values like NaN, but how do you actually generate one of these values? You can access these values from the template. Wait, where's negative infinity? The compiler folks provided these handy little definitions for when you need to generate ...

Code
Mar 4, 2010
Post comments count0
Post likes count0

What happens if I drag the mouse by exactly the amount specified by SM_CXDRAG?

Raymond Chen
Raymond Chen

The drag sensitivity is specified by the system metrics and . What happens if I drag the mouse by exactly the amount specified by these two parameters? Nothing. These parameters control the drag insensitivity of the mouse. If your mouse motion is less than or equal to this amount, then nothing happens. This is spelled out in the documentation...

Code
Mar 1, 2010
Post comments count0
Post likes count1

When does STARTF_USESHOWWINDOW override the parameter passed to ShowWindow()?

Raymond Chen
Raymond Chen

kokorozashi wants to know what the rules are which govern when the second parameter to is overridden by the flag. The guiding principle is that the parameter is ignored if the window manager thinks that the window you're creating is the application's main window. The details behind the implementation of this principle change over time, so ever...

Code
Feb 26, 2010
Post comments count0
Post likes count0

It's fine to use fibers, but everybody has to be on board with the plan

Raymond Chen
Raymond Chen

We saw fibers a long time ago when I looked at how you can use fibers as a form of coroutines to simplify the writing of enumerators. A fiber is a handy tool, but it's a tool with very sharp edges. Since fibers are promiscuous with threads, you have to be careful when running code that cares about what thread it is running on, because that code ...

Code
Feb 25, 2010
Post comments count0
Post likes count0

What happens to the fibers which ran on a thread when the thread exits?

Raymond Chen
Raymond Chen

What happens to the fibers which ran on a thread when the thread exits? Are all the fibers destroyed? No, only the currently-executing fiber is destroyed. Fibers running on other threads and fibers which are not running on any thread at all are not affected. Fibers do not have thread affinity (when not running), and they do not remember what thre...

Code