Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get the user name that use the Application.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00562902
Message ID:
00562923
Views:
30
>hi,
>
>My application(Exe+Database) is On the Network.
>it is posible that i get all the users name or their computer names those who using my appliction on the network.
>
>regards,
>Mobeen.

There are a couple of ways. Easiest would be to use the WScript.Network object of the Windows Script Host.
oNet = CREATEOBJECT("WScript.Network")
? oNet.UserName
Now if the WSH isn't available...
DECLARE INTEGER WNetGetUser IN Win32API;
  STRING @lpszLocalName, STRING @lpszUserName,; 
  INTEGER @lpcchBuffer
LOCAL lcresult, lnpt, lnargs
* Call to the API
lcresult = SPACE(200)
= WNetGetUser(0, @lcresult, LEN(lcresult)) 
lnpt = AT(CHR(0), lcresult)
IF lnpt > 1
  lcresult = LEFT(lcresult, lnpt - 1)
ELSE
  lcresult = ""
ENDIF
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform