Results 1 to 3 of 3

Thread: Reading Computer Names

  1. #1

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Cool

    I am having trouble finding the computer name of my computers on my network with my program.
    I want to be able to capture the computer name of my other system when it runs a .exe on my server. I am new to the API scene so I hope someone can point me in the right direction.

    What other ways could it be done?
    I would appreciate any help.

  2. #2
    ricmitch_uk
    Guest
    So you want to log ppls use of exectuables on NT?
    I got this off this website somewhere:
    Logging use of executables in Windows

    This handy little tip can be used to log the use of .exe, .lnk, .pif, .bat, and .com files on your computer. All it needs is a little registry tinkering. Place this code in a module, and set the project startup object to 'Sub Main'

    Procedure

    Sub Main()
    If Command$ <> "" Then
    Open "c:\appsexelog.txt" For Append As #1
    Print #1, Command$ & " " & CStr(Now)
    Close #1
    Call Shell(Command$, vbNormalFocus)
    End If
    End
    End Sub
    Registry Changes

    The registry changes are:

    HKEY_CLASSES_ROOT\exefile\shell\open\command to: "C:\exewrap.exe" "%1" %*
    HKEY_CLASSES_ROOT\lnkfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
    HKEY_CLASSES_ROOT\piffileshell\open\command to: "C:\exewrap.exe" "%1" %*
    HKEY_CLASSES_ROOT\batfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
    HKEY_CLASSES_ROOT\com\file\shell\open\command to: "C:\exewrap.exe" "%1" %*

    What happens it that instead of running the program directly, Windows calls our program, which logs filename and time, and then calls the program.
    You can modify that code by adding the PC name and user name to the log file as well.

    For the API calls, check out www.vbapi.com or www.allapi.com They're really good for beginners.
    If you can find it, I also recommend you download a program called APIWork. It has a database of all the API functions you could possibly want.
    HTH

  3. #3

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Cool

    Thanks for the help and code.
    I will look there for code to capture the computer name. I already know how to record the username.

    Does anyone else know how to capture the computer name?
    I searched this site and all I get is code for the user name.

Posting Permissions

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



Click Here to Expand Forum to Full Width