barrytraver
Programmer
Windows ME has apparently introduced some strange behavior for the Open dialog box control:
(1) CommonDialog1.InitDir apparently can't be used to set the directory shown except perhaps for the _very first time_ the program is run. (After that the Open dialog box seems to ignore whatever value
CommonDialog1.InitDir is set to.)
(2) In addition to apparently ignoring CommonDialog1.InitDir for later calls, a second call of the Open dialog box after a _single file_ has been selected returns to the _same_ directory previously shown (that's
normal, expected behavior) BUT a second call of the Open dialog box after _multiple files_ have been selected returns not to the directory previously shown but to its _parent_ directory!
To confirm the second point, just put a command button and a common dialog control on a form, leaving the default names,and use the following code:
Private Sub Command1_Click()
CommonDialog1.CancelError = True
CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer
On Error GoTo CDCancel
CommonDialog1.InitDir = "C:\WINDOWS\SYSTEM\"
Do
CommonDialog1.ShowOpen
Loop
CDCancel:
End
End Sub
Try it with Windows ME, and I think you'll find that the same thing happens for you. If you choose one file in C:\WINDOWS\SYSTEM, for example, the next time the Open dialog box is displayed, it is still set to C:\WINDOWS\SYSTEM. Select two files in C:\WINDOWS\SYSTEM, however, and the next time the Open dialog box is shown, it is set to C:\WINDOWS (not C:\WINDOWS\SYSTEM).
Yes, I've tried resetting the value of CommonDialog1.InitDir within the DO loop (and, yes, I've tested to make sure that the value or CommonDIalog1.InitDir was indeed being changed, and it was), BUT (as I said before) it seems that -- with Windows ME, at least -- CommonDialog1.InitDir only seems to apply to the _very first time_ that the Open dialog box is called when the program is run.
Anyone have any comments on this (or any workarounds)? Thanks in advance for your help.
Barry
P.S. I'm using the professional edition of VB 6.
(1) CommonDialog1.InitDir apparently can't be used to set the directory shown except perhaps for the _very first time_ the program is run. (After that the Open dialog box seems to ignore whatever value
CommonDialog1.InitDir is set to.)
(2) In addition to apparently ignoring CommonDialog1.InitDir for later calls, a second call of the Open dialog box after a _single file_ has been selected returns to the _same_ directory previously shown (that's
normal, expected behavior) BUT a second call of the Open dialog box after _multiple files_ have been selected returns not to the directory previously shown but to its _parent_ directory!
To confirm the second point, just put a command button and a common dialog control on a form, leaving the default names,and use the following code:
Private Sub Command1_Click()
CommonDialog1.CancelError = True
CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer
On Error GoTo CDCancel
CommonDialog1.InitDir = "C:\WINDOWS\SYSTEM\"
Do
CommonDialog1.ShowOpen
Loop
CDCancel:
End
End Sub
Try it with Windows ME, and I think you'll find that the same thing happens for you. If you choose one file in C:\WINDOWS\SYSTEM, for example, the next time the Open dialog box is displayed, it is still set to C:\WINDOWS\SYSTEM. Select two files in C:\WINDOWS\SYSTEM, however, and the next time the Open dialog box is shown, it is set to C:\WINDOWS (not C:\WINDOWS\SYSTEM).
Yes, I've tried resetting the value of CommonDialog1.InitDir within the DO loop (and, yes, I've tested to make sure that the value or CommonDIalog1.InitDir was indeed being changed, and it was), BUT (as I said before) it seems that -- with Windows ME, at least -- CommonDialog1.InitDir only seems to apply to the _very first time_ that the Open dialog box is called when the program is run.
Anyone have any comments on this (or any workarounds)? Thanks in advance for your help.
Barry
P.S. I'm using the professional edition of VB 6.