Thank you Hugo! Remus solution worked for me!
Cheers,
Ali
>Ali,
>
>What I thought, probably for an ill executed test, was that if, WHILE impersonating, you launched a process like explorer, then the new process (Explorer) would receive the credentials of the impersonated user, but I tested again and it seems not to be true (Try creating a protected folder and create a table in it, and run the following code to test) (X is mapped as in the original message, you can replace the drive letter for \\server\share) (Oh, I just thought it might be SP2 implemented this that is why my old test gave me the wrong impression? who knows)
>
>
>close databases all
>
>lcPath = 'X:\PS\'
>lcTable = 'Protected'
>lcAdminUser = 'RAN02'
>
>try
> use (lcPath + lcTable)
> Messagebox('Table opened without using impersonation')
> use
>catch
> Messagebox('Unable to open table without using impersonation')
>endtry
>
>if Impersonate(lcAdminUser, Inputbox('Enter your password', 'Password'))
> try
> use (lcPath + lcTable)
> Messagebox('Table opened using impersonation')
> use
> catch
> Messagebox('Unable to open Table even using impersonation')
> endtry
>
> loShell = Createobject('Shell.Application')
> loShell.Explore(lcPath)
>
>* Or
>
> loSHell = Createobject('WSCript.Shell')
> loShell.Exec('Explorer ' + lcPath)
>endif
>
>EndImpersonate()
>
>
>Anyways, even if I was not wrong, it was more like a word of caution not to open this kind of interactive windows. As for where to store the password... there are ways, you can save it in an encrypted text file, in an encrypted registry entry etc. but I do not know where is the best place, as I said in my original message, we never got to use this, it was a test.
>
>Anatoly also found some other gotchas, so you might want to check
http://fox.wikis.com/wc.dll?Wiki~RunAsAnotherUser~VFP, and that reminds me I should correct what I wrote there