Silverfrost Forums

Welcome to our forums

Browse_for_folder1@ is failing to create a user-named folder

18 Jan 2019 4:54 #23124

The following code segment asks for the user to choose or create a folder. Choosing an existing folder works fine, but creating a folder with a new non-default name does the following when you click OK :

The folder is created with the name you typed in The program quits with no error/crash indication

If you just want a new folder created (default name), it works fine.

I'm not sure when this stopped working properly.

Running V8.40.0.

	winapp
	PROGRAM MAIN
    use mswin
	character*260:: returned_path=' '
    integer:: uint=z'41'
    integer(7):: window_handle=0
    if(browse_for_folder1@(window_handle,'Caption',returned_path,uint)) then
      print *,'Returned:',trim(returned_path)
    else
      print *,'Cancelled'
    endif
    end
18 Jan 2019 5:05 #23125

It also doesn't work in programs compiled in June of last year with 8.30.0.

18 Jan 2019 6:07 #23126

This was extracted from the MSDN site. Is it applicable?

Note If COM is initialized using CoInitializeEx with the COINIT_MULTITHREADED flag, SHBrowseForFolder fails if the calling application uses the BIF_USENEWUI or BIF_NEWDIALOGSTYLE flag in the BROWSEINFO structure.

https://docs.microsoft.com/en-us/windows/desktop/api/shlobj_core/nf-shlobj_core-shbrowseforfoldera

18 Jan 2019 11:18 #23127

Looking back at some of my posts, it occurred to me that I have had something like this problem before.

And, looks like I still have. It is not a problem with FTN95 or the libraries.

Running the software on a different platform. It would appear that it works just fine.

So it is unfortunate, but my development system has some kind of problem.

If anyone has any insight into what I should look at/fix, I'm open for suggestions. I tried a LOT of different things (a couple of years ago), but nothing seemed to work.

Thoughts?

21 Jan 2019 5:05 #23130

Some more information.

Running as Admin, works fine. Running as a user (different account), it kinda works. Kinda meaning that when I change the folder name, it gets changed, but reports the original folder name (i.e. New Folder) to the program. Like there is something delaying the setting of the proper name to the program. But, oddly, actually changing the name on disk!

I tried Clean Boot, and that didn't help at all.

Development computer is Windows 10 Pro 64-bit (upgraded from Windows 7 Pro), 32 GB ram, i&-3820 @ 3.6GHz. Nvidia GT-660 graphics card.

Running 8.40.0. Similar problem with 8.30.0 in the real application.

21 Jan 2019 7:30 #23131

It seems likely that this is a Microsoft issue where, for this particular operating system, the new folder requires elevated access privileges.

I can't see a way to get at a Microsoft error code for the failure which in any case would probably be 'Access denied'.

At the moment the routine calls upon SHBrowseForFolder. At some point this could be reworked in order to use IFileDialog instead but this may not make any difference to the outcome.

21 Jan 2019 10:06 #23132

IT support can often make settings in your computer that stop things working. I have an app that worked fine on all manner of computers. IT reconfigured the (very easy to steal) laptops (which replaced big boxes that no-one wanted) it ran on during a field course some 60 miles from base to check if they were on a LAN in the building where the techie worked, and if not, they would shut down*. After working out what the problem was, and several shouted phone calls, the fat techie came down to site, reconfigured all the machines and set the default directories used by the app to ‘read only’. Fortunately, there was always the USB stick.

IT support is thus staffed by people whose sole interest is to – well you may get my meaning, but nose picking, porn watching, games playing and scratching unmentionable areas leap to mind - pick which one fits).

Things aren’t any better if you do your own IT support !!!**

Eddie

*At that point, I realised that files needed to be saved on ‘Exit Windows’, and why format code %ew is important!

** Some of my own issues disappeared after a clean re-install. If you create a Windows 10 install CD by downloading the appropriate ISO from MS, you can install Win 10 afresh onto a clean boot device. This is a good moment to fit an SSD if you haven't already. Voila! Many issues simply disappear,

And before you ask, I do my own IT support, and my vice is pulling my hair out while cursing at the screen!

21 Jan 2019 2:41 #23135

Paul, I agree that this is a Microsoft (and ME!) issue. From the lack of other user responses, it would appear that it is just me! And, none of my users have complained either, so it is isolated.

Using the IFileDialog might work. The file dialog does not have the problem of creating a folder and renaming it. I have limited experience in using system functions, but have done a couple, and will pursue this as an alternative. There are limited examples for this specific functionality on line.

One question: I do use the 'alt_open_save' option. I discovered that I needed to use this for regular file dialogs. It matters not if I use it for this problem. I wonder if that might be a clue.

My next recourse is to back up my entire user account, remove it, and rebuild it from scratch. The next step (drastic) is a fully clean install of Windows 10.

