Why is Alt+F4 the hotkey for closing a window? Why not Alt+F5 or Alt+F3?
In a One Dev Question video, I discussed why Alt+F4 is the hotkey for closing a window. That explains why it's a function key rather than an alphabet key, but why F4 specifically? Why not F5 or F3?...
View ArticleWhy did every Windows 3.0 DLL have an exported function called WEP?
One of the quirks of Windows 3.0 was this function called WEP, which was exported by every DLL. And yet if you looked at every DLL, you'd see that the function did nothing but return. What's the deal...
View ArticleWhat do the various regsvr32 exit codes mean?
The exit codes for the regsvr32 program are currently as follows: Exit code Meaning 0 Success 1 Error parsing command line 2 OleInitialize failed 3 LoadLibrary failed 4 GetProcAddress failed 5...
View ArticleWhy is regsvr32 exiting with code 3?
A customer had a script to set up a virtual machine, but this call was failing: regsvr32 /s /n /i:u Awesome.dll The DLL failed to register, and regsvr32 exited with code 3. Last time, we saw exit code...
View ArticleWhy does the compiler turn my conditional loop into an infinite one?
A customer asked why the compiler turned their conditional loop into an infinite one. #include <windows.h> int x = 0, y = 1; int* ptr; DWORD CALLBACK ThreadProc(void*) { Sleep(1000); ptr =...
View ArticleHow do I prevent my program’s temporary documents from appearing in Search?
A customer wanted to know how to disable Cortana and Search completely on their employees's systems. "A user should not be able to search for anything from anywhere." That seems a rather broad...
View ArticleWhat does the thread parameter to SetWindowsHookEx actually mean?
The SetWindowsHookEx function has a dwThreadId parameter for which the documentation says The identifier of the thread with which the hook procedure is to be associated. What does it mean for a...
View ArticleConsidering the performance implications of converting recursion to an...
Suppose you have a recursive algorithm, such as in-order tree walking. void add_to_each_node_recursive(Node* root, int extra) { if (!root) return; root->value += extra;...
View ArticleCan you wear wallpaper on your feet? You can if it’s a PARTY.BMP!
A colleague of mine alerted me to a pair of socks for sale based on the PARTY.BMP wallpaper from Windows 3.0. So that happened.
View ArticleThe sad history of the C++ throw(…) exception specifier
When exceptions were introduced into the C++ language, a corresponding throw(...) dynamic exception specifier was introduced which annotated which exceptions could be throw by a function. // this...
View ArticleGenerating a table with vertical text, like I did with the sad history of the...
In The sad history of the C++ throw(...) exception specifier, I presented some tables with vertical text. Here's how I did it. (I simplified the table a bit to allow me to focus on the part that does...
View ArticleAll sorts of bad things happen when we disable the Task Scheduler service, is...
A customer disabled the Task Scheduler service by applying group policy to set Task Scheduler's startup mode to Off. When they did that, they found that a lot of stuff stopped working. For example,...
View ArticlePractical example of why you need to leave room for German localization
Consider the following household kitchen item: The sink saddle. It is a mat that goes over the divider in a double sink. Here's what it says on the label: SINK SADDLE TAPIS D’ÉVIER PROTECTOR DE...
View ArticleCan I be sure that turning on automatic generation of short file names will...
A customer wanted to know if adminstrative permissions were sufficient to enable generation of short file names (8 dot 3). Their plan was to set the registry key, call GetShortFileName to get the...
View ArticleHow can I use WS_CLIPCHILDREN and still be able to draw a control with a...
A customer was using an MFC CHtmlDialog as a child dialog and found that they needed to add the WS_CLIPCHILDREN style to ensure that the contents appeared on the screen; otherwise, the parent dialog...
View ArticleWhen I call CryptProtectData with the same parameters, why aren’t the...
If you call CryptProtectData twice in a row with the same parameters, you get different results. Why are the results inconsistent? The plaintext is the same. The entropy is the same. The key is the...
View ArticleThe numerology of the sample directory listing in the Windows 95 font...
In Windows 95, it became tradition that if you modified the code that displays the font preview in the Windows 95 command prompt font chooser property sheet page, you also got to tweak the sample date...
View ArticleNotes on DrawText and tab stops
The DrawText function will recognize tab characters if you ask for DT_EXPANDTABS. And then things get weird. If you ask for DT_EXPANDTABS, then you cannot ask for any of the DT_*_ELLIPSIS features....
View ArticleHow can I include/exclude specific memory blocks in user-mode crash dumps?
You can tweak the information included in crash dumps created by Windows Error Reporting. To request that Windows Error Reporting include a dump of another process if the calling process crashes, use...
View ArticleWhy doesn’t GetTextExtentPoint return the correct extent for strings...
A customer reported that the GetTextExtentPoint and GetTextExtentPoint32 functions do not return the correct extents for strings that contain tabs. The documentation does say that they do not...
View Article