Bernard,
I was able to test this successfully on local machine, but when I used the same prg from another computer in network, it is showing messagebox "failed to authenticate", on logonuser() command line.
Following is what I did:
I tested with 2 computers in LAN under workgroup name "MSHOME".
computer names are "new" and "old"
On new computer, I created a directory temp under "e:\report" directory and placed a dbf in it.
I crated a new user named 'test'. My existing user name was 'deodhar'
On right click, security for temp sub folder, I removed all entries except "NEW\deodhar". To this user, I gave full rights.
Then I logged in to new using username "test".
On commnad, use e:\report\temp\hr.dbf, access was denied.
I used your code in a prg as:
IF LogonUser("deodhar","new","mrd140",LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, @nToken) = 0
The prg, in the following lines, was able to open th hr.dbf and browse.
Strangly, even if I used "MSHOME" in place of "new" in the above code line, I could use the prg successfully.
Now, I copied the same code to computer "old" (logged in as "administrator" on old)
I got the error message on "IF LogonUser" command line.
What error am I making?
thanks,
Vivek
> > I was looking for a similar solution for long.
> >
> > However, at some different forum, I read that this may not work in LAN. It will need a global name (domain).
> >
> > Could you please explain this aspect?
> >
> > Thanks,
> >
> > Vivek
> >
> >
> >
> >
> > Vivek
>
> Vivek
>
> This has now been moved to the FAQ section. You can read about it there.
>
> All LAN's need to belong to a Domain. That is something that is setup by your network engineer. Ij no domain, then you need at least a Workgroup so that security can be set.
>
> This is network stuff better explained by network experts.
>
> Google for more info on domains or workgroups.
>
> Bernard
>
> ** If you see someone without a smile, give em one of yours :) **
Vivek