Getting current machine name 
Author Message
 Getting current machine name

we all know that you can get the current user from the CurrentUser()
function, but how do we get the current machine name.  I think the answer
lies not in Access 7.0 itself but somewhere within Win95.

Any help greatly appreciated




Sat, 11 Mar 2000 03:00:00 GMT  
 Getting current machine name

Hugh,
I posted this few days ago here. I repost it for your benefit. BTW you are
right.
Use a call to Windows API with kernel32.dll (only Windows 95, for the
3.xx ask me)
Cut and paste the following lines to a module in the mdb. Test in the debug
windows with:
? api_GetComputerName()

-------------------------------------------------------
riccardo romei

http://www.global.village.it/~rromei
REMOVE ANTISPAM to reply
RIMUOVI ANTISPAM per replicare

Code to paste-----------------------------------------
Option Compare Database
Option Explicit

Declare Function rr_GetComputerName Lib "kernel32" Alias "GetComputerNameA"
(ByVal lpbuffer As String, nSize As Long) As Long

Function api_GetComputerName() As Variant

   Dim strComputerName As String
   Dim lngLength As Long
   Dim lngResult As Long

   '-- Set up buffer.
   strComputerName = String$(255, 0)
   lngLength = 255

   '-- Make the call.
   lngResult = rr_GetComputerName(strComputerName, lngLength)

   '-- Clean up and assign the value.
   api_GetComputerName = Left(strComputerName, InStr(1, strComputerName,
Chr(0)) - 1)

End Function



Quote:
> we all know that you can get the current user from the CurrentUser()
> function, but how do we get the current machine name.  I think the answer
> lies not in Access 7.0 itself but somewhere within Win95.

> Any help greatly appreciated





Sat, 11 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting a machine's MAC address given a NETBIOS machine name or IP address

2. Getting Machine Name/Login Name

3. Getting IP address of current machine with VB5

4. Getting IP address of current machine with VB5

5. Getting IP address of current machine with VB5

6. Getting IP address of current machine with VB5

7. How to find current computer/machine name?

8. Retrieve name of current sub/function and name of current module

9. Getting client side machine's name.

10. Getting A List Of Machine Names On A LAN

11. Getting name of machine connected to a shared folder

12. Getting Network Machine Names Through VB4

 

 
Powered by phpBB® Forum Software