Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Computer name
Message
From
27/03/2003 18:43:37
 
 
To
27/03/2003 17:52:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00771063
Message ID:
00771092
Views:
7
The following should give you the name of a computer for a file or path passed to it. It uses the getUNCpath function written by Andrew Coates from the link that Sergey pointed you to (http://www.civilsolutions.com.au/publications/getuncpath.htm).
function GetFileLocation

  lparameters m.lcFile2Check
  *!* 3/27/2003 Written by Elmer Adkins
  *!* dependencies - getUNCPAth function Written by Andrew Coates
  *!* returns name of computer where a specified file or path is located
  *!* must pass name of a file that exists or path that exists.
  local m.lcUNCpath,m.lcCompName
  if pcount() = 0 .or. type("m.lcFile2Check") <> "C" or (!file(m.lcFile2Check) and !directory(m.lcFile2Check))
    return ""
  else
    m.lcUNCpath = getUNCpath(m.lcFile2Check)
    if left(m.lcUNCpath,2) = "\\"
      m.lcCompName = substr(m.lcUNCpath,3)
      if at("\",m.lcCompName) > 0
        return substr(m.lcCompName,1,at("\",m.lcCompName)-1)
      else
        return m.lcCompName
      endif
    else
      m.lcCompName = sys(0)
      return iif("#"$m.lcCompName,substr(m.lcCompName,1,at("#",m.lcCompName)-1),m.lcCompName)
    endif
  endif
  return ""
>Hi
>
>How do I determine the name of the computer where an executable resides???
>
>Regards
>Geoff Scott
Previous
Reply
Map
View

Click here to load this message in the networking platform