Weak references have no effect on object lifetime
The WeakReference class lets you retain a reference to an object while still permitting the object to be garbage collected. When that happens, then the IsAlive property is false and the Target...
View ArticleThe mathematical card game Krypto and reaching a level of proficiency where...
There is a mathematical card game known as Krypto. The rules are simple: Each card has a numeric value. Six cards are dealt face-up in the center of the table: One card is designated as the objective...
View ArticleOn partially-constructed objects, additional remarks, not as interesting
Don't worry. Our long national nightmare of CLR week is almost over. I had originally planned to write an article about partially-constructed objects, but in the time since I queued up the topic (back...
View ArticleWhy does the CLR report a NullReferenceException even if the referenced...
We saw some time ago that before invoking a method on an object, the CLR will generate a cmp [ecx], ecx instruction to force a null reference exception to be raised if you are trying to invoke a...
View ArticleEach time I move, my mailbox moves further away
When I was growing up, the mailman letter carrier came right to our front door. The mailbox was mounted on the front of the house right next to the front door. You could check the mail without even...
View ArticleHow do I convert a synchronous file handle into an asynchronous one?
Say you opened a file in synchronous mode, and then you realize that you want to issue asynchronous I/O on it, too. One way to do this is to call CreateFile a second time with the...
View ArticlePlease don't wade across the Strait of Juan de Fuca
I dreamed that I was visiting a scenic location near the Canadian border. A central large body of water had the mainland to the south and east. A river ran southeast, spanned by a footbridge. To the...
View ArticleGenerally speaking, yanking the power plug unexpectedly should not be part of...
A customer had a complex process for setting up their computers, and the process recorded information in the registry so that applications could record their state across reboots. They then noticed...
View ArticleWhat's the point of letting you change the GCL_CBCLSEXTRA if it has no effect?
The documentation for the SetClassLongPtr function mentions GCL_CBCLSEXTRA: Sets the size, in bytes, of the extra memory associated with the class. Setting this value does not change the number...
View ArticleHow do I control the order of the pages in property sheets from my shell...
A customer wanted to know whether a shell extension can control the order of the property sheet pages in a property sheet. The IShellPropSheetExt interface lets you add pages and replace pages, but...
View ArticleIf I signal an auto-reset event and there is a thread waiting on it, is it...
Let's go straight to the question: I have two programs that take turns doing something. Right now, I manage the hand-off with two auto-reset events. In Thread A, after it finishes doing some work, it...
View ArticleThe tiny table sorter - or - you can write LINQ in JavaScript
I had a little side project that displayed status information in a table, and I figured, hey, let me add sorting. And it was a lot easier than I thought. I just put the header row in the THEAD and the...
View ArticleA dream about forgetting to deploy the backup brake pads
I dreamed that that I was driving through a parking garage when my brakes suddenly failed. I tried executing turns to bleed off speed, but it was largely ineffective. I managed to avoid hitting a...
View ArticleMicrospeak: The train
Work on Windows occurs in several different branches of the source code, and changes in one branch propagate to other branches. The goal is to push changes toward the trunk on a regular cadence. I...
View ArticleAdding a confirmation dialog to every drag/drop operation does not solve the...
A customer wanted to know how to enable a confirmation dialog whenever the user inadvertently perform a drag/drop operation in Explorer to move files within a volume. For example, if I have an S drive...
View ArticleAll I/O on a synchronous file handle is serialized; that's why it's called a...
File handles are synchronous by default. If you want asynchronous file handles, you need to pass the FILE_FLAG_OVERLAPPED flag when you create the handle. And all operations on a synchronous file...
View ArticleIf I attach a file to an existing completion port, do I have to close the...
There are two ways of calling the CreateIOCompletioPort function. You can pass a null pointer as the ExistingCompletionPort parameter, indicating that you would like to create a brand new...
View ArticleWhy doesn't the "Automatically move pointer to the default button in a dialog...
The Mouse control panel has a setting called Automatically move pointer to the default button in a dialog box, known informally as Snap to default button or simply Snap To. You may have discovered...
View ArticleThe challenge of improvisational historical comedy
I dreamed that one of my friends signed me up for some sort of combination Punk'd/Thank God You're Here improv show without my knowledge, and I had to explain how her husband had unwittingly coined...
View ArticleHow can I find out which process and user is modifying a file?
When troubleshooting a problem, you may discover that a file is being modified that shouldn't, and you figure out would be nice if there were some way of finding out which process is modifying the...
View Article