Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I determine the system directory 1

Status
Not open for further replies.

wtstro

Programmer
Aug 1, 2002
15
US
I have an MS-Access app that I want to copy some .dll files to the system directory. How can I get the correct path for this directory without knowing what operating system the user has on their workstation?

[sadeyes]
 
Use the following code in a general module to create a function to return the System Directory :
Code:
Private Declare Function GetSystemDirectory Lib "kernel32" _
        Alias "GetSystemDirectoryA" ( _
        ByVal lpBuffer As String, _
        ByVal nSize As Long) As Long

Function SystemDir() As String
    Dim strSys As String, lRet As Long
    strSys = Space(255)
    lRet = GetSystemDirectory(strSys, 255)
    SystemDir = Left$(strSys, lRet)
End Function

=SystemDir() should then return the path.

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top