ACC: How to Find the Windows and System PathsID: Q109733
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article describes how to use the GetWindowsDirectory() and
GetSystemDirectory() Windows API functions to return the Windows and
Windows System directory paths.
This article assumes that you are familiar with Access Basic and with
creating Microsoft Access applications using the programming tools provided
with Microsoft Access. For more information on Access Basic, please refer
to the "Introduction to Programming" manual in Microsoft Access version
1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access
Basic," in version 2.0.
The following example demonstrates how to use the GetWindowsDirectory()
and GetSystemDirectory() Windows API functions:
'**********************************
'Declarations section of the module
'**********************************
Option Compare Database
Option Explicit
Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpbuffer _
As String, ByVal nsize As Integer)
Declare Function GetSystemDirectory% Lib "Kernel" (ByVal lpbuffer _
As String, ByVal nsize As Integer)
'Returns the path to the Windows directory as a string.
Function GetWinDir () As String
Dim lpbuffer As String * 144
Dim Length%
Length% = GetWindowsDirectory(lpbuffer, Len(lpbuffer))
GetWinDir = Left(lpbuffer, Length%)
End Function
'Returns the path to the Windows System directory as a string.
Function GetSysDir () As String
Dim lpbuffer As String * 144
Dim Length%
Length% = GetSystemDirectory(lpbuffer, Len(lpbuffer))
GetSysDir = Left(lpbuffer, Length%)
End Function
Additional query words: path system windows api ab
Keywords : kbprg
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 1, 1999