home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PMTKT.ZIP / PMTKT.H next >
C/C++ Source or Header  |  1989-07-27  |  15KB  |  295 lines

  1. /****************************************************************************
  2.  * PMTKT.H                                                                  *
  3.  *                                                                          *
  4.  *  This header file contains the declarations of some of the undocumented  *
  5.  *  toolkit functions located in the PMTKT.DLL dynamic link library.        *
  6.  ****************************************************************************/
  7.  
  8.     #pragma comment( lib,"pmtkt.lib" )
  9.  
  10. /****************************************************************************
  11.  *  Misc constants                                                          *
  12.  ****************************************************************************/
  13.     #define MAX_FNAME_LEN     80 /* maximum file name length */
  14.     #define MAXMESSAGELENGTH 128 /* maximum size of a msg */
  15. /****************************************************************************/
  16.  
  17.  
  18. /****************************************************************************
  19.  *  String IDs                                                              *
  20.  ****************************************************************************/
  21.     #define IDS_MERGE1      0      /* merge string (%%) */
  22.     #define IDS_IFN         1      /* %% is not a valid filename. */
  23.     #define IDS_FNF         2      /* %% not found - Create new file? */
  24.     #define IDS_REF         3      /* Replace existing %%? */
  25.     #define IDS_SCC         4      /* %% has changed. Save current changes? */
  26.     #define IDS_EOF         5      /* Error opening %% */
  27.     #define IDS_ECF         6      /* Error creating %% */
  28. /****************************************************************************/
  29.  
  30.  
  31. /****************************************************************************
  32.  * Return values from WtiDlgFile                                            *
  33.  ****************************************************************************/
  34.     #define TDF_ERRMEM   0
  35.     #define TDF_INVALID  1
  36.     #define TDF_NOOPEN   2
  37.     #define TDF_NEWOPEN  3
  38.     #define TDF_OLDOPEN  4
  39.     #define TDF_NOSAVE   5
  40.     #define TDF_NEWSAVE  6
  41.     #define TDF_OLDSAVE  7
  42. /****************************************************************************/
  43.  
  44.  
  45. /****************************************************************************
  46.  * Flags for WtiOpenFile                                                    *
  47.  ****************************************************************************/
  48.     #define OF_REOPEN    0x8000
  49.     #define OF_EXIST     0x4000
  50.     #define OF_CREATE    0x1000
  51.     #define OF_PARSE     0x0100
  52.     #define OF_READ      0x0080
  53.     #define OF_WRITE     0x0040
  54.     #define OF_READWRITE 0x0020
  55. /****************************************************************************/
  56.  
  57.  
  58. /****************************************************************************
  59.  *  Definition of DLF data type used to pass data to WtiDlgFile             *
  60.  ****************************************************************************/
  61.     typedef struct _DLF {
  62.         USHORT   rgbAction;             /* action usType:  eg. DLG_OPEN   */
  63.         USHORT   rgbFlags;              /* open file flAttributes         */
  64.         PHFILE   phFile;                /* file handle                    */
  65.         PSZ      pszExt;                /* default file extension "\\.ext"*/
  66.         PSZ      pszAppName;            /* application name               */
  67.         PSZ      pszTitle;              /* panel title or NULL            */
  68.         PSZ      pszInstructions;       /* panel instructions or NULL     */
  69.         CHAR szFileName[MAX_FNAME_LEN]; /* relative file name             */
  70.         CHAR szOpenFile[MAX_FNAME_LEN]; /* full path name of current file */
  71.         CHAR szLastWild[MAX_FNAME_LEN]; /* last relative wild card name   */
  72.         CHAR szLastFile[MAX_FNAME_LEN]; /* last relative file name    */
  73.         } DLF;
  74.     typedef DLF FAR *PDLF;
  75.  
  76. /* Action value for WtiDlgFile, the values may be ORed, except DLG_OPENDLG */
  77. /* and DLG_SAVEDLG. */
  78.     #define DLG_OPENDLG 0x00        /* Use the Open dialog box. */
  79.     #define DLG_SAVEDLG 0x01        /* Use the Save (As) dialog box */
  80.     #define DLG_NOOPEN  0x02        /* Don't open the file we selected */
  81.     #define DLG_HELP    0x04        /* The dialog box supports Help */
  82.  
  83. /* flAttributes used to filter entries provided in directory and file */
  84. /* list boxes.                                                        */
  85.     #define ATTRDIRLIST  0x4010 /* list avail. drives & dirs in dir list box */
  86.     #define ATTRDRIVE    0x4000 /* list avail. drives in dir list box        */
  87.     #define ATTRDIR      0x0010 /* list avail. dirs in dir list box          */
  88.     #define ATTRNORMAL   0x0000 /* list normal files in file list box        */
  89.     #define ATTRREADONLY 0x0001 /* list read-only files in file list box     */
  90.     #define ATTRHIDDEN   0x0002 /* list hidden files in file list box        */
  91.     #define ATTRSYSTEM   0x0004 /* list system files in file list box        */
  92.     #define ATTRARCHIVED 0x0020 /* list archived files in file list box      */
  93. /****************************************************************************/
  94.  
  95.  
  96. /****************************************************************************/
  97.  extern USHORT APIENTRY WtiAlertBox( HWND hwnd, USHORT idMes,
  98.                                      PSZ  pszText1, PSZ pszText2,
  99.                                      USHORT idHelp, USHORT flStyle );
  100.     /* Purpose          This function merges sz[idMes] and szText1 and
  101.      *                  displays a message box using wStyle.
  102.      *
  103.      * Parameters       hwnd contains the handle of the owner window.
  104.      *
  105.      *                  idMes contains contains one of the following
  106.      *                  string IDs:
  107.      *
  108.      *                  IDS_MERGE1 ... merge string (%%)
  109.      *                  IDS_IFN    ... %% is not a valid filename.
  110.      *                  IDS_FNF    ... % not found - Create new file?
  111.      *                  IDS_REF    ... Replace existing %%?
  112.      *                  IDS_SCC    ... %% has changed. Save current changes?
  113.      *                  IDS_EOF    ... Error opening %%
  114.      *                  IDS_ECF    ... Error creating %%
  115.      *
  116.      *                  pszText1 is a pointer to the null terminated string
  117.      *                  that is to replace the %% characters in the message
  118.      *                  identified by the idMes parameter.
  119.      *
  120.      *                  pszText2 is a pointer to the null terminated string
  121.      *                  that contains the message box caption.
  122.      *
  123.      *                  idHelp contains the message box id. This id is passed
  124.      *                  to the HK_HELP hook if a WM_HELP message is received
  125.      *                  by the message box window. Set this value to 0 if
  126.      *                  you don't want the message box to have a help button.
  127.      *
  128.      *                  flStyle contains the flags used to specify the type
  129.      *                  of message box to be created. See the documentation
  130.      *                  for the WinMessageBox function for a description
  131.      *                  of the message box style flags.
  132.      *
  133.      * Return Value     The return value indicates the user's response to
  134.      *                  the message box. See the documentation for the
  135.      *                  WinMessageBox function for a list of return codes.
  136.      */
  137.  
  138.  extern BOOL APIENTRY WtiMergeStrings( PSZ pszSrc,PSZ pszMerge,PSZ pszDst );
  139.     /* Purpose          This function scans szSrc for "%%". If found, it
  140.      *                  then inserts the string szMerge at that point. The
  141.      *                  rest of szSrc is then appended.
  142.      *
  143.      * Parameters       pszSrc is a pointer to the source string.
  144.      *
  145.      *                  pszMerge is a pointer to the string that is to
  146.      *                  replace "%%" in the source string.
  147.      *
  148.      *                  pszDst is a pointer to the location where the
  149.      *                  merged string is to be stored. Note that pszDst
  150.      *                  must point to a memory buffer that is at least
  151.      *                  MAXMESSAGELENGTH bytes long.
  152.      *
  153.      * Return Value     The function returns a value of TRUE if it does
  154.      *                  a merge, false otherwise.
  155.      */
  156.  
  157.  extern USHORT APIENTRY WtiDlgFile( HWND hwnd,PDLF pdlf );
  158.     /* Purpose          This function invokes either an Open or Save
  159.      *                  dialog box.
  160.      *
  161.      * Parameters       hwnd contains the handle of the owner window.
  162.      *
  163.      *                  pdlf is a pointer to a structure of type DLF
  164.      *                  that is used to pass initialization data to
  165.      *                  the dialog box.
  166.      *
  167.      * Return Value     The function returns one of the following
  168.      *                  exit codes:
  169.      *
  170.      *                      TDF_INVALID - Library error (internal error),
  171.      *                      TDF_ERRMEM  - Out of memory error
  172.      *                      TDF_NOOPEN  - User hits cancel
  173.      *
  174.      *                  specific to DLG_OPENDLG:
  175.      *                      TDF_NEWOPEN - Created new file
  176.      *                      TDF_OLDOPEN - Opened existing file
  177.      *                      In both of the above cases, the file is opened
  178.      *                      in read-only mode.
  179.      *
  180.      *                  specific to DLG_SAVEDLG:
  181.      *                      TDF_NEWSAVE - user wants to save to a new file
  182.      *                      TDF_OLDSAVE - user wants to save over existing file
  183.      *                      In the above cases, the file is opened in
  184.      *                      write-only mode.
  185.      *
  186.      *                  specific to DLG_NOOPEN:
  187.      *                      TDF_NEWSAVE - user wants to save to a new file
  188.      *                      TDF_OLDSAVE - user wants to save over existing file
  189.      *                      In the above cases, the file is not opened.
  190.      */
  191.  
  192.  extern VOID APIENTRY WtiLFillStruct( PVOID pSrc,USHORT cb,BYTE fillByte );
  193.     /* Purpose          This function fills the specified structure with
  194.      *                  the byte value passed in the fillByte parameter.
  195.      *
  196.      * Parameters       pSrc is a pointer to the structure to be filled.
  197.      *
  198.      *                  cb is the size of the structure in bytes.
  199.      *
  200.      *                  fillByte contains the fill value.
  201.      */
  202.  
  203.  extern VOID APIENTRY WtiLCopyStruct( PVOID pSrc,PVOID pDst,USHORT cb );
  204.     /* Purpose          This function copies the contents of the
  205.      *                  source structure into the destination structure.
  206.      *
  207.      * Parameters       pSrc is a pointer to the source structure.
  208.      *
  209.      *                  pDst is a pointer to the destination structure.
  210.      *
  211.      *                  cb is the structure size in bytes.
  212.      */
  213.  
  214.  extern int APIENTRY WtiLStrLen( PSZ pszStr );
  215.     /* Purpose          This function operates the same as strlen
  216.      *                  except with long ptrs.
  217.      */
  218.  
  219.  extern VOID APIENTRY WtiLStrCat( PSZ pszDst,PSZ pszSrc );
  220.     /* Purpose          This function operates the same as strcat
  221.      *                  except with long ptrs.
  222.      */
  223.  
  224.  extern int APIENTRY WtiLStrCmp( PSZ pszStr1,PSZ pszStr2 );
  225.     /* Purpose          This function operates the same as strcmp
  226.      *                  except with long ptrs.
  227.      */
  228.  
  229.  extern VOID APIENTRY WtiLStrCpy( PSZ pszDst,PSZ pszSrc );
  230.     /* Purpose          This function operates the same as strcpy
  231.      *                  except with long ptrs.
  232.      */
  233.  
  234.  extern VOID APIENTRY WtiAddExt( PSZ pszDst,PSZ pszExt );
  235.     /* Purpose          This function adds the extension to a
  236.      *                  file name if it is missing.
  237.      *
  238.      * Parameters       pszDst points to the input file name.
  239.      *
  240.      *                  pszExt points to the extension to be added.
  241.      */
  242.  
  243.  extern PSZ APIENTRY WtiFileInPath( PSZ pszPath );
  244.     /* Purpose          This function returns a pointer to the
  245.      *                  filename part of the given path string.
  246.      */
  247.  
  248.  extern BOOL APIENTRY WtiOpenFile( PSZ pszFile,PHFILE phFile,
  249.                                    PSZ pszOpenFile,USHORT wMode );
  250.     /* Purpose          This function parses the input filename into
  251.      *                  a fully expanded file name. Then, depending on
  252.      *                  the setting of the wMode parameter, the function
  253.      *                  will attempt to open the file.
  254.      *
  255.      * Parameters       pszFile is a pointer to a string containing
  256.      *                  the name of the file to be opened.
  257.      *
  258.      *                  phFile is a pointer to the location where the
  259.      *                  file handle for the newly opened file is to
  260.      *                  be stored.
  261.      *
  262.      *                  pszOpenFile is a pointer to the memory location
  263.      *                  where the fully expanded file name is to be
  264.      *                  stored.
  265.      *
  266.      *                  wMode is one of the following constants:
  267.      *
  268.      *                      OF_READ:      open file for reading only
  269.      *                      OF_WRITE:     open file for writing only
  270.      *                      OF_READWRITE: open file for reading and writing
  271.      *                      OF_CREATE:    create the file if it does not exist
  272.      *                      OF_REOPEN:    open file using info in reopen buffer
  273.      *                      OF_EXIST:     test file existence
  274.      *                      OF_PARSE:     parse file name, with no other action
  275.      *
  276.      * Return Value     The function returns TRUE if the operation is
  277.      *                  successful, FALSE otherwise.
  278.      */
  279.  
  280.  extern ULONG APIENTRY WtiGetTextExtent( HPS hps, PCH pchStr, USHORT cch );
  281.     /* Purpose          This function calculates the dimensions of the
  282.      *                  rectangle that would be occupied by the input
  283.      *                  text string.
  284.      *
  285.      * Parameters       hps is a handle to a presentation space.
  286.      *
  287.      *                  pchStr is a pointer to the input text string.
  288.      *
  289.      *                  cch contains the length of the input string.
  290.      *
  291.      * Return Value     This function returns the x extent in the
  292.      *                  low order word and the y extent in the
  293.      *                  high order word.
  294.      */
  295.