Alaska Software Inc. - XbpFileDialog in a network
Username: Password:
AuthorTopic: XbpFileDialog in a network
PeterXbpFileDialog in a network
on Fri, 18 Mar 2005 12:46:43 +0100
If i use XbpFileDialog the working-directory could be changed by the user.
If my program is not runnuing in a network i do it so:

oldpath = CurDrive()+":\"+CurDir()   save current drive and path
...
XbpFileDialog()
...
CurDir(oldpath)     set drive and path to the old value
return

But in my win-network this only works on the server.
On the stations i got a error ind the line CurDir(path)
How can i set the path back on the stations? Any hints?
Phil Ide
Re: XbpFileDialog in a network
on Fri, 18 Mar 2005 13:52:35 +0000
Peter,

> If i use XbpFileDialog the working-directory could be changed by the user.
> If my program is not runnuing in a network i do it so:
> 
> oldpath = CurDrive()+":\"+CurDir()   save current drive and path
> ...
> XbpFileDialog()
> ...
> CurDir(oldpath)     set drive and path to the old value
> return
> 
> But in my win-network this only works on the server.
> On the stations i got a error ind the line CurDir(path)
> How can i set the path back on the stations? Any hints?

Very simple:

  oFileDialog:restoreDir := TRUE

This causes the current directory to be restored before returning the name
of the directory the user selected.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Only those who attempt the absurd achieve the impossible.
PeterRe: XbpFileDialog in a network
on Fri, 18 Mar 2005 16:32:49 +0100
oFileDialog:restoreDir := TRUE

I use xBase Version 1.5 and it semms, that my XbpFileDialog don`t know this
methode



"Phil Ide" <phil@idep.org.uk> schrieb im Newsbeitrag
news:1dvlbr982m2ro$.dlg@idep.org.uk...
> Peter,
>
> > If i use XbpFileDialog the working-directory could be changed by the
user.
> > If my program is not runnuing in a network i do it so:
> >
> > oldpath = CurDrive()+":\"+CurDir()   save current drive and path
> > ...
> > XbpFileDialog()
> > ...
> > CurDir(oldpath)     set drive and path to the old value
> > return
> >
> > But in my win-network this only works on the server.
> > On the stations i got a error ind the line CurDir(path)
> > How can i set the path back on the stations? Any hints?
>
> Very simple:
>
>   oFileDialog:restoreDir := TRUE
>
> This causes the current directory to be restored before returning the name
> of the directory the user selected.
>
> Regards,
> --
> Phil Ide
>
> ***************************************
> * Xbase++ FAQ, Libraries and Sources: *
> * goto: http://www.idep.org.uk/xbase  *
> ***************************************
>
> Only those who attempt the absurd achieve the impossible.
Phil Ide
Re: XbpFileDialog in a network
on Fri, 18 Mar 2005 17:25:24 +0000
Peter,

> oFileDialog:restoreDir := TRUE
> 
> I use xBase Version 1.5 and it semms, that my XbpFileDialog don`t know this
> methode

No, I think it came in at around 1.7.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Have to go reboot the coffee machine now.
Thomas Braun Re: XbpFileDialog in a network
on Fri, 18 Mar 2005 15:27:17 +0100
Peter wrote:

> But in my win-network this only works on the server.
> On the stations i got a error ind the line CurDir(path)

Tell us what error you get, please!

> How can i set the path back on the stations? Any hints?

Not sure what your problem exactly is , but I'm using the following
function to get the current directory, which works with drives mapped to
drive letters as well as with UNC paths...

FUNCTION GetCurPath()
   LOCAL cDrive        := UPPER(CURDRIVE())
   LOCAL cAppDirectory := CURDIR( cDrive )

   IF cDrive $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
      cDrive := cDrive + ":\"
   ELSE
      cDrive := ""
   ENDIF

RETURN cDrive + cAppDirectory

Just take the return value of GetCurPath() and feed it into CurDir() to get
back to the original dir.

HTH
Thomas Braun
PeterRe: XbpFileDialog in a network
on Fri, 18 Mar 2005 16:47:14 +0100
only in the network I got this errror:

