No "W:" in TFolderDialog

Hi,

in folderdialog.pas there is in the Execute some lines I don't understand:
---
  if bi.ulFlags and bif_NewDialogStyle = bif_NewDialogStyle then
    bi.ulFlags := bi.ulFlags OR BIF_SHAREABLE;
---
in the MSDN it says: if you use "BIF_SHAREABLE" you have to use "bif_NewDialogStyle".
The use above is inverse.

Because of this lines I can't choose a network-folder like "W:" (can't translate "Laufwerksbuchstabe" in english, sorry, I hope you understand what I mean).

Is there a chance that this will be changed, or is there a reason for this?
Also, there is no option for use "BIF_SHAREABLE", maybe because of this problem!?

Greetings from Papenburg, Germany
 Hillebrandt

The code does exactly that, check for bif_NewDialogStyle and only then add BIF_SHAREABLE.
I have retested this here and it does show the network drives with default settings.

Hi Mr. Fierens,


I'm confused!?

I say: >>if you use "BIF_SHAREABLE" you have to use "bif_NewDialogStyle"<<
you say: >>The code does exactly that ... if you use "bif_NewDialogStyle" you have to use "BIF_SHAREABLE"<<
... that's exactly the opposite!?

In your words, I'm sure (I've read MSDN again), it to check for BIF_SHAREABLE and if so add bif_NewDialogStyle ... but you can use bif_NewDialogStyle alone.

I'm curious that I have to "deactivate" BIF_SHAREABLE, because I think, like you, that it must be
active to see network drives and not inverse.

Idea to solve this problem:
Add BIF_SHAREABLE to the checkable options, activate it for default,
but change the
---
  if bi.ulFlags and bif_NewDialogStyle = bif_NewDialogStyle then
    bi.ulFlags := bi.ulFlags OR BIF_SHAREABLE;
---
to
---
  if bi.ulFlags and BIF_SHAREABLE = BIF_SHAREABLE then
    bi.ulFlags := bi.ulFlags OR bif_NewDialogStyle;
---
this way it will work anyway for both of us.

I hope you can add this option and agree with the correction.


Greetings from Papenburg, Germany
 Hillebrandt

This is the Microsoft documentation:

https://msdn.microsoft.com/en-us/library/ms538017.aspx

BIF_SHAREABLE (0x00008000)

0x00008000. Version 5.0. The browse dialog box can display sharable resources on remote systems. This is intended for applications that want to expose remote shares on a local system. The BIF_NEWDIALOGSTYLE flag must also be set.


So, our code:

  if bi.ulFlags and bif_NewDialogStyle = bif_NewDialogStyle then

is  the requirement for setting BIF_SHAREABLE, i.e. exactly what Microsoft writes. This means that when the user opts for fdoNewStyleDialog, it will use the new feature to show mapped network drives.

The only extra thing that we can do is not always add BIF_SHAREABLE when a new style dialog is chosen, but that would change the code to something like:

  if bi.ulFlags and bif_NewDialogStyle = bif_NewDialogStyle then
  begin
    if (fdoShareable in FOptions) then
      bi.ulFlags := bi.ulFlags OR BIF_SHAREABLE;
  end;

and that is something we could do a small improvement in case you DO NOT want shared drives. But as your original question was that you don't see the shared drives while you wanted them, this will not change anything for you.

Ah, I think I understand more of the way you think!

I think you missed out the lines above the handling for the "exception"-line:
---
  for O  := Low(O) to High(O) do
  begin
    if O in FOptions then
      bi.ulFlags := bi.ulFlags or FolderOptions[O];
  end;
---
This is, why BIF_SHAREABLE would be set before that, if you add this to the options.
And so
---
  if bi.ulFlags and bif_NewDialogStyle = bif_NewDialogStyle then
  begin
    if (fdoShareable in FOptions) then
      bi.ulFlags := bi.ulFlags OR BIF_SHAREABLE;
  end;
---
whould not work. But if you vary the view of this, not say "if newstyle is set you can set shareable" but say "if shareable is set you have to set newstyle", than you can stay in a very compact code.
This way I can use "newstyle" without "shareable", which is allowed by the MSDN-documentation.

To let all things for all the others "as it is", you have to set shareable active for default, like you do for newstyle.

My problem, that using shareable leads to the fact that network-drives disappear (I found out, exactly after the first time, so the first time I have network-drives, if you want to try this again), should not be so importent.

I hope I have wiped away some problems in understanding each other.
Sorry for my english anyway.

Greetings from Papenburg, Germany
 Hillebrandt

I did not copy the entire updated source, yes, of course, in the update we created

1) the shareable flag is enabled by default
2) we prevent that it is set when newdialog style is not chosen

This improvement will be in the next release.

Ok, thanks, this would help.

Greetings