CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    195

    get Directory Name

    I'm a total newcomer to API functions. From my Access application, I would like to find out in which directory the user is currently working. Any idea how I can do that?

    Thanks


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: get Directory Name


    'This may help: it is in a command code of a form in access.
    private Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectoryA" (byval nBufferLength as Long, byval lpBuffer as string) as Long
    private Function retThePath()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim sSave as string
    'create a buffer
    sSave = string(255, 0)
    'retrieve the current directory
    GetCurrentDirectory 255, sSave
    retThePath = sSave
    End Function

    private Sub Comando6_Click()
    on error GoTo Err_Comando6_Click
    Form.Caption = retThePath
    'you could also use:
    'Form.Caption = CurDir
    Exit_Comando6_Click:
    Exit Sub

    Err_Comando6_Click:
    MsgBox Err.Description
    resume Exit_Comando6_Click

    End Sub





    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured