Just curious: Normally YOU would create the filename, and then FCREATE() does its job. Why don't you know the filename you put into the function?
[excessive quoting removed by server]
Or asked differently: Why do you have a FileHandle, but not the FileName? Sounds like a strange way of encapsulation :)
-----Ursprüngliche Nachricht----- Von: ProFox profox-bounces@leafe.com Im Auftrag von juergen@wondzinski.de Gesendet: Freitag, 2. August 2019 17:26 An: 'ProFox Email List' profox@leafe.com Betreff: RE: Get file path and name from file handle
Just curious: Normally YOU would create the filename, and then FCREATE() does its job. Why don't you know the filename you put into the function?
[excessive quoting removed by server]
Hi Juergen
The FCREATE/FOPEN is used in several places throughout the code and I would need to somehow store and preserve the open file details. Being able to find the file from the file handle would be much more convenient
Paul Newton
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: 02 August 2019 16:26 To: profoxtech@leafe.com Subject: RE: Get file path and name from file handle
Sent by an external sender ------------------------------
Just curious: Normally YOU would create the filename, and then FCREATE() does its job. Why don't you know the filename you put into the function?
[excessive quoting removed by server]
Hio Paul,
Add a collection (or Array) to _screen, with two columns. One for the filehandle, one for the filename. That way you can search for handle or name.
Or, more sophisticated: Create an helperobject for the various F* functions to work directly with that collection, which would then be part of that object. That way you could add a GetFileNameFromHandle method and many more. Added benefit would be an automatic FClose if that object goes south. :)
-----Ursprüngliche Nachricht----- Von: ProFox profox-bounces@leafe.com Im Auftrag von Paul Newton Gesendet: Montag, 5. August 2019 09:48 An: profox@leafe.com Betreff: RE: Get file path and name from file handle
Hi Juergen
The FCREATE/FOPEN is used in several places throughout the code and I would need to somehow store and preserve the open file details. Being able to find the file from the file handle would be much more convenient
Paul Newton
Thanks for the suggestions Juergen. Paul Newton
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of juergen@wondzinski.de Sent: 05 August 2019 09:26 To: profoxtech@leafe.com Subject: AW: Get file path and name from file handle
Sent by an external sender ------------------------------
Hio Paul,
Add a collection (or Array) to _screen, with two columns. One for the filehandle, one for the filename. That way you can search for handle or name.
Or, more sophisticated: Create an helperobject for the various F* functions to work directly with that collection, which would then be part of that object. That way you could add a GetFileNameFromHandle method and many more. Added benefit would be an automatic FClose if that object goes south. :)
-----Ursprüngliche Nachricht----- Von: ProFox profox-bounces@leafe.com Im Auftrag von Paul Newton Gesendet: Montag, 5. August 2019 09:48 An: profox@leafe.com Betreff: RE: Get file path and name from file handle
Hi Juergen
The FCREATE/FOPEN is used in several places throughout the code and I would need to somehow store and preserve the open file details. Being able to find the file from the file handle would be much more convenient
Paul Newton
[excessive quoting removed by server]
The FCREATE/FOPEN is used in several places throughout the code and I would need to somehow store and preserve the open file details.
Paul
AFAIK the VFP file handle is internal to VFP and does not equate to a Windows hFile, and as such trying to use Windows API functions like GetFileNameByHandle won't work.
An ideal case for a manager class I reckon.
Thanks Alan - that would definitely need to be investigated Paul
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Alan Bourke Sent: 06 August 2019 12:02 To: profoxtech@leafe.com Subject: Re: Get file path and name from file handle
Sent by an external sender ------------------------------
The FCREATE/FOPEN is used in several places throughout the code and I would need to somehow store and preserve the open file details.
Paul
AFAIK the VFP file handle is internal to VFP and does not equate to a Windows hFile, and as such trying to use Windows API functions like GetFileNameByHandle won't work.
An ideal case for a manager class I reckon.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]