Hi:
Does anybody know how can I get a user name of currently logged account in Win2K?
Also I want to delete file: index.dat in the cookies folder. Even though I changed its permission value to normal, I still can not delete it.
Thanks
Lia
Printable View
Hi:
Does anybody know how can I get a user name of currently logged account in Win2K?
Also I want to delete file: index.dat in the cookies folder. Even though I changed its permission value to normal, I still can not delete it.
Thanks
Lia
Hmmm, I've never programmed in VB myself, but one piece of advice I can offer is this.
All I know is, in a batch file, you can access the environment variable "USERPROFILE", which echo's out the system path to the Current User's profile.
For instance, you can write a batch file with only one line, which says:
@echo %USERPROFILE%
Which for me, currently prints out:
"D:\Documents and Settings\asharp"
That last folder name is your username. You can grab that value and do what you will with it. I'm positive there's a better way to go about finding out the Current User, but that's all that comes to mind right now.
[This message has been edited by Grizzly (edited September 27, 2001).]
yOu WilL haVe to Make a WINAPI fUnCtION call called GetUserName(), this is part of something called "System information fucntions". look it up on MSDN. you know the procedures for calling functions in DLLs in VB right? i dont remember clearly because i haven't programmed in vb for a long time. anyway try to find it in the winapi viewer in vbQuote:
Originally posted by Lia:
Hi:
Does anybody know how can I get a user name of currently logged account in Win2K?
Also I want to delete file: index.dat in the cookies folder. Even though I changed its permission value to normal, I still can not delete it.
Thanks
Lia
a local copy of msdn rules
------------------
Keep it brief
Thanks guys. I found it last night:
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Lia