How can I invalidate the file system cache?

At least on Windows 7, it seems that attempting to open a volume handle without FILE_SHARE_WRITE sharing permissions causes the file system cache to be invalidated, even if the creation fails. Thus I made a program that simply calls CreateFile to this end. Download the program* from its Base64 version here: <!– Click “Run Snippet”, … Read more

How to set “Run this program as an administrator” programmatically

You can programmatically set the “Run this program as an administrator” flag (the option you find in the Compatibility tab of an EXE’s properties), by setting a simple registry key. You need to create a string value (REG_SZ) under one of these keys (if you want the setting to be per user or per machine, … Read more

As a programmer, what do I need to worry about when moving to 64-bit windows?

As far as I’m concerned, the single most important thing about porting C/C++ code to 64-bit Windows is to test your application with MEM_TOP_DOWN allocations enabled (AllocationPreference registry value) as described in 4-Gigabyte Tuning: To force allocations to allocate from higher addresses before lower addresses for testing purposes, specify MEM_TOP_DOWN when calling VirtualAlloc or set … Read more

Borderless Window Using Areo Snap, Shadow, Minimize Animation, and Shake

After using Spy++ to inspect Steam’s window (its window styles, how it replies to window messages) and trying to match everything it does, combined with the DWMAPI calls from this C# borderless window behavior, I believe I figured it out. To hide the window’s border, handle the WM_NCCALCSIZE message in your WindowProc: case WM_NCCALCSIZE: { … Read more