[AccessD] System Root

Francisco H Tapia my.lists at verizon.net
Mon Aug 4 17:19:14 CDT 2003


Don't remember where I got this but it works well, probably DevAshish' site


'******************** Code Start **************************
Private Const MAX_PATH As Integer = 255
Private Declare Function apiGetSystemDirectory& Lib "kernel32" _
        Alias "GetSystemDirectoryA" _
        (ByVal lpBuffer As String, ByVal nSize As Long)

Private Declare Function apiGetWindowsDirectory& Lib "kernel32" _
        Alias "GetWindowsDirectoryA" _
        (ByVal lpBuffer As String, ByVal nSize As Long)

Private Declare Function apiGetTempDir Lib "kernel32" _
        Alias "GetTempPathA" (ByVal nBufferLength As Long, _
        ByVal lpBuffer As String) As Long
Function fReturnDir(ByVal strDir As String)
'Returns Requested folder, compiled the original functions to 1 function
with a string parameter
    Dim lngx As Long
    Dim strDirectory As String
    strDirectory = strDir

    strDir = String$(MAX_PATH, 0)
    Select Case strDirectory
        Case "Temp"
            lngx = apiGetTempDir(MAX_PATH, strDir)
            If lngx <> 0 Then
                fReturnDir = Left$(strDir, lngx)
            Else
                fReturnDir = ""
            End If
        Case "System"
                lngx = apiGetSystemDirectory(strDir, MAX_PATH)
                If lngx <> 0 Then
                    fReturnDir = Left$(strDir, lngx)
                Else
                    fReturnDir = ""
                End If
        Case "Windows"
                lngx = apiGetWindowsDirectory(strDir, MAX_PATH)
                If lngx <> 0 Then
                    fReturnDir = Left$(strDir, lngx)
                Else
                    fReturnDir = ""
                End If
        Case Else
            fReturnDir = "Invalid Parameter. Valid Types: Temp; System;
Windows"
    End Select
End Function



-Francisco
http://rcm.netfirms.com

On Monday, August 04, 2003 3:03 PM [GMT-8],
Erwin Craps <Erwin.Craps at ithelps.be> wrote:

: Did you tried "cmd %systemroot% etc"?
: You should be able to get the path from the environment (Set in dos)
: I'm sure there are some API calls to get this to.
:
:
: -----Original Message-----
: From: Stephen R. Zayko [mailto:szayko at secor.com]
: Sent: Monday, August 04, 2003 11:50 PM
: To: 'Access Developers discussion and problem solving'
: Subject: [AccessD] System Root
:
:
: Group:
:
: How do I determine if the system root is C:\Windows, C:\Winnt, or
: something else in VBA?  I would like to call a program in
: %SystemRoot%\System32 from a shell function but
:
: intX = Shell("%SystemRoot%\system32\calc.exe",1)
:
: does not work.  However, one of these will work if it is calling the
: correct root directory name: intX =
: Shell("C:\Windows\system32\calc.exe",1) ' For Windows OS intX =
: Shell("C:\Winnt\system32\calc.exe",1) ' For NT OS
:
: Thanks in Advance,
:
: Stephen R. Zayko, P.E.
:
: SECOR International Inc.
: 2321 Club Meridian Drive, Ste E
: Okemos, MI 48864
:
: (p) (517) 349-9499 ex24
: (f) (517) 349-6863
: (m) (517) 204-5136
:
: szayko at secor.com
: www.secor.com
:
: -----Original Message-----
: From: Mike and Doris Manning [mailto:mikedorism at ntelos.net]
: Sent: Tuesday, April 08, 2003 02:47 PM
: To: szayko at secor.com
: Subject: RE: [AccessD] Runtime Driver
:
: Here you go... Function CheckConnection is what you will need to look
: at. It uses to constants that are set up at the top of the module.
:
: Doris Manning
: Database Administrator
: Hargrove Inc.
: www.hargroveinc.com
:
:
: -----Original Message-----
: From: Stephen R. Zayko [mailto:szayko at secor.com]
: Sent: Tuesday, April 08, 2003 02:36 PM
: To: mikedorism at ntelos.net
: Subject: FW: [AccessD] Runtime Driver
:
:
: Doris
:
: Thanks for the offer.  If you could e-mail it to me at this address I
: would be very grateful.  Also thanks for putting the 'mail me offline'
: remark. Those tend to quell the 'me too's.  I think that this will be
: just what I need.  I will post to the list if this works.
:
: Thanks
:
: -Z
:
: Stephen R. Zayko
:
: SECOR International Inc.
: 2321 Club meridian Drive Ste. E
: Okemos MI, 48864
:
: 517 349 9499 ph
: 517 349 6863 fx
:
: szayko at secor.com <mailto:szayko at secor.com>
: www.secorlansing.com <http://www.secorlansing.com>
:
:
:
: -----Original Message-----
: From: accessd-bounces at databaseadvisors.com
: [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mike and
: Doris Manning
: Sent: Tuesday, April 08, 2003 12:32 PM
: To: accessd at databaseadvisors.com
: Subject: RE: [AccessD] Runtime Driver
:
:
: I've got code that checks for a specified SQL Server System DSN and
: creates it if it doesn't exist.  You should be able to modify it to
: work with MySQL. Email me offline if you want it.
:
: Doris Manning
: Database Administrator
: Hargrove Inc.
: www.hargroveinc.com
:
: -----Original Message-----
: From: accessd-bounces at databaseadvisors.com
: [mailto:accessd-bounces at databaseadvisors.com]
: Sent: Tuesday, April 08, 2003 11:41 AM
: To: AccessD at databaseadvisors.com
: Subject: [AccessD] Runtime Driver
:
:
: Group:
:
: Is it possible to include the drivers needed for a runtime solution?
: I have an A2K database which I would like to package as a runtime.
: It is an A2K FE with a MySQL BE accessed via ODBC through the web.
: Trouble with the distribution is that people must install the MySQL
: ODBC driver, and then create/link to the machine data source of the
: MySQL database (I think I said that right).
:
: What I would like to do is this...
:
: Create the runtime with the drivers and the source database info. Then
: when a user unpacks/installs the runtime,
: A: The MYSQL driver installs on that machine and
: B: The ODBC data source is created with all the needed info.
:
: A looks pretty simple to do.  You just include that in the files to be
: included during the packaging of the app. B however, I am not too sure
: about.  Can I do this through code?  Has anyone else done this before?
:
: thanks in advance.
:
: -Z
:
: Stephen R. Zayko
:
: SECOR International Inc.
: 2321 Club meridian Drive Ste. E
: Okemos MI, 48864
:
: 517 349 9499 ph
: 517 349 6863 fx
:
: szayko at secor.com <mailto:szayko at secor.com>
: www.secorlansing.com <http://www.secorlansing.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




More information about the AccessD mailing list