Today's Little Program reports whether the Double-click to open an item (single-click to select) option is selected in the Folder Options dialog. A customer wanted to know how to do this, presumably so that their program would respect the setting and adjust its user interface to match.

#include <windows.h>
#include <shlobj.h>
#include <stdio.h>

BOOL IsDoubleClickToOpenEnabled()
{
 SHELLFLAGSTATE sfs;
 SHGetSettings(&sfs, SSF_DOUBLECLICKINWEBVIEW);
 return sfs.fDoubleClickInWebView;
}

int __cdecl main(int, char**)
{
 printf("Double-click is %s\n",
        IsDoubleClickToOpenEnabled() ? "enabled" : "disabled");
 return 0;
}

The flag and member name is kind of weird. The ability to single-click to open an item was introduced as part of the Windows Desktop Update which came with Internet Explorer 4. This update made Explorer more Web-like, with single-click to activate and underlines appearing on hover. (This was back in the day when making everything more Web-like was the new hotness.)

The internal name of this Explorer feature was WebView, and that name is reflected in the flag and structure.