August 25th, 2014

How do I read the "Double-click to open an item (single-click to select)" setting in Folder Options?

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.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.