CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Location
    Israel
    Posts
    94

    Current Directory

    Hello,

    How do I get the current working directory of the exe file. Like when I lunch the open dialog box it enters the current directory, I need to know what it is...

    Thank you all, you made my life easier for so many times.
    FatMan


  2. #2
    Join Date
    Mar 2001
    Posts
    3

    Re: Current Directory

    You could use App.Path which gives you the directory which the exe is in afaik.


  3. #3
    Join Date
    Jul 2000
    Location
    The Netherlands
    Posts
    26

    Re: Current Directory

    The GetCurrentDirectory API function returns the current working cirectory of the currens process (application). I think that's what you need.
    'in a module
    public Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectory" (byval nBufferLength as Long, byval lpBuffer as string) as Long

    'in your code
    Dim sTemp as string
    sTemp = Space$(255)
    GetCurrentDirectory(255,sTemp)
    sTemp = Left(sTemp, InStr(1,sTemp,vbNullChar)-1)



    I hope that answers your question


  4. #4
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Current Directory

    The VB CurDir function gives the current directory. ChDir changes the current directory.




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