The Old New Thing

What is the difference between WM_DESTROY and WM_NCDESTROY?

There are two window messages closely-associated with window destruction, the WM_DESTROY message and the WM_NCDESTROY message. What's the difference? The difference is that the WM_DESTROY message is sent at the start of the window destruction sequence, whereas the WM_NCDESTROY message is sent at the end. This is an important distinction ...

FindFirstFile is not a SQL query

The function is not a SQL query. It's a very simple directory enumerator. There is a slightly fancier version called , but even that function doesn't add much at present beyond filtering for directories or devices. You don't get to pass it sort criteria like or "return the files/directories sorted smallest file first", or "return the ...

What’s the point of DeferWindowPos?

The purpose of the DeferWindowPos function is to move multiple child windows at one go. This reduces somewhat the amount of repainting that goes on when windows move around. Take that DC brush sample from a few months ago and make the following changes: HWND g_hwndChildren[2]; BOOL OnCreate(HWND hwnd, LPCREATESTRUCT lpcs) { const ...

Using script to query information from Internet Explorer windows

Some time ago, we used C++ to query information from the ShellWindows object and found it straightforward but cumbersome. This is rather clumsy from C++ because the ShellWindows object was designed for use by a scripting language like JScript or Visual Basic. Let's use one of the languages the ShellWindows object was designed for to ...

What’s the difference between My Documents and Application Data?

The most important difference between My Documents and Application Data is that My Documents is where users store their files, whereas Application Data is where programs store their files. In other words, if you put something in CSIDL_MYDOCUMENTS (My Documents), you should expect the user to be renaming it, moving it, deleting it, emailing ...