Showing tag results for Code

Jan 14, 2011
Post comments count0
Post likes count1

What's the difference between an asynchronous PIPE_WAIT pipe and a PIPE_NOWAIT pipe?

Raymond Chen
Raymond Chen

When you operate on named pipes, you have a choice of opening them in mode or mode. When you read from a pipe, the read blocks until data becomes available in the pipe. When you read from a pipe, then the read completes immediately even if there is no data in the pipe. But how is this different from a pipe opened in asynchronous mode by passin...

Code
Jan 13, 2011
Post comments count0
Post likes count1

The MARGINS parameter to the DwmExtendFrameIntoClientArea function controls how far the frame extends into the client area

Raymond Chen
Raymond Chen

A customer wrote a program that calls to extend the frame over the entire client area, but then discovered that this made programming difficult: I have a window which I want to have a glassy border but an opaque body. I made my entire window transparent by calling , and I understand that this means that I am now responsible for managing the alpha...

Code
Jan 5, 2011
Post comments count0
Post likes count1

Why does SHGetSpecialFolderPath take such a long time before returning a network error?

Raymond Chen
Raymond Chen

A customer reported that their program was failing to start up because the call to was taking a long time and then eventually returning with . The account that was experiencing this problem had a redirected network profile, "but even if he's redirecting, why would we get the bad net path error? Does calling actually touch the folder/network? If s...

Code
Dec 31, 2010
Post comments count0
Post likes count2

What makes RealGetWindowClass so much more real than GetClassName?

Raymond Chen
Raymond Chen

There's and then there's . What makes more real? Recall from last time that the functions were added to support Windows accessibility. The goal with is to help accessibility tools identify what kind of window it is working with, even if the application did a little disguising in the form of superclassing. If you ask for the class name o...

Code
Dec 30, 2010
Post comments count0
Post likes count1

WindowFromPoint, ChildWindowFromPoint, RealChildWindowFromPoint, when will it all end?

Raymond Chen
Raymond Chen

Oh wait, there's also . There are many ways of identifying the window that appears beneath a point. The documentation for each one describes how they work, but I figured I'd do a little compare/contrast to help you decide which one you want for your particular programming problem. The oldest functions are and . The primary difference between the...

Code
Dec 29, 2010
Post comments count0
Post likes count1

Psychic debugging: When I copy a file to the clipboard and then paste it, I get an old version of the file

Raymond Chen
Raymond Chen

A customer reported the following strange problem: I tried to copy some text files from my computer to another computer on the network. After the copy completes, I looked at the network directory and found that while it did contain files with the same names as the ones I copied, they have completely wrong timestamps. Curious, I opened up the file...

Code
Dec 23, 2010
Post comments count0
Post likes count1

What is the correct way of temporarily changing a thread's preferred UI language?

Raymond Chen
Raymond Chen

A customer ran into a crashing bug in their shell extension. The shell extension wants to change the thread's preferred UI language temporarily, so that it can load its resources from a specific language. You'd think this would be easy: Approximately ten seconds after this code runs, Explorer crashes with the exception whose description is "A ...

Code
Dec 22, 2010
Post comments count0
Post likes count2

The __fortran calling convention isn't the calling convention used by FORTRAN

Raymond Chen
Raymond Chen

Although the Microsoft C compiler supports a calling convention called , that's just what the calling convention is called; its relationship with the FORTRAN programming language is only coincidental. The keyword is now just an old-fashioned synonym for . Various FORTRAN compilers use different calling conventions; the one I describe here appli...

Code
Dec 21, 2010
Post comments count0
Post likes count1

How do I simulate input without SendInput?

Raymond Chen
Raymond Chen

Michal Zygmunt wants to create a system where multiple applications can have focus, with different users generating input and directing them at their target applications. Attempting to simulate this by posting input messages didn't work. "Can you tell us maybe how SendInput is internally implemented so that we can use it to simulate only part of...

Code
Dec 20, 2010
Post comments count0
Post likes count1

Developing the method for taking advantage of the fact that the OVERLAPPED associated with asynchronous I/O is passed by address

Raymond Chen
Raymond Chen

You can take advantage of the fact that the associated with asynchronous I/O is passed by address, but there was some confusion about how this technique could "work" when kernel mode has no idea that you are playing this trick. Whether kernel mode is in on the trick is immaterial since it is not part of the trick. Let's start with a version ...

Code