Announcement

Collapse
No announcement yet.

GetOpenFilename

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GetOpenFilename

    GetOpenFilename starts with the parameter "ofn.InitialDir=CURDIR$" in the current folder.

    How can GetOpenFilename open the workplace?

    (The function "SHBrowseForFolder" starts also per default at the workplace.)

  • #2
    Set ofn.InitialDir to the address of any fixed length string that contains a valid directory path, and that will be where the Open File Dialog Box opens...

    Local szBuffer As Asciiz*256

    szBuffer="C:\Documents And Settings\User\MyDocuments"

    ofn.InitialDir=Varptr(szBuffer)

    etc.

    There are equates for the length of the buffer that can be used such as %MAX_PATH. Here is a tutorial on the open file dialog box...

    http://www.jose.it-berater.org/smffo...p?topic=1267.0
    Last edited by Fred Harris; 13 Apr 2008, 02:56 PM.
    Fred
    "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

    Comment


    • #3
      How can GetOpenFilename open the workplace?
      Bernard, can you expand on what you meant by "WorkPlace"? (Do you mean the current working folder? and NOT what M$ thinks is "CurDir"???) sort of thing.??
      Engineer's Motto: If it aint broke take it apart and fix it

      "If at 1st you don't succeed... call it version 1.0"

      "Half of Programming is coding"....."The other 90% is DEBUGGING"

      "Document my code????" .... "WHYYY??? do you think they call it CODE? "

      Comment


      • #4
        I wasn't sure what Bernhard meant either with 'WorkPlace', but I decided to take a stab at a generic answer.
        Fred
        "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

        Comment


        • #5
          WRONG
          Code:
          szBuffer="C:\Documents And Settings\User\MyDocuments"
          RIGHT:
          Code:
          LOCAL szBuffer AS ASCIIZ * %MAX_PATH, iret AS LONG
          
          iRet = getSpecialFolderLocation BYVAL %NULL, %CSIDL_PERSONAL, BYVAL %NULL, %SHGFP_TYPE_CURRENT, szBuffer
          
          IF iRet = %S_OK THEN
            szBUffer contains path for this user's "My Documents" folder
          ELSE
             error handler...
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            I meant not "%CSIDL_PERSONAL". I meant with "workplace" --> "My Computer". (In German is this workplace = Arbeitsplatz.)

            Comment


            • #7
              Try CSIDL_DRIVES
              kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

              Comment


              • #8
                CSIDL_PERSONAL, CSIDL_DRIVES, whatever.

                My point was you should not hard-code a literal value for these special folders, since A) the name varies based on the user's language and B) they are moveable.

                Moot if this application (not described) runs only on specific computers, but still a good habit to acquire.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Here's a little program that dumps all the environment variables. Some of them contain useful 'informationen uber den arbeitsplatz'!

                  Code:
                  #Compile Exe
                  #Dim All
                  
                  Function PBMain () As Long
                    Local strData As String
                    Register i As Long
                  
                    Console Set Screen 80,200
                    Do
                      Incr i
                      strData=Environ$(i)
                      Print Left$(strData,200)
                    Loop While Len(strData)
                    Waitkey$
                    
                    PBMain=0
                  End Function
                  Fred
                  "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                  Comment


                  • #10
                    Originally posted by Kev Peel View Post
                    Try CSIDL_DRIVES
                    Many Thanks!

                    Comment

                    Working...
                    X