I/we are wanting to use the Windows API GetOpenFilename/GetSaveFileName functions. I have been trying to construct a GROUP (or CLASS) based on the OPENFILENAME struct but can’t seem to get it right.
My call to GetOpenFileName(OPENFILENAME) seems to work OK in that I don’t get a GPF, but it doesn’t open a window (returns 0) and the Windows extended error is 1 (CDERR_STRUCTSIZE), the lStructSize member … is invalid.
FileDialog is fine if you want to Open a file. A user selects a name etc and the full filename is returned, drive:\path\filename.ext
On the other hand, if you want to save a file and the user changes the name, regardless of the file extension selected for the filter/droplist, if the user does not include an extension, it is not added to the filename.
The link included in my OP outlines the issue. Mark Goldberg encountered the same and developed a function to call the Windows API GetSaveFileName which contains considerably more information about the whole file save process (including the selected extension).
I am having a little trouble getting my head around replicating the struct (including pointers) etc in Clarion. Most other API or external DLL calls I have no trouble with.
< edit > Mathew, just noticed you said FILEDIALOGA. As below, still using C5, no FILEIDALOGA < /edit >
A new attribute was added a number of years ago to the Clarion FileDialog ( I believe in one of the C6 updates).
File:AddExtension. This adds the extension to the file name in the save dialog if none was included.
Take a look and see if that helps.
Hi Mark and Leonid (and others),
While looking for something else marginally related, I came across this site: http://www.authord.com/products/Clarion/ , and part of the way down is a WinAPI toolkit. Lo and behold, there was an example of GetOpen/SaveFileName, albeit as a template and for an older version, but it pointed out a couple of things I was doing wrong (eg getting the SIZE of the wrong object).
Many thanks to that developer, but I am now well on my way to resolving my issue.
Thanks everyone for your help.
Mark, I would be curious to see your code if available.