Loading ...
Sorry, an error occurred while loading the content.
 

Directory Short Name

Expand Messages
  • Richard Thomas
    Hi All: I m trying to use the MS Directory Program Files in a path for an ODBC32 call. I enclosed it in quotes but am getting problems perhaps because of
    Message 1 of 3 , Apr 28, 2006
      Hi All:
      I'm trying to use the MS Directory "Program Files" in a path for an ODBC32
      call. I enclosed it in quotes but am getting problems perhaps because of
      the space in the MS Directory name and I don't think ODBC likes the quotes.
      There is a short name for this Directory but I couldn't find it on google.
      Anyone know it off-hand? I know there is LB code to get short names (I'm
      not sure if that is even what I'm looking for) but if it is I can try that
      route.
      Rick
    • Zachary Antilley
      progra~1 Zack
      Message 2 of 3 , Apr 28, 2006
        progra~1

        Zack

        Richard Thomas wrote:
        > Hi All:
        > I'm trying to use the MS Directory "Program Files" in a path for an ODBC32
        > call. I enclosed it in quotes but am getting problems perhaps because of
        > the space in the MS Directory name and I don't think ODBC likes the quotes.
        > There is a short name for this Directory but I couldn't find it on google.
        > Anyone know it off-hand? I know there is LB code to get short names (I'm
        > not sure if that is even what I'm looking for) but if it is I can try that
        > route.
        > Rick
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
      • pendl2megabit
        Message 3 of 3 , May 2, 2006
          >
          > Hi All:
          > I'm trying to use the MS Directory "Program Files" in a path for
          > an ODBC32
          > call. I enclosed it in quotes but am getting problems perhaps because of
          > the space in the MS Directory name and I don't think ODBC likes
          > the quotes.
          > There is a short name for this Directory but I couldn't find it on google.
          > Anyone know it off-hand? I know there is LB code to get short names (I'm
          > not sure if that is even what I'm looking for) but if it is I can
          > try that
          > route.
          > Rick

          Rick,
          the prefered way to get the short form of a path is using the API function
          GetShortPathName.

          Example:

          '---code start
          filedialog "Select a file", DefaultDir$ + "\*.*", FileName$

          if FileName$ <> "" then
          print
          print "Long Filename: "; FileName$
          print "Short Filename: "; GetShortPathName$(FileName$)
          end if

          print
          print "Finished ..."
          end

          function GetShortPathName$(lpszLongPath$)
          lpszLongPath$ = lpszLongPath$ + chr$(0)
          cchBuffer = _MAX_PATH + 1

          [retryGetShortPathName]
          lpszShortPath$ = space$(cchBuffer) + chr$(0)

          calldll #kernel32, "GetShortPathNameA", _
          lpszLongPath$ as ptr, _
          lpszShortPath$ as ptr, _
          cchBuffer as ulong, _
          result as ulong

          select case
          case result = 0
          GetShortPathName$ = "ERROR encountered!"
          case result > cchBuffer
          cchBuffer = result
          goto [retryGetShortPathName]
          case else
          GetShortPathName$ = trim$(lpszShortPath$)
          end select
          end function
          '---code end

          ---
          Stefan Pendl






          ___________________________________________________________
          Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
        Your message has been successfully submitted and would be delivered to recipients shortly.