lcOldDir = SYS(2003)
SET DEFAULT TO "c:\My Documents"
? GETFILE() && Opens in My Documents
SET DEFAULT TO "&lcOldDir"
? GETFILE() && opens in previous folder
The problem in using c:\my documents
is that this need not be that special folder. For example XP keeps in a different place.
I would suggest Mike Gagnons code.. and allow users to browse to special folders as well.
***********************************
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT olecontrol1 AS olecontrol WITH ;
Top = 24, ;
Left = 48, ;
Height = 169, ;
Width = 241, ;
Name = "Olecontrol1" ,;
OleClass = "Shell.Explorer.2"
ADD OBJECT command1 AS commandbutton WITH ;
AutoSize = .T., ;
Top = 216, ;
Left = 120, ;
Height = 27, ;
Width = 114, ;
Caption = "Get folder content", ;
Name = "Command1"
PROCEDURE Init
this.olecontrol1.oBJECT.Navigate2("c:\")
ENDPROC
PROCEDURE command1.Click
LOCAL cDir
cDir = GETDIR('','','',2)
thisform.olecontrol1.navigate2(cDir)
ENDPROC
ENDDEFINE
** - Mike Gagnon
The problem in using c:\my documents
is that this need not be that special folder. For example XP keeps in a different place.
So, I'll amend my code to take that into account:
lcOldDir = SYS(2003)
oWsh = CREATEOBJECT("wscript.shell")
lcMyDocs = oWsh.SpecialFolders("MyDocuments")
&& Note no space in MyDocuments
SET DEFAULT TO "&lcMyDocs"
? GETFILE() && Opens in My Documents
SET DEFAULT TO "&lcOldDir"
? GETFILE() && opens in previous folder
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.