Operation: curDir
ThreadID: 1
Betriebssystem Fehler: 161
aufgerufen von  ...341

that is my line 341:   CurDir(old_path)

I have at the begin of my proc:
if NetName() = master                          das ist der Hauptrechner
   old_path:=CurDrive()+":\"+CurDir()
else
   old_path:=CurDir()
endif

local it works without any problem.

Here is the errorlog:


----------------------------------------------------------------------------
--
FEHLERPROTOKOLL von "\\PETER\PETER-C\PROGRAMME\SKATTURNIERMANAGER\TM.EXE"
Datum: 18.03.2005 16:40:05

Xbase++ Version     : Xbase++ (R) Version 1.50.238
Betriebssystem      : Windows 98  4.10 Build 02222  A
----------------------------------------------------------------------------
--
oError:args         :
          -> VALTYPE: C VALUE: \\PETER\PETER-C\Programme\SkatTurniermanager
oError:canDefault   : .T.
oError:canRetry     : .T.
oError:canSubstitute: .F.
oError:cargo        : NIL
oError:description  : Betriebsystemfehler
oError:filename     :
oError:genCode      :         40
oError:operation    : curDir
oError:osCode       :        161
oError:severity     :          2
oError:subCode      :          4
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          1
----------------------------------------------------------------------------
--
CALLSTACK:
----------------------------------------------------------------------------
--
Aufgerufen von SPEICHERN(341)
Aufgerufen von (B)D1412(231)
Aufgerufen von MAIN(154)










"Thomas Braun" <nospam@software-braun.de> schrieb im Newsbeitrag
news:1cswywq8dv8d5.1e2klsxgqm5f5.dlg@40tude.net...
> Peter wrote:
>
> > But in my win-network this only works on the server.
> > On the stations i got a error ind the line CurDir(path)
>
> Tell us what error you get, please!
>
> > How can i set the path back on the stations? Any hints?
>
> Not sure what your problem exactly is , but I'm using the following
> function to get the current directory, which works with drives mapped to
> drive letters as well as with UNC paths...
>
> FUNCTION GetCurPath()
>    LOCAL cDrive        := UPPER(CURDRIVE())
>    LOCAL cAppDirectory := CURDIR( cDrive )
>
>    IF cDrive $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
>       cDrive := cDrive + ":\"
>    ELSE
>       cDrive := ""
>    ENDIF
>
> RETURN cDrive + cAppDirectory
>
> Just take the return value of GetCurPath() and feed it into CurDir() to
get
> back to the original dir.
>
> HTH
> Thomas Braun
Thomas Braun Re: XbpFileDialog in a network
on Mon, 21 Mar 2005 08:38:39 +0100
Peter wrote:

> only in the network I got this errror:
> 
> Operation: curDir
> ThreadID: 1
> Betriebssystem Fehler: 161
> aufgerufen von  ...341
[snipped]
> 
> local it works without any problem.

Am I right that you are starting the program on a UNC type path?

What happens if you map a drive letter to the UNC path?

Try

net use F: \\PETER\PETER-C\Programme\SkatTurniermanager

...then start the program from F: instead.

This could as well be a problem with Xbase++ 1.50. 

Just to be sure you could try and download the current Xbase++ DEMO version
from the Alaska homepage and create a small test program.

Thomas Braun
PeterRe: XbpFileDialog in a network
on Mon, 21 Mar 2005 12:14:41 +0100
Hallo Thomas,

> Am I right that you are starting the program on a UNC type path?
yes

> What happens if you map a drive letter to the UNC path?
it works without any problem

I think its a big problem to let the user map the drive, and ist not a good
solution to disable this functions on any workstation.
Do you habe any idea?
Thomas Braun Re: XbpFileDialog in a network
on Mon, 21 Mar 2005 16:30:11 +0100
Peter wrote:

> I think its a big problem to let the user map the drive, and ist not a good
> solution to disable this functions on any workstation.
> Do you habe any idea?

The OS error code means something like "invalid path name", so there are
(IMO) only a few possible causes:

- There is an error in your Xbase++ release

  Test with the current 1.8x version

