Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Khurram Tahir
  Where is Khurram Tahir?
 Karachi
 Pakistan
 Khurram Tahir
 To: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 Tags
Subject: RE: Set default to in Multiuser
Thread ID: 331393 Message ID: 331417 # Views: 31 # Ratings: 0
Version: Visual FoxPro 9 Category: Projects and Design
Date: Thursday, December 29, 2011 7:00:52 PM         
   


> > OS = Win-Xp-Sp3 OR Win7
> >
> > There are following ways to set the default folder
> >
> > 1.
Set default to \\MyServer\MyFolder

> >
> > 2.
Set default to M:\MyFolder

> >
> >
> > I want to know about 2nd Option
> >
> > e.g. for server it would be
> >
 Set default to D:\MyFolder

> >
> > & for every workstation it is like
> >
> >
Set default to M:\MyFolder

> >
> > as D: Drive of Server Map on Letter M: on workstations
> >
> > How handle the above situation in main.prg that it will work for both Server & Workstations
>
>
> Hi,
> If you want to test things why not ping the router or server IP address?
> If you ping the server the router must be up as the server I expect is connected to the router or a switch off of the router.
>
> Below are two VFP ping functions to review:
>
>
* --- Ping.prg
> * --- Syntax: = PING("cServerName")
> *--- Returns a .T., or a .F.
> FUNCTION Ping
> PARAMETERS mPc
> LOCAL mCommand, Ret, mStr,cfile,RunOBJ
> Ret = .F.
> cfile=sys(3)
> mCommand = Getenv("ComSpec") + " /C ping " + ALLTRIM(mPc)+ [ -n 1 -l 1 -w 1 > "]+cfile+["]
> RunOBJ = Createobject("wscript.shell")
> = RunOBJ.Run(mCommand,0,.T.)
> IF FILE(cfile)
>   mStr = FileToStr(cfile)
>   Ret = IIF([Reply from] $ mStr,.T.,.F.)
> ENDIF
> * --- Remove the ping capture file.
> DELETE FILE 
> RETURN Ret

>
> Here is another version of a Ping() function using Windows API call and targeting the IP address instead of a server name.
>
* --- PingAPI.prg - Coded as a function.
> * --- Format : = PingAPI("10.162.15.75")
> LPARAMETERS lChkIP
> DECLARE INTEGER GetRTTAndHopCount IN Iphlpapi;
> INTEGER DestIpAddress, LONG @HopCount,;
> INTEGER MaxHops, LONG @RTT
> 
> DECLARE INTEGER inet_addr IN ws2_32 STRING cp
> 
> LOCAL nHop, nRTT
> nIPDest = inet_addr(lChkIP)
> IF GetRTTAndHopCount(nIPDest, @nHop, 50, @nRTT) <> 0
>   RETURN .T.
> ELSE
>   RETURN .F.
> ENDIF

>
> Pete "the IceMan", from the Great White North of Canada.
> www.marathongriffincomputers.com

Thanx for your methods

Here in this case IP is not fix set on Auto setting of TCP/IP of Local Area Connection

Please guide that how can check that Program is Running from Server or from Workstations on that use D: or M: for setting Set default to

Using Free Tables NOT DBC

ENTIRE THREAD

Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 4:53:49 PM
RE: Set default to in Multiuser Posted by tushar @ 12/29/2011 5:00:03 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 5:03:37 PM
RE: Set default to in Multiuser Posted by tushar @ 12/29/2011 5:24:30 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 5:33:44 PM
RE: Set default to in Multiuser Posted by tushar @ 12/29/2011 5:38:34 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 6:06:09 PM
RE: Set default to in Multiuser Posted by tushar @ 12/29/2011 7:42:31 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/30/2011 3:49:13 AM
RE: Set default to in Multiuser Posted by tushar @ 12/30/2011 5:25:45 AM
RE: Set default to in Multiuser Posted by Koen Piller @ 12/29/2011 5:43:40 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 6:11:49 PM
RE: Set default to in Multiuser Posted by Koen Piller @ 12/29/2011 6:23:57 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 6:44:27 PM
RE: Set default to in Multiuser Posted by Koen Piller @ 12/29/2011 7:13:52 PM
RE: Set default to in Multiuser Posted by Jun Tangunan @ 12/30/2011 4:28:13 AM
RE: Set default to in Multiuser Posted by Pete Sass @ 12/29/2011 6:48:16 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/29/2011 7:00:52 PM
RE: Set default to in Multiuser Posted by Pete Sass @ 12/29/2011 7:24:54 PM
RE: Set default to in Multiuser Posted by Jun Tangunan @ 12/30/2011 4:15:56 AM
RE: Set default to in Multiuser Posted by Pete Sass @ 12/29/2011 7:47:07 PM
RE: Set default to in Multiuser Posted by Khurram Tahir @ 12/30/2011 4:17:36 AM
RE: Set default to in Multiuser Posted by Gordon King @ 12/30/2011 8:24:36 AM
RE: Set default to in Multiuser Posted by Gordon King @ 12/29/2011 8:47:35 PM
RE: Set default to in Multiuser Posted by Suresh Adhikari @ 12/30/2011 12:46:27 PM