Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using GetObject
Message
From
06/11/2014 09:25:48
 
 
To
05/11/2014 11:40:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01610536
Message ID:
01610581
Views:
52
Thanks Thomas. I have hacked together a solution which is much faster than using the GetObject() option which seems to pause for a few seconds before completing. Basically what I do is this:

1) Get the user's login name (using SYS(0) )
2) Run NET USER in a batch file with the user's login name and output the contents into a temporary text file
3) Read in the text file and extract the information required
4) Remove the temporary batch file and the temporary file

The actual command run in the batch file is then:
net user user_login_name  >  output_file.txt
The whole thing runs in under a second so is very quick and the command window is hidden so creates no screen flicker. The 2nd and 3rd lines in the subsequent output file give the user's login account full name and description as desired. The remainder of the file contains various other info related to the user's login account.

I don't know if WinDev has functions for this built-in, it is just so enormous and one doesn't always know where to look but the above works perfectly. I sent PC Soft an email asking if there is a built-in function and will let you know the result.




>I think it is the user of the active directory services, which also has an object interface called User
>
>>
>>
>>
>>TUSER_NAME = PADR( ALLTRIM( SUBSTR( SYS(0), AT( "#", SYS(0) ) + 1 ) ), 50 )
>>
>>TOBJ_Windows_User = GETOBJECT( "WinNT://" + Getenv("USERDOMAIN") + "/" + ALLTRIM( m.TUSER_NAME ) + ",User" )
>>
>>? TOBJ_Windows_User.FullName 
>>? TOBJ_Windows_User.Description
>>
>>
>>
>>What is that GETOBJECT() actually doing? I need to create this in a WinDev application and I cant find the functions I need. They might be there but I could be looking in the wrong places so perhaps understanding GETOBJECT() will show me a way.
>>
>>Or is there another way to get this info perhaps using Windows API ?
>>
>>TIA
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform