PDA

View Full Version : new Global Variable ?



John_Klassek
11-18-2003, 05:57 AM
I'm just wondering whether there is a Global Variable for "My Documents".

I entered the following:

Zip.Extract("Setup\\Pictures\\Pictures.zip", {"*.*"}, _MyDocuments "\\My Pictures\\", false, false, "", ZIP_OVERWRITE_NEVER, nil)

Of course, no such Global Variable yet exists. I then tried:

myDocs = Shell.GetFolder(SHF_MYDOCUMENTS);
Zip.Extract("Setup\\Pictures\\Pictures.zip", {"*.*"}, myDocs, "\\My Pictures\\", false, false, "", ZIP_OVERWRITE_NEVER, nil)

Still no progress, of course.

Any help here is appreciated.

Thanks.

John

John_Klassek
11-18-2003, 06:10 AM
I think this works, finally.

myDocs = Shell.GetFolder(SHF_MYDOCUMENTS);
Zip.Extract("Setup\\Pictures\\Pictures.zip", {"*.*"}, myDocs.."\\My Pictures\\", false, false, "", ZIP_OVERWRITE_NEVER, nil)

Of course, is there a better way? Would it be preferable to have a Global Variable such as _MyDocuments ?

Regards,

John

Worm
11-18-2003, 06:10 AM
I wrote a DLL a while back that would get the "Special Folders" on a system. The sample is a 4.x project, but you shold be able to see the DLL calls well enough to figure it out.

Download (http://www.warmuskerken.com/ams/specialfolders.zip)

Brett
11-18-2003, 06:15 AM
Of course, is there a better way? Would it be preferable to have a Global Variable such as _MyDocuments ?

The way that you are doing it is fine. In AMS50 we got away from automatically defining too many global variables. There are various reasons for this but one is that every veriable that you initialize takes time and introduces the possibility for errors. We are trying to make the API more robust for this and future products.