main logo
Subject: Re: Get location (full path) of Documents and Settings
Author: Paul Newton
Posted: 2006/09/29 13:33:51
 
View Entire Thread
New Search


Andrew Stirling wrote:
> Paul
> There is a FAQ at Tek-tips re this.
> http://www.tek-tips.com/faqs.cfm?fid=4264

Many thanks Andrew. This is/you are the clear winner !

>
> Andrew Stirling
> 01250 874580
> http://www.calcpay.co.uk
> HMRC Accredited UK payroll program
>
> Paul Newton wrote:
>> Ted
>>
>> Many thanks for your reply. Let me start at the end (a very, very
>> good place to start <g>).
>>
>> I am trying to print out the hierarchy of the windows Start Menu - so
>> I need the location of Documents and Settings and if the user's
>> Visual FoxPro My Documents directory is not in its default location
>> then your suggestion will not work - it works fine otherwise, so
>> thank you.
>>
>> Bearing in mind your response about assumptions I therefore also need
>> (in addition to a way of finding the location of Documents and
>> Settings) a way to get a list of (local) user names (who will/should
>> have folders under Documents and Settings)
>>
>> As an aside, while looking into this I see that several people (all
>> over the web) have asked how to print a treeview so I came up with
>> this (quick and dirty):
>>
>> SET PRINTER ON
>> If THISFORM.oTreeView.Nodes.Count > 0
>> * only do this if we have nodes in the treeview
>> For Each loNode In THISFORM.oTreeView.Nodes
>> lnLevel = 0
>> loTest = loNode.Parent
>> DO WHILE .T.
>> IF TYPE("loTest.Tag") = "C"
>> lnLevel = lnLevel+1
>> loTest = loTest.Parent
>> ELSE
>> EXIT
>> ENDIF
>> ENDDO
>> ? IIF(lnLevel =
>> 0,"",REPLICATE(CHR(9),lnLevel))+loNode.Text
>> loNode = .NULL. && Release the Reference to the
>> object.
>> loTest = .NULL.
>> ENDFOR
>> ENDIF
>> ? ""
>> SET PRINTER OFF
>> EJECT
>>
>> Cheers
>>
>>
>> Ted Roche wrote:
>>> On 9/29/06, Paul Newton <paul (at) foxpertise .D.OT com> wrote:
>>>>
>>>> How can I find the full path (including drive) for the location of the
>>>> "Documents and Settings" folder (Win2K, WinXP) ?
>>>>
>>>
>>> I'm sure there's a WinAPI call for it, but I'll bet this will work:
>>>
>>> ? SUBSTR(HOME(8), 1, AT("Settings\",HOME(8))+8)
>>>
>>>> Am I right in thinking that
>>>>
>>>> (i) this folder should always contain the folders "All Users" and
>>>> "Default User"
>>>>
>>>
>>> I'm pretty sure it's possible to set this on a user-by-user basis, and
>>> some may be mapped to networks or different drives. So, my home might
>>> be H:\users\troche and yours might be N:\users\pnewton
>>>
>>>> (ii) this folder must always contain at least one additional user
>>>> folder
>>>> (e.g. "Paul Newton")
>>>>
>>>>
>>>
>>> Sorry, don't think so.
>>>
>>>> Can I safely assume that ALL folders under "Documents and Settings"
>>>> will
>>>> be one of "All Users", "Default User", "User1" etc OR is it possible
>>>> that in some circumstances somebody might have added a folder (Some
>>>> folder name that is not a user name or "All Users" or "Default User")
>>>> just to s***w me up !
>>>>
>>>
>>> This is Windows. It's rarely safe to assume.
>>>
>>>> If that is the case I will need to find a way to get a list of
>>>> users who
>>>> should have folder entries under "Documents and Settings".
>>>>
>>>
>>> What is it that you are trying to accomplish?
>>>
>>
>>
>>
>>
[excessive quoting removed by server]


 
©2006 Paul Newton
<-- Prior Message New Search Next Message -->