How do I prevent my registered hotkey from firing repeatedly due to auto-repeat?
You can register a global hotkey with the RegisterHotKey function, but one problem many people have is that if the user presses and holds the hotkey sequence, the hotkey will be invoked as fast as...
View ArticleHow do I preserve the user’s notification icon preferences for my program...
When a program creates a notification icon, the user can set preferences for that icon: Show icon and notifications, Hide icon and notifications, and Only show notifications. When you update the...
View ArticleShould I name my file mapping after the file it was created from?
Many times a customer creates a file mapping object and assigns it a name that matches the name of the file it was created from. Mind you, there needs to be some fiddling with the name because...
View ArticleWhy does upgrading my project to Unicode cause Visual Studio to use a...
A customer was upgrading a program from Visual Studio 2008 to Visual Studio 2017. As part of the upgrade, they also decided to recompile it as a Unicode program rather than an ANSI program. And they...
View ArticleHow can I detect that a shell item refers to a virtual folder, or to a file...
Shell items have a bunch of attributes. For example, SFGAO_FOLDER means that the item is a folder, and it will show up in the navigation pane as a folder. Since it's a folder, you can bind to it and...
View ArticleWhat are the dire consequences of accessing the fields of __m128i directly?
The MSDN documentation for __m128i says You should not access the __m128i fields directly. What are the dire consequences of accessing the fields directly? The first consequence is portability: The...
View ArticleWhy are my notification icon customizations lost aftter six months of disuse?
A customer had a notification icon that was used only once every few months. They found that even though the user configured the icon to appear on the taskbar, if six months went by without the icon...
View ArticleWhy did Windows 95 store image list bitmaps four-across instead of as a...
We learned some time ago that bitmap strips should be stored vertically in order to improve data locality. If you dig back into your dusty archives, you might discover that Windows 95...
View ArticleWas there a problem with Windows 95-era programs relying on undocumented...
Tihiy noted that back in the Windows 95 days, there was a lot of undocumented stuff lying around in places that are formally undefined. For example, the return value of IsWindow is formally zero or...
View ArticleHow can I control which parts of the shell namespace the INamespaceWalk::Walk...
The INamespaceWalk::Walk method initiates a depth-first traversal of the shell namespace, subject to constraints controlled by the various parameters (such as maximum search depth). If you pass an...
View ArticleHow can I cancel the INamespaceWalk::Walk operation?
We saw that you can stop a INamespaceWalk::Walk operation by returning a COM error code from the EnterFolder or FoundItem callback. So let's do that in order to add a timeout to the namespace walk...
View ArticleCancelling the INamespaceWalk::Walk operation a little faster
We saw last time that you can stop a INamespaceWalk::Walk operation by returning a COM error code from the EnterFolder or FoundItem callback. However, that may not be fast enough. I noted some time...
View ArticleOn memory allocations larger than 64KB on 16-bit Windows
Allocating memory blocks larger than 64KB was tricky in 16-bit Windows because the nature of 16-bit segment:offset addressing meant that you could access the memory only 64KB at a time. Global memory...
View ArticleMicrospeak: FCIB
FCIB (pronounced either by spelling it out F-C-I-B or as a sort-of acronym eff-sib) stands for "foreign checked-in binary". It refers to content checked into a project as binary output, rather than as...
View ArticleWhat happens if you simply return from the thread callback passed to...
Medinoc asks, "What happens when one simply returns from the thread callback? I'd suspect the code gluing between _beginthread() and its callback calls _endthread() upon return, while the code between...
View ArticleWhy is there no way to add a permission to a page with VirtualProtect instead...
The VirtualProtect function lets you change the protection of a page, but all it can do is replace the current protections with the protections you specify, returning the old protections. There is no...
View ArticleThe wrong way of benchmarking the most efficient integer comparison function
On StackOverflow, there's a question about the most efficient way to compare two integers and produce a result suitable for a comparison function, where a negative value means that the first value is...
View ArticleHow can I find the installation directory for my UWP application?
After you've installed a UWP application, you may want to know where it got installed to. Maybe there's a deployment bug that you're trying to resolve. Maybe it's just because you're curious....
View ArticleThe sad implementation history of COM component categories and why it means...
COM component categories let a COM object registration declare what kind of object it implements. Programs that want to offer a list of "all objects which can do X" can ask the COM component category...
View ArticleWhat is the documentation for SetParent trying to tell me about synchronizing...
The documentation for the SetParent function says When you change the parent of a window, you should synchronize the UISTATE of both windows. For more information, see WM_CHANGEUISTATE and...
View Article