Heenan, Lambert
Lambert.Heenan at chartisinsurance.com
Fri Aug 14 15:05:18 CDT 2009
I've read reports that Environ is considered insecure by later versions of Access/Office (because what it returns can be manipulated by intruders), but the API is trusted. Also some shops do not actually set the 'COMPUTERNAME" and/or "USERNAME" environment variables, so Environ will return nothing. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Reuben Cummings Sent: Friday, August 14, 2009 3:18 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Get Computer Name Is there an advantage to the API over the environ function? Reuben Cummings GFC, LLC 812.523.1017 > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, > Lambert > Sent: Friday, August 14, 2009 3:11 PM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] Get Computer Name > > > Use the API... > > > Private Declare Function apiGetComputerName Lib "kernel32" Alias _ > "GetComputerNameA" (ByVal lpBuffer As String, nSize As > Long) As Long > > > 'This code was originally written by Dev Ashish. > 'It is not to be altered or distributed, 'except as part of an > application. > 'You are free to use it in any application, 'provided the copyright > notice is left unchanged. > ' > 'Code courtesy of > 'Dev Ashish > Function fOSMachineName() As String > 'Returns the computername > Dim lngLen As Long, lngX As Long > Dim strCompName As String > lngLen = 16 > strCompName = String$(lngLen, 0) > lngX = apiGetComputerName(strCompName, lngLen) > If lngX <> 0 Then > fOSMachineName = left$(strCompName, lngLen) > Else > fOSMachineName = "" > End If > End Function > > '******************** Code End ************************** > > Lambert > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo > Sent: Friday, August 14, 2009 2:58 PM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] Get Computer Name > > Reuben, > > With A2003 running on vista Home Edition on PC running OS of x64, the > Environ("ComputerName") returns the computer name > > Max > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Reuben > Cummings > Sent: 14 August 2009 19:49 > To: AccessD > Subject: [AccessD] Get Computer Name > > I need to retrieve the computer name of the computer currently running > a function. > > Using A2k...will Environ("ComputerName") still work in Vista? > I don't have a Vista computer to test it. > > Thanks. > > Reuben Cummings > GFC, LLC > 812.523.1017 > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com