July 5th, 2019

I set the OFN_NONETWORKBUTTON option in the OPENFILENAME structure, but it has no effect on the network item in the navigation pane

A customer set the OFN_NO­NETWORK­BUTTON option in the OPEN­FILE­NAME structure, but it stil shows the Network item in the navigation pane.

There are a number of flags in the OPEN­FILE­NAME structure which harken back to the old Windows 3.1-style dialog box. In Windows 3.1, the Open dialog had a button labeled Network that appeared next to the drives combo box. Clicking it let you map a new network drive. The OFN_NO­NETWORK­BUTTON flag hides that button.

But if you’re using the new Explorer-style Open dialog, there is no Network button to begin with, so there’s no button to hide.

While it’s true that there is a Network item in the navigation pane, that is not the thing that the OFN_NO­NETWORK­BUTTON flag controls. The purpose of the flag was not to hide the network; it was merely to hide the button that lets you map a new network drive. And since the Explorer-style dialog doesn’t have such a button in the first place, the flag is redundant.

There’s another flag left over from the Windows 3.1 dialog: OFN_HIDE­READ­ONLY. The original Windows 3.1 dialog had a separate check box called Read-only, but the Explorer style dialog doesn’t have that check box. Instead, the Open button is a split button, with options Open and Open as read-only. In this case, the Open dialog box was able to map the old flag to a corresponding feature in the new dialog.

 

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.

4 comments

Discussion is closed. Login to edit/delete existing comments.

  • David Walker

    It’s *convenient* to be able to map a network drive from these dialog boxes!

    • smf

      Can we also have a button that launces the calculator there? I might want to do some maths when opening a file.

      • W S

        Hardly a relevant comparison, the Calculator can be started from the start menu in seconds while mapping a drive could be annoying if UAC/RunAs has been used on the running app and the mapped drives are not the same as your main Explorer shell.

  • W S

    The split-button is a Vista thing, the Windows 95 style dialog also has a checkbox control.