home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / filedlg5 / source / filedlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-02  |  21.1 KB  |  428 lines

  1. /****************************************************************************
  2.  * FILEDLG.H                                                                *
  3.  *                                                                          *
  4.  *  This header file contains the function declarations and constant        *
  5.  *  definitions for the standard open file and save file dialog             *
  6.  *  boxes.                                                                  *
  7.  *                                                                          *
  8.  *                                                                          *
  9.  *  Modifications -                                                         *
  10.  *      09-Aug-1989 : Initial version.                                      *
  11.  *                                                                          *
  12.  *  (c)Copyright 1989 Rick Yoder                                            *
  13.  ****************************************************************************/
  14.  
  15. #pragma comment( lib,"filedlg.lib" )
  16.  
  17. /****************************************************************************
  18.  *  Constant Definitions                                                    *
  19.  ****************************************************************************/
  20.     #define FDLG_OK         0   // Function exit codes
  21.     #define FDLG_CANCEL     1
  22. /****************************************************************************/
  23.  
  24.  
  25. /****************************************************************************
  26.  *  Open File dialog box procedure                                          *
  27.  ****************************************************************************/
  28. extern USHORT CALLBACK FileOpenDlg( HWND hwndOwner,
  29.                                     PSZ pszTitle,PSZ pszIns,
  30.                                     PSZ pszShowSpec,USHORT usShowAttr,
  31.                                     void (CALLBACK *pfnHelpProc)(HWND hDlg),
  32.                                     PSZ pszFile,
  33.                                     PHFILE phf,
  34.                                     ULONG ulFileSize,
  35.                                     PUSHORT pusAction,
  36.                                     USHORT usAttribute,
  37.                                     USHORT fsOpenFlags,
  38.                                     USHORT fsOpenMode,
  39.                                     ULONG ulReserved  );
  40. /****************************************************************************\
  41. The FileOpenDlg function displays a dialog box and opens the file selected
  42. by the user. This function returns a handle that can be used to read from
  43. and write to the file, as well as to retrieve information about the file.
  44.  
  45. Parameters   Description
  46. ----------------------------------------------------------------------------
  47. hwndOwner    Identifies the owner window.
  48.  
  49. pszTitle     Points to the null-terminated string that specifies the
  50.              dialog box title. If pszTitle is NULL then the default value
  51.              "Open File" is used.
  52.  
  53. pszIns       Points to the null-terminated string that specifies the
  54.              dialog box instructions. If pszIns is NULL then the default
  55.              value "Select file or type filename" is used.
  56.  
  57. pszShowSpec  Points the the null-terminated string that specifies the
  58.              initial search specifications for the files that are to
  59.              be listed in the file list box.
  60.  
  61. usShowAttr   Specifies the attribute(s) of the files that are to be
  62.              listed in the file list box. This parameter can be a
  63.              combination of the following values
  64.  
  65.              Value          Meaning
  66.              ---------------------------------------------------------------
  67.              FILE_NORMAL    List all normal files.
  68.  
  69.              FILE_READONLY  List read-only files.
  70.  
  71.              FILE_HIDDEN    List hidden files.
  72.  
  73.              FILE_SYSTEM    List system files.
  74.  
  75.              FILE_ARCHIVED  List archived files.
  76.  
  77. pfnHelpProc  Points to the user supplied help procedure. This procedure
  78.              is called whenever the help button or the F1 key is pressed.
  79.              The HelpProc function is defined as follows:
  80.  
  81.              void CALLBACK HelpProc( HWND hDlg )
  82.              The hDlg parameter is a handle to the open file dialog box.
  83.  
  84.              If no help is available, set the pfnHelpProc parameter to
  85.              NULL. This will cause the Help button to be removed from
  86.              the dialog box.
  87.  
  88. pszFileName  Points to the location where the fully qualified filename of
  89.              the file selected by the user is to be stored. Use the
  90.              DosQSysInfo function to get the maximum path length in order
  91.              to determine how large to make the memory block pointed to
  92.              by pszFile.
  93.  
  94. phf          Points to the variable that receives the handle of the opened
  95.              file.
  96.  
  97. pusAction    Points to the variable receiving the value that specifies the
  98.              action taken by the FileOpenDlg function. If the dialog box is
  99.              cancelled then this value has no meaning. Otherwise, it is
  100.              one of the following values:
  101.  
  102.              Value           Meaning
  103.              ---------------------------------------------------------------
  104.              FILE_CREATED    File was created.
  105.  
  106.              FILE_EXISTED    File already existed.
  107.  
  108.              FILE_TRUNCATED  File existed and was truncated.
  109.  
  110. ulFileSize   Specifies the file's new size (in bytes). This parameter
  111.              applies only if the file is created or truncated. The size
  112.              specification has no effect on a file that is opened only for
  113.              reading.
  114.  
  115. usAttribute  Specifies the file attributes. This parameter can be a
  116.              combination of the following values:
  117.  
  118.              Value          Meaning
  119.              ---------------------------------------------------------------
  120.              FILE_NORMAL    File can be read from or written to.
  121.  
  122.              FILE_READONLY  File can be read from, but not written to.
  123.  
  124.              FILE_HIDDEN    File is hidden and does not appear in a
  125.                             directory listing.
  126.  
  127.              FILE_SYSTEM    File is a system file.
  128.  
  129.              FILE_ARCHIVED  File has been archived.
  130.  
  131.              File attributes apply only if the file is created.
  132.  
  133. fsOpenFlags  Specifies the action to take both when the file exists and when
  134.              it does not exist. This parameter may be one of the following
  135.              values:
  136.  
  137.              Value                        Meaning
  138.              ---------------------------------------------------------------
  139.              FILE_CREATE                  Create a new file; fail if the
  140.                                           file already exists.
  141.  
  142.              FILE_OPEN                    Open an existing file; fail if the
  143.                                           file does not exist.
  144.  
  145.              FILE_OPEN | FILE_CREATE      Open an existing file or create
  146.                                           the file if it does not exist.
  147.  
  148.              FILE_TRUNCATE                Open an existing file and change
  149.                                           to a given size.
  150.  
  151.              FILE_TRUNCATE | FILE_CREATE  Open an existing file and truncate
  152.                                           it, or create the file if it does
  153.                                           not exist.
  154.  
  155. fsOpenMode   Specifies the modes with which to open the file. It consists of
  156.              one access mode and one share mode. The other values are option
  157.              and can be given in any combination:
  158.  
  159.              Value                     Meaning
  160.              ---------------------------------------------------------------
  161.              OPEN_ACCESS_READONLY      Data may be read from the file but
  162.                                        not written to it.
  163.  
  164.              OPEN_ACCESS_READWRITE     Data may be read from or written to
  165.                                        the file.
  166.  
  167.              OPEN_ACCESS_WRITEONLY     Data may be written to the file but
  168.                                        not read from it.
  169.  
  170.              OPEN_SHARE_DENYNONE       Other processes can open the file for
  171.                                        any access: read-only, write-only, or
  172.                                        read-write.
  173.  
  174.              OPEN_SHARE_DENYREAD       Other processes can open the file for
  175.                                        write-only access but they cannot
  176.                                        open it for read-only or read-write
  177.                                        access.
  178.  
  179.              OPEN_SHARE_DENYREADWRITE  The current process has exclusive
  180.                                        access to the file. The file cannot
  181.                                        be opened by any process (including
  182.                                        the current process).
  183.  
  184.              OPEN_SHARE_DENYWRITE      Other processes can open the file for
  185.                                        read-only access but they cannot open
  186.                                        it for write-only or read-write
  187.                                        access.
  188.  
  189.              OPEN_FLAGS_FAIL_ON_ERROR  Any function that uses the file
  190.                                        handle returns immediately with an
  191.                                        error value if there is an I/O
  192.                                        error--for example, when the drive
  193.                                        door is open or a sector is missing.
  194.                                        If this value is not specified, the
  195.                                        system passes the error to the system
  196.                                        critical-error handler, which then
  197.                                        reports the error to the user with a
  198.                                        hard-error popup. The fail-on-error
  199.                                        flag is not inherited by child
  200.                                        processes.
  201.  
  202.                                        The fail-on-error flag applies to all
  203.                                        functions that use the file handle,
  204.                                        with the exception of the
  205.                                        DosDevIOCtl function.
  206.  
  207.              OPEN_FLAGS_NOINHERIT      The file handle is not available to
  208.                                        any child process started by the
  209.                                        current process. If this value is not
  210.                                        specified, any child process started
  211.                                        by the current process may use the
  212.                                        file handle.
  213.  
  214.              OPEN_FLAGS_WRITE_THROUGH  This flag applies to functions, such
  215.                                        as DosWrite, that write data to the
  216.                                        file. If this value is specified, the
  217.                                        system writes data to the device
  218.                                        before the given function returns.
  219.                                        Otherwise, the system may store the
  220.                                        data in an internal file buffer and
  221.                                        write the data to the device only
  222.                                        when the buffer is full or the file
  223.                                        is closed.
  224.  
  225. ulReserved   Specifies a reserved value; must be zero.
  226.  
  227. Return Value
  228.  
  229. The return value may be one of the following:
  230.  
  231.     FDLG_OK
  232.     FDLG_CANCEL
  233. \****************************************************************************/
  234.  
  235.  
  236. /****************************************************************************
  237.  *  Save File dialog box procedure                                          *
  238.  ****************************************************************************/
  239. extern USHORT CALLBACK FileSaveDlg( HWND hwndOwner,
  240.                                     PSZ pszTitle,PSZ pszIns,
  241.                                     void (CALLBACK *pfnHelpProc)(HWND hDlg),
  242.                                     PSZ pszDefault,
  243.                                     PSZ pszFile,
  244.                                     PHFILE phf,
  245.                                     ULONG ulFileSize,
  246.                                     PUSHORT pusAction,
  247.                                     USHORT usAttribute,
  248.                                     USHORT fsOpenFlags,
  249.                                     USHORT fsOpenMode,
  250.                                     ULONG ulReserved  );
  251. /****************************************************************************\
  252. The FileSaveDlg function displays a dialog box and opens the file selected
  253. by the user. This function returns a handle that can be used to read from
  254. and write to the file, as well as to retrieve information about the file.
  255.  
  256. Parameters   Description
  257. ----------------------------------------------------------------------------
  258. hwndOwner    Identifies the owner window.
  259.  
  260. pszTitle     Points to the null-terminated string that specifies the
  261.              dialog box title. If pszTitle is NULL then the default value
  262.              "Save File" is used.
  263.  
  264. pszIns       Points to the null-terminated string that specifies the
  265.              dialog box instructions. If pszIns is NULL then the default
  266.              value "Type filename" is used.
  267.  
  268. pfnHelpProc  Points to the user supplied help procedure. This procedure
  269.              is called whenever the help button or the F1 key is pressed.
  270.              The HelpProc function is defined as follows:
  271.  
  272.              void CALLBACK HelpProc( HWND hDlg )
  273.              The hDlg parameter is a handle to the open file dialog box.
  274.  
  275.              If no help is available, set the pfnHelpProc parameter to
  276.              NULL. This will cause the Help button to be removed from
  277.              the dialog box.
  278.  
  279. pszDefault   Points to the null-terminated string that specifies the
  280.              default save file name.
  281.  
  282. pszFileName  Points to the location where the fully qualified filename of
  283.              the file selected by the user is to be stored. Use the
  284.              DosQSysInfo function to get the maximum path length in order
  285.              to determine how large to make the memory block pointed to
  286.              by pszFile.
  287.  
  288. phf          Points to the variable that receives the handle of the opened
  289.              file.
  290.  
  291. pusAction    Points to the variable receiving the value that specifies the
  292.              action taken by the FileSaveDlg function. If the dialog box is
  293.              cancelled then this value has no meaning. Otherwise, it is
  294.              one of the following values:
  295.  
  296.              Value           Meaning
  297.              ---------------------------------------------------------------
  298.              FILE_CREATED    File was created.
  299.  
  300.              FILE_EXISTED    File already existed.
  301.  
  302.              FILE_TRUNCATED  File existed and was truncated.
  303.  
  304. ulFileSize   Specifies the file's new size (in bytes). This parameter
  305.              applies only if the file is created or truncated. The size
  306.              specification has no effect on a file that is opened only for
  307.              reading.
  308.  
  309. usAttribute  Specifies the file attributes. This parameter can be a
  310.              combination of the following values:
  311.  
  312.              Value          Meaning
  313.              ---------------------------------------------------------------
  314.              FILE_NORMAL    File can be read from or written to.
  315.  
  316.              FILE_READONLY  File can be read from, but not written to.
  317.  
  318.              FILE_HIDDEN    File is hidden and does not appear in a
  319.                             directory listing.
  320.  
  321.              FILE_SYSTEM    File is a system file.
  322.  
  323.              FILE_ARCHIVED  File has been archived.
  324.  
  325.              File attributes apply only if the file is created.
  326.  
  327. fsOpenFlags  Specifies the action to take both when the file exists and when
  328.              it does not exist. This parameter may be one of the following
  329.              values:
  330.  
  331.              Value                        Meaning
  332.              ---------------------------------------------------------------
  333.              FILE_CREATE                  Create a new file; fail if the
  334.                                           file already exists.
  335.  
  336.              FILE_OPEN                    Open an existing file; fail if the
  337.                                           file does not exist.
  338.  
  339.              FILE_OPEN | FILE_CREATE      Open an existing file or create
  340.                                           the file if it does not exist.
  341.  
  342.              FILE_TRUNCATE                Open an existing file and change
  343.                                           to a given size.
  344.  
  345.              FILE_TRUNCATE | FILE_CREATE  Open an existing file and truncate
  346.                                           it, or create the file if it does
  347.                                           not exist.
  348.  
  349. fsOpenMode   Specifies the modes with which to open the file. It consists of
  350.              one access mode and one share mode. The other values are option
  351.              and can be given in any combination:
  352.  
  353.              Value                     Meaning
  354.              ---------------------------------------------------------------
  355.              OPEN_ACCESS_READONLY      Data may be read from the file but
  356.                                        not written to it.
  357.  
  358.              OPEN_ACCESS_READWRITE     Data may be read from or written to
  359.                                        the file.
  360.  
  361.              OPEN_ACCESS_WRITEONLY     Data may be written to the file but
  362.                                        not read from it.
  363.  
  364.              OPEN_SHARE_DENYNONE       Other processes can open the file for
  365.                                        any access: read-only, write-only, or
  366.                                        read-write.
  367.  
  368.              OPEN_SHARE_DENYREAD       Other processes can open the file for
  369.                                        write-only access but they cannot
  370.                                        open it for read-only or read-write
  371.                                        access.
  372.  
  373.              OPEN_SHARE_DENYREADWRITE  The current process has exclusive
  374.                                        access to the file. The file cannot
  375.                                        be opened by any process (including
  376.                                        the current process).
  377.  
  378.              OPEN_SHARE_DENYWRITE      Other processes can open the file for
  379.                                        read-only access but they cannot open
  380.                                        it for write-only or read-write
  381.                                        access.
  382.  
  383.              OPEN_FLAGS_FAIL_ON_ERROR  Any function that uses the file
  384.                                        handle returns immediately with an
  385.                                        error value if there is an I/O
  386.                                        error--for example, when the drive
  387.                                        door is open or a sector is missing.
  388.                                        If this value is not specified, the
  389.                                        system passes the error to the system
  390.                                        critical-error handler, which then
  391.                                        reports the error to the user with a
  392.                                        hard-error popup. The fail-on-error
  393.                                        flag is not inherited by child
  394.                                        processes.
  395.  
  396.                                        The fail-on-error flag applies to all
  397.                                        functions that use the file handle,
  398.                                        with the exception of the
  399.                                        DosDevIOCtl function.
  400.  
  401.              OPEN_FLAGS_NOINHERIT      The file handle is not available to
  402.                                        any child process started by the
  403.                                        current process. If this value is not
  404.                                        specified, any child process started
  405.                                        by the current process may use the
  406.                                        file handle.
  407.  
  408.              OPEN_FLAGS_WRITE_THROUGH  This flag applies to functions, such
  409.                                        as DosWrite, that write data to the
  410.                                        file. If this value is specified, the
  411.                                        system writes data to the device
  412.                                        before the given function returns.
  413.                                        Otherwise, the system may store the
  414.                                        data in an internal file buffer and
  415.                                        write the data to the device only
  416.                                        when the buffer is full or the file
  417.                                        is closed.
  418.  
  419. ulReserved   Specifies a reserved value; must be zero.
  420.  
  421. Return Value
  422.  
  423. The return value may be one of the following:
  424.  
  425.     FDLG_OK
  426.     FDLG_CANCEL
  427. \****************************************************************************/
  428.