Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're correct that Windows' Open File common dialogs show Internet Shortcuts along with folders. I have no idea why this behavior exists, but it's there- and it happens in Win32 (try Notepad to verify) as well as WinForms apps.</p> <p>There is a way to work around this, but warning: it's hacky! If you derive a custom file dialog class from the FileDialog class, you get access to a few protected events that you can use to customize every aspect of the FileDialog's operation. </p> <p>Dino Esposito wrote an MSDN Magazine article in November 2003 that shows how this technique works. This article is no longer on the MSDN site but you can get it on the wayback machine's archive here: <a href="http://web.archive.org/web/20150117123625/http://msdn.microsoft.com/en-us/magazine/cc300434.aspx" rel="nofollow noreferrer">http://web.archive.org/web/20150117123625/http://msdn.microsoft.com/en-us/magazine/cc300434.aspx</a>.</p> <p>What you'd probably have to do is to hook or subclass the WndProc of the file dialog, manually look through the file list control, identify entries that were shortcuts, and send Windows messages to the file list control to remove those items. Then you'd need to watch for refreshes of that list (e.g. from a directory change) and repeat the filtering operation. </p> <p>This would be a huge hack, but it's possible. </p> <p>If this is too much work or the hackiness is too much, I'd suggest just using the FileOk event to prevent users from selecting a shortcut by returning <code>Cancel=true</code> from your CancelEventHandler for the FileOk event.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload