Need VB Help

Sharky Forums


Results 1 to 4 of 4

Thread: Need VB Help

  1. #1
    Expensive Sushi
    Join Date
    Oct 2000
    Posts
    17

    Question Need VB Help

    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

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    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).]

  3. #3
    Mako Shark dighn's Avatar
    Join Date
    Nov 2000
    Location
    Vancouver, BC Canada
    Posts
    3,171

    Post

    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
    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 vb

    a local copy of msdn rules

    ------------------
    Keep it brief
    .

  4. #4
    Expensive Sushi
    Join Date
    Oct 2000
    Posts
    17

    Smile

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •