How do I ShellExecute a file, but with a specific program instead of the...
The usual way to launch a file is to use ShellExecute, which opens the file in the default program registered to handle that type of file. But what if you want to override the default? We saw some...
View ArticleWhat’s the difference between VARIANT and VARIANTARG?
One of my colleagues asked me, "What's the difference between VARIANT and VARIANTARG?" If you look at the definitions in the oaidl.h header file, you'll see that VARIANTARG is just an alias for...
View ArticleExposing undefined behavior when trying to port code to another platform
A developer was porting some old Visual Studio code to another platform and found that the code was behavior strangely. Here's a simplified version of the code: class refarray { public: refarray(int...
View ArticleTime travel is here, at least when it comes to debugging
At CppCon 2017, the Time Travel Debugging team (TTD) came through with a present for all the developers out there: A reverse debugging tool! Time Travel Debugging in WinDbg Preview! Time Travel...
View ArticleMicrospeak: over-index
Some time ago, I wrote a document that discusses the design of a new component. In the document overview, I summarized how the component interacts with the host. If the host supports widgets, then the...
View ArticleWhy do I have to pass a valid page protection value to VirtualAlloc even if...
The VirtualAlloc function accepts a flProtect value, and even though the value is not used by MEM_RESET or MEM_RESET_UNDO, you still have to pass a valid value. (The documentation suggests...
View ArticleHow does Resource Monitor get information for processes that already terminated?
How does the Resource Monitor program get information for processes that have already terminated? Try it: Run Task Manager, then go to the Performance tab. From there, click Open Resource Monitor. Now...
View Article2017 year-end link clearance
Iconic 1980s pop music song Take On Me performed on airhorn. Previously: Take On Me: Literal Lyrics. At an exhibition tennis match, Kim Clijsters asks the crowd whether she should serve wide or down...
View ArticleHow do I know that Resource Monitor isn’t just retaining a handle to the...
A short time ago, I explained that Resource Monitor shows information for terminated processes for a little while, so you can see the results before they go away. it's not that Resource Monitor is...
View ArticleWhat happens when a huge number of people share a single grocery store...
Many years ago, one of my colleagues interviewed a candidate for a position in his group. The candidate worked with the data generated by a grocery store's customer loyalty cards. (Today, we would use...
View ArticleWhy are the module timestamps in Windows 10 so nonsensical?
One of the fields in the Portable Executable (PE) header is called TimeDateStamp. It's a 32-bit value representing the time the file was created, in the form of seconds since January 1, 1970 UTC. But...
View ArticleHow do I get the computer’s serial number? Consuming Windows Runtime classes...
Getting the computer's serial number used to be an arduous task of getting the system firmware table, and then manually parsing the SMBIOS information looking for the serial number. Windows 8...
View ArticleHow do I get the computer’s serial number? Consuming Windows Runtime classes...
Continuing our series on getting the computer's serial number in desktop apps in various languages, next up is C++/CX. From Visual Studio, create a new C++ Console Application that goes like this:...
View ArticleHow do I get the computer’s serial number? Consuming Windows Runtime classes...
Continuing our series on getting the computer's serial number in desktop apps in various languages, next up is C++/WinRT. From Visual Studio, create a new C++ Console Application that goes like this:...
View ArticleHow do I get the computer’s serial number? Consuming Windows Runtime classes...
Continuing our series on getting the computer's serial number in desktop apps in various languages, we look at C#. From Visual Studio, create a new C# Console Application that goes like this: class...
View ArticleHow do I get the computer’s serial number? Consuming Windows Runtime classes...
Continuing our series on getting the computer's serial number in desktop apps in various languages, we look at PowerShell. I warned you that you're going to be underwhelmed, so prepare to be...
View ArticleWhy is there a semicircular bar at the base of the ORCA card reader?
ORCA is the public transit card system for the Puget Sound area. One of my friends noticed that there is a semicircular bar at the base of ORCA card readers. You can see it in the following picture....
View ArticleWhat does it mean when the documentation says that you must specify the app...
The documentation for the SmbiosInformation class says The SerialNumber property securely retrieves the serial number from the SMBIOS for the system. This property is partial trust, so in a UWP app,...
View ArticleWhy don’t context menus respect the UI state for keyboard accelerators?
The WM_CHANGEUISTATE message lets you manipulate the UI state of a window, which controls whether keyboard accelerators and other UI affordances are shown. Let's use it to try to control the...
View ArticleHow do I know that Resource Monitor isnt just retaining a handle to the...
Not too long ago, I investigated whether the Resource Monitor retains an open handle to the process as its way to continue showing statistics after the process exited. I used Task Manager to termine...
View Article