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

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 Article


Why 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 Article


What 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 Article

Why 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 Article

Image may be NSFW.
Clik here to view.

Why 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 Article


How 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 Article

What does the thread parameter to Set­Windows­Hook­Ex actually mean?

The Set­Windows­Hook­Ex 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 Article

Considering 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 Article


Can 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 Article


The 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 Article

Generating 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 Article

All 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 Article

Practical 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 Article


Can 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 Get­Short­File­Name to get the...

View Article

How can I use WS_CLIP­CHILDREN 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_CLIP­CHILDREN style to ensure that the contents appeared on the screen; otherwise, the parent dialog...

View Article


When I call Crypt­Protect­Data with the same parameters, why aren’t the...

If you call Crypt­Protect­Data 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 Article

Image may be NSFW.
Clik here to view.

The 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 Article


Notes on DrawText and tab stops

The Draw­Text function will recognize tab characters if you ask for DT_EXPAND­TABS. And then things get weird. If you ask for DT_EXPAND­TABS, then you cannot ask for any of the DT_*_ELLIPSIS features....

View Article

How 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 Article

Why doesn’t GetTextExtentPoint return the correct extent for strings...

A customer reported that the Get­Text­Extent­Point and Get­Text­Extent­Point32 functions do not return the correct extents for strings that contain tabs. The documentation does say that they do not...

View Article
Browsing all 3085 articles
Browse latest View live


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