- The problem you are having is related to Windows 98 or the network
environment (which I suspect), maybe it is not possible in Win98 to set the
current dir to an UNC path.

  Test with a different network environment


The following code is running without problem here on my XP workstation
from a shared directory on my W2K3 server (\\server1\global)

   CLS

   ? ( cPath := GetCurPath() )   \\server1\global

   CurDir("C:\Programme")

   ? GetCurPath()                C:\Programme

   CurDir(cPath)

   ? GetCurPath()                \\server1\global

   @ 24,2 SAY "press any key to continue"

Thomas Braun
PeterRe: XbpFileDialog in a network
on Wed, 23 Mar 2005 09:21:19 +0100
Yes,  you are right. Its in Version 1.7 a bug in XbpFileDialog (PDR-2154)
It`s fixed in version 1.7. The workaround it so save the drive and path, but
this works only lokal. The bug with UNC-Drives ( PDR-3440) isn`t fixed.

It seem I should update 


"Thomas Braun" <nospam@software-braun.de> schrieb im Newsbeitrag
news:1dd67vf6ghryb.wm6wng5d3mi7.dlg@40tude.net...
> Peter wrote:
>
> > I think its a big problem to let the user map the drive, and ist not a
good
> > solution to disable this functions on any workstation.
> > Do you habe any idea?
>
> The OS error code means something like "invalid path name", so there are
> (IMO) only a few possible causes:
>
> - There is an error in your Xbase++ release
>
>   Test with the current 1.8x version
>
> - The problem you are having is related to Windows 98 or the network
> environment (which I suspect), maybe it is not possible in Win98 to set
the
> current dir to an UNC path.
>
>   Test with a different network environment
>
>
> The following code is running without problem here on my XP workstation
> from a shared directory on my W2K3 server (\\server1\global)
>
>    CLS
>
>    ? ( cPath := GetCurPath() )   \\server1\global
>
>    CurDir("C:\Programme")
>
>    ? GetCurPath()                C:\Programme
>
>    CurDir(cPath)
>
>    ? GetCurPath()                \\server1\global
>
>    @ 24,2 SAY "press any key to continue"
>
> Thomas Braun
Thomas Braun Re: XbpFileDialog in a network
on Wed, 23 Mar 2005 11:03:22 +0100
Peter wrote:

> Yes,  you are right. It´s in Version 1.7 a bug in XbpFileDialog (PDR-2154)
> It`s fixed in version 1.7. The workaround it so save the drive and path, but
> this works only lokal. The bug with UNC-Drives ( PDR-3440) isn`t fixed.

Hmmm... according to PDR 3440, my sample should not be working. But it
does. Maybe someone at Alaska should check this PDR again and change its
status.

The wording of the PDR is not very precise as well.

Instead of "works only with ..." I would like to have a description of what
happens if you try to use it with a UNC path. This would be more helpful.

Thomas
PeterRe: XbpFileDialog in a network
on Fri, 18 Mar 2005 17:18:37 +0100
Hallo Thomas,

with your function GetCurPath() I got the same error by
setting the path back with CurDir()

Is this possibly a bug of Version 1.5 ?




"Thomas Braun" <nospam@software-braun.de> schrieb im Newsbeitrag
news:1cswywq8dv8d5.1e2klsxgqm5f5.dlg@40tude.net...
> Peter wrote:
>
> > But in my win-network this only works on the server.
> > On the stations i got a error ind the line CurDir(path)
>
> Tell us what error you get, please!
>
> > How can i set the path back on the stations? Any hints?
>
> Not sure what your problem exactly is , but I'm using the following
> function to get the current directory, which works with drives mapped to
> drive letters as well as with UNC paths...
>
> FUNCTION GetCurPath()
>    LOCAL cDrive        := UPPER(CURDRIVE())
>    LOCAL cAppDirectory := CURDIR( cDrive )
>
>    IF cDrive $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
>       cDrive := cDrive + ":\"
>    ELSE
>       cDrive := ""
>    ENDIF
>
> RETURN cDrive + cAppDirectory
>
> Just take the return value of GetCurPath() and feed it into CurDir() to
get
> back to the original dir.
>
> HTH
> Thomas Braun