Bring up the file dialog box.
This function displays the standard Windows file dialog box so that the user can save, open, or find a file, as appropriate. However, this function includes arguments that allow you to somewhat customize the dialog box's wording.
The argument title represents the label of the dialog box. This is the text that appears across the top, such as "Open Drawing."
The path argument represents the default pathname and filename, if applicable. This is where the dialog box first looks for the file. This can be NULL. If so, the default is the current working directory.
The fileext argument is the default file extension. This can be overridden by the user only if bit 2 ( = 4) is set in options.
The argument options represents the sum of the appropriate bits for each of the following options:
Option | Meaning |
---|---|
1 | Warns when the user types an existing filename; use this option to create a new file, not open an existing one. |
2 | Grays out the "Type it" button. |
4 | Allows the user to type a filename other than that specified by fileext. |
8 | Only the filename is stored in the result buffer, filename. When not set, the entire pathname is stored in filename. When option 1 is set (for creating a new file), this has no effect. |
16 | Path is assumed to be a pathname only. This is also true when path ends with a slash. |
The argument filename is a result buffer containing either a string with the path and file name for the selected file or, if the user selected the Type It button, a short with a resval of 1.
This function returns RTNORM or RTERROR.
NOTE While normally you would release the resbuf using sds_relrb, you do not want to when using this function because it will cause your program to crash.
Example
struct sds_resbuf filename;
sds_getfiled("sds_getfiled Test Dialog",NULL,"DWG",4,&filename);
if (filename.restype==RTSTR)
sds_printf("\nThe name of the file is %s. ",filename.resval.rstring);
else if (filename.restype==RTINT)
sds_printf("\nThe user selected the \"Type it\" button. ");
else
sds_printf("\nAn error occurred.");
Tell me about...
Programming Overview of SDS™ (Solutions Development System™)