Hi all
Users are complaining that when running the following code more than once, GetFile() displays the contents of the folder the user last browsed to despite the code changing the default directory to the My Documents folder before calling GetFile(). I simply do not see how this could happen but I have had the issue demonstrated to me and I have seen it with my own eyes .... I am completely stumped and cannot reproduce the problem myself.
FWIW this is a VFP9 app running under Windows 10
#Define CSIDL_PERSONAL 0x0005 Local lcDocumentsPath, lcOriginalPath lcOriginalPath = SET("Default") + SYS(2003) lcDocumentsPath = Space(255) Declare SHORT SHGetFolderPath In SHFolder.Dll ; INTEGER hwndOwner, Integer nFolder, Integer hToken, ; INTEGER dwFlags, String @pszPath SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @lcDocumentsPath) lcDocumentsPath = Alltrim(lcDocumentsPath) Set Default To (lcDocumentsPath) ? GetFile() SET DEFAULT TO (lcOriginalPath)
Any ideas anybody?
Thanks
Paul Newton
Paul Newton wrote on 2017-05-04:
Hi all
Users are complaining that when running the following code more than
once, GetFile() displays the contents of the folder the user last browsed to despite the code changing the default directory to the My Documents folder before calling GetFile(). I simply do not see how this could happen but I have had the issue demonstrated to me and I have seen it with my own eyes .... I am completely stumped and cannot reproduce the problem myself.
FWIW this is a VFP9 app running under Windows 10
#Define CSIDL_PERSONAL 0x0005 Local lcDocumentsPath, lcOriginalPath lcOriginalPath = SET("Default") + SYS(2003) lcDocumentsPath = Space(255) Declare SHORT SHGetFolderPath In SHFolder.Dll ; INTEGER hwndOwner, Integer nFolder, Integer hToken, ; INTEGER dwFlags, String @pszPath SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @lcDocumentsPath) lcDocumentsPath = Alltrim(lcDocumentsPath) Set Default To (lcDocumentsPath) ? GetFile() SET DEFAULT TO (lcOriginalPath)
Any ideas anybody?
Thanks
Paul Newton
Paul,
Only chance that would happen is when the lcDocumentsPath is empty.
Tracy Pearson PowerChurch Software
SHGetFolderPath is apparently deprecated and SHGetKnownFolderPath is apparently the new way.
Yes but SHGetFolderPath is effectively a wrapper for SHGetKnownFolderPath or it at least ends up calling SHGetKnownFolderPath
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Alan Bourke Sent: 04 May 2017 19:37 To: profoxtech@leafe.com Subject: Re: GetFile() problem (VFP9, Win 10)
SHGetFolderPath is apparently deprecated and SHGetKnownFolderPath is apparently the new way.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
On Thu, 4 May 2017, at 03:23 PM, Paul Newton wrote:
Hi all
Users are complaining that when running the following code more than once, GetFile() displays the contents of the folder the user last browsed to despite the code changing the default directory to the My Documents folder before calling GetFile(). I simply do not see how this could happen but I have had the issue demonstrated to me and I have seen it with my own eyes .... I am completely stumped and cannot reproduce the problem myself.
FWIW this is a VFP9 app running under Windows 10
#Define CSIDL_PERSONAL 0x0005 Local lcDocumentsPath, lcOriginalPath lcOriginalPath = SET("Default") + SYS(2003) lcDocumentsPath = Space(255) Declare SHORT SHGetFolderPath In SHFolder.Dll ; INTEGER hwndOwner, Integer nFolder, Integer hToken, ; INTEGER dwFlags, String @pszPath SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @lcDocumentsPath) lcDocumentsPath = Alltrim(lcDocumentsPath) Set Default To (lcDocumentsPath) ? GetFile() SET DEFAULT TO (lcOriginalPath)
Any ideas anybody?
Thanks
Paul Newton
[excessive quoting removed by server]
Maybe take a look at the SHSpecialFolder method in the VFP2C32 .fll library.
https://github.com/ChristianEhlscheid/vfp2c32
Although it's another lib to ship etc.
Alan
I downloaded it but all the help topics are blank ...
Paul
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Alan Bourke Sent: 05 May 2017 09:59 To: profoxtech@leafe.com Subject: Re: GetFile() problem (VFP9, Win 10)
Maybe take a look at the SHSpecialFolder method in the VFP2C32 .fll library.
https://github.com/ChristianEhlscheid/vfp2c32
Although it's another lib to ship etc.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]
You need to unblock it.
How to Unblock files in Windows http://sysc.org/discuss/unblock-files-windows-10-file-came-another-computer/
Gianni
On Fri, 5 May 2017 09:29:58 +0000, Paul Newton Paul.Newton@pegasus.co.uk wrote:
Alan
I downloaded it but all the help topics are blank ...
Paul
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Alan Bourke Sent: 05 May 2017 09:59 To: profoxtech@leafe.com Subject: Re: GetFile() problem (VFP9, Win 10)
Maybe take a look at the SHSpecialFolder method in the VFP2C32 .fll library.
https://github.com/ChristianEhlscheid/vfp2c32
Although it's another lib to ship etc.
That did it - thanks Gianni (and Alan)
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Gianni Turri Sent: 05 May 2017 10:53 To: profoxtech@leafe.com Subject: Re: GetFile() problem (VFP9, Win 10)
You need to unblock it.
How to Unblock files in Windows http://sysc.org/discuss/unblock-files-windows-10-file-came-another-computer/
Gianni
On Fri, 5 May 2017 09:29:58 +0000, Paul Newton Paul.Newton@pegasus.co.uk wrote:
Alan
I downloaded it but all the help topics are blank ...
Paul
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Alan Bourke Sent: 05 May 2017 09:59 To: profoxtech@leafe.com Subject: Re: GetFile() problem (VFP9, Win 10)
Maybe take a look at the SHSpecialFolder method in the VFP2C32 .fll library.
https://github.com/ChristianEhlscheid/vfp2c32
Although it's another lib to ship etc.
[excessive quoting removed by server]
Try the unblocking thing, if that fails I have printed it to PDF so can bung you that.
On 2017-05-05 04:59, Alan Bourke wrote:
Maybe take a look at the SHSpecialFolder method in the VFP2C32 .fll library.
https://github.com/ChristianEhlscheid/vfp2c32
Although it's another lib to ship etc.
What's one more very small sized FLL to include? No big deal at all!?
When your installed base has a good few zeros after it it is a slight consideration.