RobDog888
Apr 20th, 2001, 06:59 PM
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. :confused:
ricmitch_uk
Apr 21st, 2001, 11:51 AM
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 (http://www.vbapi.com) or www.allapi.com (http://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
RobDog888
Apr 22nd, 2001, 01:45 PM
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. :D