Showing tag results for Code

Mar 26, 2010
Post comments count0
Post likes count1

WaitForInputIdle waits for any thread, which might not be the thread you care about

Raymond Chen

We saw last time that the function waits only once for a process to go input idle. Even if the process later stops processing messages, will return immediately and say, "Yeah, he's idle." The way a process is determined to be input idle is that it is waiting for user input when there is none. This translates into the process sitting in a functi...

Code
Mar 25, 2010
Post comments count0
Post likes count1

WaitForInputIdle should really be called WaitForProcessStartupComplete

Raymond Chen

The function waits for a process to finish its initialization, which is determined when it reaches a state where it is just sitting around waiting for messages. The documentation for doesn't even get around to the initialization part until the Remarks section. If all you read is the one-sentence summary, Waits until the specified process is wait...

Code
Mar 19, 2010
Post comments count0
Post likes count1

How does delay-loading use binding information?

Raymond Chen

In the documentation for delay-loading, there's a remark that says that the call to can be avoided if there is binding information. A customer who received the explanation of why you can't delay-load pointed out that paragraph and asked whether this means that you can delay-load if you bind to it. (Getting around to answering this question wa...

Code
Mar 18, 2010
Post comments count0
Post likes count1

What is DLL import binding?

Raymond Chen

Last time, we saw how hinting is used to speed up the resolving of imported functions. Today, we'll look at binding. Recall that the module loader resolves imports by locating the function in the export table of the linked-to DLL and recording the results in the loaded module's table of imported function addresses so that code from the module ...

Code
Mar 17, 2010
Post comments count0
Post likes count1

What is DLL import hinting?

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 count1

Simplifying context menu extensions with IExecuteCommand

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 count1

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

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 count1

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

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