Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
22 Views

Browse for Folders

Jump to solution

I've checked on several previous posts and the code they supplied to browse for folders but too many things have changed with IVF. In my 2016 Composer XE I don't have a file called extrawinty.f90 nor many other things. Some of the solutions lead you to a website that VIPRE says is very bad and the file no longer exists there. So, does anyone have a code segment and how to use it? This is the last section of code for my project.

Thanks,

Brooks

0 Kudos

Accepted Solutions
Highlighted
Valued Contributor III
22 Views

it is in C:\Program Files (x86)\Intel\Composer XE\Samples\en_US\Fortran\win32.zip 

View solution in original post

0 Kudos
8 Replies
Highlighted
Valued Contributor III
22 Views

GetOpenFilename is a windows API tool the is an example of using is in the ifort sample programs

0 Kudos
Highlighted
Valued Contributor III
23 Views

it is in C:\Program Files (x86)\Intel\Composer XE\Samples\en_US\Fortran\win32.zip 

View solution in original post

0 Kudos
Highlighted
New Contributor I
22 Views

Hi Andrew,

I've looked at that example and I use it in my project; however, I did find

GetSaveFileName which will serve my purpose.

Thsnkd much,

Brooks

PS, missed you the last few days.

0 Kudos
Highlighted
22 Views

GetSaveFileName is used exactly the way GetOpenFileName is, just for a Save dialog.

0 Kudos
Highlighted
Valued Contributor III
22 Views

Has anyone got the newer  IfileDialog Interface working in Fortran, I had a quick look at it a couple of year ago and I recall a number of other forum members have looked at it and run away...... 

 
0 Kudos
Highlighted
Valued Contributor I
22 Views

I will point out that, although deprecated, SHBrowseForFolder() works fine in Windows 10.

INTEGER                                 :: pidl
CALL COMInitialize (status)

buffer = folderPath

!    TYPE T_BROWSEINFO
!        SEQUENCE
!        INTEGER                        :: hwndOwner
!        INTEGER                        :: pidlRoot
!        INTEGER                        :: pszDisplayName
!        INTEGER                        :: lpszTitle
!        INTEGER                        :: ulFlags
!        INTEGER                        :: lpfn
!        INTEGER                        :: lParam
!        INTEGER                        :: iImage
!    END TYPE T_BROWSEINFO

bi%hwndOwner      = hwndParent
bi%pidlRoot       = NULL
bi%pszDisplayName = LOC(buffer)
bi%lpszTitle      = LOC(titleBuffer)
bi%ulFlags        = BIF_RETURNONLYFSDIRS
bi%lpfn           = NULL
bi%lParam         = 0
bi%iImage         = 0

!	SHBrowseForFolder returns an item identifier list.
pidl = SHBrowseForFolder (bi)

IF (pidl /= 0) THEN

	SELECT CASE (windows_version)
	
	!	Win95 and Win98
	CASE (VER_PLATFORM_WIN32_WINDOWS)

		! We need to ask the shell to decode the item identifier
		! list into a parseable name. First, retrieve an IShellFolder 
		! COM interface handle to the desktop folder.
		rval2 = SHGetDesktopFolder(LOC(IShellFolder_desktop))
		IF (rval2 == NOERROR) THEN

			! Use the GetDisplayNameOf method to convert the item
			! identifier list into a string. The SHGDN_FORPARSING flag
			! indicates we want the parseable path, not the general-
			! purpose display label.
			rstring%uType = STRRET_CSTR
			rval2 = IShellFolder_GetDisplayNameOf (IShellFolder_desktop,
												   pidl,				
												   SHGDN_FORPARSING,	
												   LOC(rstring)			
			IF (rval2 == NOERROR) THEN
				folderPath = rstring%cStr
				CmnDlgChooseFolder = .TRUE.
			END IF
		END IF

	!	WinNT, Win2K, WinXP
	CASE DEFAULT           !(VER_PLATFORM_WIN32_NT)
		CmnDlgChooseFolder = SHGetPathFromIDList (pidl, folderPath)

	END SELECT

    CALL CoTaskMemFree (pidl)
END IF
CALL COMUnInitialize ()

 

0 Kudos
Highlighted
Valued Contributor III
22 Views

Thanks for commenting Paul. I know the older (deprecated) file API's work OK in W10 and are unlikely to stop working any time soon. I was interested if anyone has implemented the newer (not deprecated) IFileDialog API's?

0 Kudos
Highlighted
Valued Contributor I
22 Views

Moi aussi.

0 Kudos