- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to use the ShBrowseForFolder command with the XFTFile Module (XLITE) form Jugoslav Dujic.
But I didn't manage it.
My question is now, what do I have to include in the code so that this command works? I tryed to orientate me on the GetOpenFileName, but this didn't work.
Her are some pices of the code, perhaps somebody recognizes the my error and can help me.
Code:
integer*4 function SettingsDlgProc( hDlg, message, wParam, lParam )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_SettingsDlgProc@16' :: SettingsDlgProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'SettingsDlgProc' :: SettingsDlgProc
!DEC$ ENDIF
use kernel32
use user32
use gdi32
use dfport
use xftfile
use xstrings
use lifetime05Globals
implicit none
integer hDlg ! window handle of the dialog box
integer message ! type of message
integer wParam ! message-specific information
integer lParam
include 'resource.fd'
interface
integer(4) function InitializeOpen
end function
end interface
INTERFACE
INTEGER FUNCTION SHBrowseForFolder(BI)
!DEC$ATTRIBUTES STDCALL, ALIAS: '_SHBrowseForFolderA@4':: SHBrowseForFolder
INTEGER BI
END FUNCTION SHBrowseForFolder
END INTERFACE
INTERFACE
INTEGER FUNCTION SHGetSpecialFolderLocation(hwndOwner, nFolder, ppidl)
!DEC$ATTRIBUTES STDCALL, ALIAS: '_SHGetSpecialFolderLocation@12':: SHGetSpecialFolderLocation
!DEC$ATTRIBUTES REFERENCE:: ppidl
INTEGER hwndOwner
INTEGER nFolder
INTEGER ppidl
END FUNCTION
END INTERFACE
[...]
hHelicoptertype = GetDlgItem(hDlg,IDC_HELICOPTERTYPE)
hLifeSingle = GetDlgItem(hDlg,IDC_LIFESINGLE)
hBatchYes = GetDlgItem(hDlg,IDC_BATCHYES)
iret = initializeopen()
buf = 256
select case (message)
case (WM_INITDIALOG)
[...]
case (WM_COMMAND)
[...]
if (LoWord(wParam) .EQ. IDCANCEL) then
iret = EndDialog(hDlg, TRUE)
SettingsDlgProc = 1
return
end if
if (LoWord(wParam) .EQ. IDC_BROWSE1) then
Ofn%Flags = NULL
bret = GETOPENFILENAME(Ofn)
if (bret == 0) then
goto 101
end if
iret = SetDlgItemText(hDlg, IDC_EDIT1, szfilename// ' 'C)
SettingsDlgProc = 1
return
end if
if (LoWord(wParam) .EQ. IDC_BROWSE2) then
Ofn%Flags = NULL
bret = shbrowseforfolder(BI)
!bret = GETOPENFILENAME(Ofn)
if (bret == 0) then
goto 101
end if
iret = SetDlgItemText(hDlg, IDC_EDIT2, szfilename// ' 'C)
SettingsDlgProc = 1
return
end if
[...]
101 end select
SettingsDlgProc = 0 ! Didn't process the message
return
end When compiling this code I always get the following error message:
Error: This name does not have a type, and must have an explicit type. [BI]
Thanks
Alex
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BI is a TYPE(T_BROWSEINFO), not an integer.
I don't know anything about the XFT code, but the attached example shows how to use BrowseForFolder.
Regards,
Paul Curtis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alex,
The idea of XFT is that you don't have to cope with very details of Windows API functions -- just include XFT***.f90 into your project, call appropriate X*** function and get the results. Thus, you should simply add XFTFile.f90 into the project (defining XLITE somewhere), and call XBrowse. (But I won't swear it will work for all CVF versions, especially 6.0-6.1)
Alternatively, you can reuse (copy & paste) the code from subroutine XBrowse, but you have to pay attentiontodefinitions of SH*** functions. Namely, older CVF versions did not have defined INTERFACEs to SHBrowseForFolder, T_BROWSWINFO, BI_* constants etc. Thus, ifyou haveCVF older than 6.6you have toinclude appropriatedeclarations from your code, butyou should follow the code structure from XBrowse (fill in the T_BROWSEINFO before calling SHBrowseForFolder, call CoTaskMemFree at the end).
Regards
Jugoslav
P.S. I'm using this opportunity to say hello to all and tell you that I'm generally fine, but quite bored. I'll be back in full power in late August. Until then, take care ;-).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot to both of you.
Thefirst exampledidn't work on my System(I'm using CVF 6.5), I don't know why. I alwalys had more the 30 errors.
It works now with XLITE.
But I had to includeadditionally the XFT.f90 file. Without the last one, I always got 3 linker errors (LNK2001).
Alex
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page