Showing tag results for Code

Dec 20, 2010
Post comments count0
Post likes count0

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
Dec 17, 2010
Post comments count0
Post likes count1

The OVERLAPPED associated with asynchronous I/O is passed by address, and you can take advantage of that

Raymond Chen
Raymond Chen

When you issue asynchronous I/O, the completion function or the I/O completion port receives, among other things, a pointer to the structure that the I/O was originally issued against. And that is your key to golden riches. If you need to associate information with the I/O operation, there's no obvious place to put it, so some people end up doi...

Code
Dec 16, 2010
Post comments count0
Post likes count0

Why does SHCOLUMNINFO have unusually tight packing?

Raymond Chen
Raymond Chen

Alternate title: News flash: Sometimes things happen by mistake rbirkby asks why the structure has 1-byte packing. "Was the expectation that there would be so many columns in a details view that the saving would be worthwhile?" Hardly anything that clever or ingenious. It's just the consequence of a mistake. When the structure was added t...

Code
Dec 15, 2010
Post comments count0
Post likes count0

There is no interface for preventing your notification icon from being hidden

Raymond Chen
Raymond Chen

Yes, it's another installment of I bet somebody got a really nice bonus for that feature. A customer had this question for the Windows 7 team: Our program creates a notification icon, and we found that on Windows 7 it is hidden. It appears properly on all previous versions of Windows. What is the API to make our icon visible? First of...

Code
Dec 10, 2010
Post comments count0
Post likes count0

How do I limit the size of the preview window used by Aero Snap?

Raymond Chen
Raymond Chen

A customer reported that the translucent preview shows by Aero Snap showed the wrong dimensions for their application window. "As you can see in the screen shot, the preview is too wide. Our application window has a maximum width, but the preview is fully half the width of the screen. How can we disable the Aero Snap feature?" Whoa there, givin...

Code
Dec 9, 2010
Post comments count0
Post likes count0

We've traced the call and it's coming from inside the house: Grid lines in list view report mode

Raymond Chen
Raymond Chen

A customer wanted to know how to remove the grid lines from a list view control in report mode. The customer was kind enough to include the source code for the relevant part of the program and drew our attention to the line in the resource file that he believed to be the source of the problem: The customer didn't know it, but that line in the r...

Code
Dec 6, 2010
Post comments count0
Post likes count0

TrackMouseEvent tracks mouse events in your window, but only if the events belong to your window

Raymond Chen
Raymond Chen

Greg Williams wonders why fails to detect mouse hover events when responding to Do­Drag­Drop callbacks. "My suspicion is that monopolizes the window so that a message is never posted, so it won't end up being useful." That's basically it, for the appropriate sense of the word "monopolize." The monitors mouse events that take place in...

Code
Dec 2, 2010
Post comments count0
Post likes count0

The alignment declaration specifier is in bytes, not bits

Raymond Chen
Raymond Chen

Explicit object alignment is not something most people worry about when writing code, which means that when you decide to worry about it, you may be a bit rusty on how the declarations work. (After all, if it's something you worried about all the time, then you wouldn't have trouble remembering how to do it!) I was looking at some customer code,...

Code
Nov 26, 2010
Post comments count0
Post likes count0

The easy way out is to just answer the question: What is the current Explorer window looking at?

Raymond Chen
Raymond Chen

A customer had the following question: We have an application which copies and pastes files. Our problem is that we want to paste the files into the folder which corresponds to the currently active Windows Explorer window. Right now, we're using , but we find this method unsatisfactory because we want to replace Explorer's default file copy engine...

Code
Nov 22, 2010
Post comments count0
Post likes count1

Consequences of using variables declared __declspec(thread)

Raymond Chen
Raymond Chen

As a prerequisite, I am going to assume that you understand how TLS works, and in particular how variables work. There's a quite thorough treatise on the subject by Ken Johnson (better known as Skywing), who comments quite frequently on this site. The series starts here and continues for a total of 8 installments, ending here. That last page al...

Code