When all else fails, nuke and pave.

21 Jan 2019 2:47 #23136

Bill,

Several experiences have convinced me that the clean install is the answer to many Windows 'issues'. Be brave!

(And it's always useful to have a spare computer!)

Eddie

21 Jan 2019 3:58 #23137

Bill

For 64 bit code, at the moment browse_for_folder1@ does not make use of the user's setting for 'alt_open_save'.

22 Jan 2019 2:03 #23143

It will be a while before I start another conversion process to 64-bit! Thanks for the heads up, though.

22 Jan 2019 2:20 #23144

Quoted from wahorger It will be a while before I start another conversion process to 64-bit!

Bill, I hope that is not an indication that you are reluctant to use /64. All my coding is now 64-bit ( although I do use both 32-bit and 64-bit FTN95 for development testing in case they identify different problems )

John

22 Jan 2019 5:08 #23145

John,

Not reluctant at all! I have done a great deal to make this version of my SW ready for 64-bit. I just happen to have numerous customers who are using older machines without 64-bit capability, so there's no hurry.

Bill

6 Feb 2019 4:19 #23213

Well, I bit the bullet and first tried to force a different User Profile (the easy solution?). That didn't full work, and left the system in an odd state. So, clean boot, reinstall everything.

This part was very interesting, as I hadn't really realized how many different tools I had on my system that made life easy for development and deployment. Many were obvious, but some were not, and when I needed them during my rebuild, I found I really missed them!

The good thing is now I can use the browse_for_folder1@() option z'41' without an issue. It all works as does my other system.

I just wish I knew what part of the system got 'broken' and how I could have fixed it more easily.

N.B. I had to re-install every FTN95 compiler, starting at 7.10 to ensure I had the proper version with no Personal Edition splash screen. I'm hoping that the next release has a FULL moniker on it to prevent me from installing 9 versions of the compiler. Even though the install is quick, it's still a pain.

6 Feb 2019 10:07 #23216

Bill,

I told you* (amidst a whole bunch of 'asides') that a clean install would fix it, and I very much regret that reinstalling so many other applications has wasted much time, but equally, I am glad for you that it worked. On the basis of several experiences I would estimate that the clean install takes about 3 days to get everything reinstalled afterwards.

Why Windows takes a dislike to one particular thing is a mystery only solvable by gaining a complete mastery of the Registry and its most arcane settings. That would take more than the odd 3 days now and then out of your life. A different User Profile simply inherits the bad genes from its parent, and is never a complete solution.

Eddie

*I don't mind the lack of effusive outpourings of gratitude, but if you can send the food parcels to us starving Brits, we'd be suitably grateful (apparently, after Brexit, shops will be empty). Unlike 80 years ago, there shouldn't be U-boat packs out there, but one never knows ...

6 Feb 2019 10:59 #23217

Eddie, made me laugh, especially your Brexit reference. A good English friend of mine waxes poetic when speaking of all things Brexit, so I understand why you might wish food parcels.

The odd thing about user profiles was the Admin and both other user profiles (one was a guest account, for goodness sake) would work just fine. But not my development profile.

Yes, it has taken around three days (so far). One day of intense work, followed by the next two of just putting back what I needed (and had saved the downloads for). I still have more to do, but I'll take them one day at a time.

One advantage is my boot drive (and SSD) is relatively clean now. I opted to not use Adobe PDF, going for FoxIT instead (a better product in so many ways). And cheaper. I have a couple of pieces of Adobe SW that I'll load back on, but not the full suite as before.

I remember the 'good old days' when a rebuild took about 1-3 hours and everything could just be loaded back from the backup device without having to go through installs, crypto verification of users, and other junk.

Ah, simpler days.

And, watch for the U-boats. Don't think the Germans are too happy with the UK right now.....

Bill

7 Feb 2019 9:15 #23218

My understanding is that if you need to install FTN95 etc. on a clean machine then you should be able to install your first licenced version and then go directly to installing the latest update.

7 Feb 2019 2:28 #23220

Paul, that's good to know. Thanks!

7 Feb 2019 5:41 #23221

I recommend Helen Hanff's epistolary '84 Charing Cross Road' for food parcel info.

Eddie

8 Feb 2019 8:22 #23223

German lifts? I was astonished once while in Holzminden to find that my hotel had a Schindler's Lift. Yet that was beaten in the humour stakes by the shop named Blumen Ecke a stone's throw away.

But seriously. The point is that Windows has so many settings and options that sometimes the only solution is a clean install. One shouldn't under rate just how effective it is. Similarly, you shouldn't underestimate the time it takes to get back all the software you used prior to the reinstall.

My view is that one should take the opportunity to carry out preventative maintenance and upgrades at the same time.

Eddie

Please login to reply.