[AccessD] Get Computer Name

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Mon Aug 17 08:28:33 CDT 2009


'fraid not. Access only has GetSetting and SaveSetting, both of which use just that one branch of the registry tree

(HKCU\Software\VB and VBA Program Settings, and the per user locations HKUSERS\{USER GUID}\Software\VB and VBA Program Settings)

This does not allow you to read anywhere else in the registry. That is why you need yet another API, as I mentioned on Friday.

For the complete skinny on using the whole registry take a peek here...

http://oreilly.com/pub/a/windows/2004/06/15/VB_Registry_Keys.html


Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Saturday, August 15, 2009 6:34 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Get Computer Name

Stuart:
I cannot find it right now, but I did come across this in some of my ancient code and it seems to work (slightly changed for sending here).  There is also a GetAllSettings.

I may be thinking of this.  In which case, when do the Application Installation, set the Computer Name and then you can always check to see if it has changed each time you boot.

I will continue looking, if I find it I will post it.

Max


Function xxxxx()
'GetSetting Function Example
'This example first uses the SaveSetting statement to make entries in the Windows registry '(or .ini file on 16-bit Windows platforms) for the application specified as appname, 'and then uses the GetSetting function to display one of the settings.
'Because the default argument is specified, some value is guaranteed to be returned.
'Note that section names can't be retrieved with GetSetting. Finally, the DeleteSetting statement 'removes all the application's entries.

' Variant to hold 2-dimensional array returned by GetSetting.
Dim MySettings As Variant
' Place some settings in the registry.
SaveSetting "Max's Application", "Startup", "Top", 75 SaveSetting "Max's Application", "Startup", "Left", 50 SaveSetting "Max's Application", "Platform", "ComputerName",
Environ("Computername") '"Left", 50

Debug.Print GetSetting(appname:="Max's Application", Section:="Platform", key:="ComputerName", Default:="NotHeld")

' The registry will hold these settings.
' HKEY_USERS\S-1-5-21-2317311743-3275204689-2861515661-1000\Software\VB and VBA Program Settings\Max's Application\Platform ' HKEY_USERS\S-1-5-21-2317311743-3275204689-2861515661-1000\Software\VB and VBA Program Settings\Max's Application\Startup

DeleteSetting "Max's Application", "Startup"
DeleteSetting "Max's Application", "Platform"

End Function

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list