Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Function requirements are cumulative: If you fail to meet any of them, then...

A customer was having problems with the Wait­For­Multiple­Objects function: We are looking for a clarification of the behavior of Wait­For­Multiple­Objects. We have a thread that waits on two handles...

View Article


Image may be NSFW.
Clik here to view.

How can I generate a consistent but unique value that can coexist with GUIDs?

A customer needed to generate a GUID for each instance of a hardware device they encounter: The serial number for each device is 20 bits long (four and a half bytes). We need to generate a GUID based...

View Article


Image may be NSFW.
Clik here to view.

How do I monitor, or even control, the lifetime of an Explorer window?

A customer wanted help with monitoring the lifetime of an Explorer window. We want to launch a copy of Explorer to open a specific folder, then wait until the user closes the folder before continuing....

View Article

Image may be NSFW.
Clik here to view.

Paul Cézanne and Camille Saint-Saëns may have similar-sounding last names,...

Next week, the Seattle Symphony Orchestra performs the Saint-Saëns Organ Symphony, but the people responsible for the symphony's radio advertisements don't realize that. As the strains of the symphony...

View Article

Image may be NSFW.
Clik here to view.

Why did Win32 define BOOL as a signed int instead of an unsigned int?

Igor Levicki wants somebody from Microsoft to explain why BOOL was defined as a signed int instead of an unsigned int. You don't need to work for Microsoft to figure this out. All the information you...

View Article


Image may be NSFW.
Clik here to view.

Although the default icon for a shortcut is the icon of the target, you can...

A customer reported that a shortcut they deployed to their employees' desktops was triggering unwanted server traffic. My customer deploys a shortcut on %ALLUSERSPROFILE%\Desktop, and this shortcut...

View Article

Image may be NSFW.
Clik here to view.

How do I get the title of a dialog from a dialog resource?

A customer submitted the following question: We are developing automated tests for our application. Among other things, our application uses property sheets, which means that the name of the tab is...

View Article

Image may be NSFW.
Clik here to view.

Having an owner window from another process is tricky, but it's sometimes the...

A customer had a main program (let's call it A) and a helper program (let's call it B), and the customer wanted and wanted B to act like a modal dialog relative to A. When B is launched, we disable...

View Article


Image may be NSFW.
Clik here to view.

2011 Q1 link clearance: Microsoft blogger edition

It's that time again: Linking to other Microsoft bloggers. Alphabet soup on the Office Communicator blog. Sample sentence: "OCPE uses AutoDiscover and EWS on the CAS servers." Alfred Thompson points...

View Article


Image may be NSFW.
Clik here to view.

The introduction of whimsical teasing in Comic Chat

A few months after my post on the sad demise of whimsical teasing in Comic Chat, I received a piece of email from none other than the author of Comic Chat, DJ Kurlander: I was the person that started...

View Article

Image may be NSFW.
Clik here to view.

The funniest joke I've ever told (to a three-year-old)

I've tested this joke on several children ages three and four, and it never fails. There were two kittens walking down the street, and one of them fell on its butt! I developed this joke for one of my...

View Article

Image may be NSFW.
Clik here to view.

Windows is not a .NET Framework delivery channel either

We learned a while ago that Windows is not an MFC delivery channel. And, since you asked, it's not a .NET Framework delivery channel either. If you're developing a program that uses the .NET...

View Article

Image may be NSFW.
Clik here to view.

Lock-free algorithms: Choosing a unique value (warm-up)

Here's a snippet of code whose job is to generate a unique number within the process. Here's some reference reading to get yourself in the mood. Caution: It may or may not be useful. dwUniqueId =...

View Article


Image may be NSFW.
Clik here to view.

Lock-free algorithms: The singleton constructor

The first half may be familiar to many (most?) readers, but there's an interesting exercise at the bottom. A very useful pattern for the Interlocked* functions is lock-free lazy initialization via...

View Article

Image may be NSFW.
Clik here to view.

Lock-free algorithms: Choosing a unique value (solutions)

Last time, I left a warm-up exercise consisting of a code fragment which tries to compute a unique process-wide value. Here it is again: dwUniqueId = InterlockedCompareExchange(&g_dwUniqueId,...

View Article


Image may be NSFW.
Clik here to view.

Lock-free algorithms: The one-time initialization

A special case of the singleton constructor is simply lazy-initializing a bunch of variables. In a single-threaded application you can do something like this: // suppose that any valid values for a...

View Article

Image may be NSFW.
Clik here to view.

Lock-free algorithms: The singleton constructor (answer to exercises)

A few days ago, I asked you to make an existing class multithread-safe. The class caches objects called SINGLETON­INFO which are indexed by a 32-bit ID. The cache is implemented as an array that...

View Article


Image may be NSFW.
Clik here to view.

Patterns for using the InitOnce functions

Since writing lock-free code is is such a headache-inducer, you're probably best off making some other people suffer the headaches for you. And those other people are the kernel folks, who have...

View Article

Image may be NSFW.
Clik here to view.

Holding down the shift key when right-clicking lets you pin things to the...

Holding the shift key when calling up a context menu is a convention for indicating that you want to see additional advanced options which are normally hidden. One of those options is Pin to Start...

View Article

Image may be NSFW.
Clik here to view.

Lock-free algorithms: The try/commit/(try again) pattern

The singleton constructor pattern and the Interlocked­Multiply example we saw some time ago are really special cases of the more general pattern which I'll call try/commit/(try again). I don't know if...

View Article
Browsing all 3085 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>