home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pcmagazi / 1992 / 13 / commdlg.h < prev    next >
C/C++ Source or Header  |  1991-12-04  |  10KB  |  291 lines

  1. /*---------------------------------------------------------------------------
  2.  *  commdlg.h -- Common dialog definitions.  Windows.h must be included first.
  3.  *---------------------------------------------------------------------------
  4.  */
  5.  
  6. #ifndef RC_INVOKED
  7. #pragma pack(1)      /* Assume byte packing throughout */
  8. #endif
  9.  
  10. typedef struct tagOFN
  11.     {
  12.     DWORD   lStructSize;
  13.     HWND    hwndOwner;
  14.     HANDLE  hInstance;
  15.     LPSTR   lpstrFilter;
  16.     LPSTR   lpstrCustomFilter;
  17.     DWORD   nMaxCustFilter;
  18.     DWORD   nFilterIndex;
  19.     LPSTR   lpstrFile;
  20.     DWORD   nMaxFile;
  21.     LPSTR   lpstrFileTitle;
  22.     DWORD   nMaxFileTitle;
  23.     LPSTR   lpstrInitialDir;
  24.     LPSTR   lpstrTitle;
  25.     DWORD   Flags;
  26.     WORD    nFileOffset;
  27.     WORD    nFileExtension;
  28.     LPSTR   lpstrDefExt;
  29.     DWORD   lCustData;
  30.     WORD (FAR PASCAL *lpfnHook)(HWND, unsigned, WORD, LONG);
  31.     LPSTR   lpTemplateName;
  32.     }   OPENFILENAME;
  33. typedef OPENFILENAME  FAR * LPOPENFILENAME;
  34.  
  35. BOOL  FAR PASCAL     GetOpenFileName(LPOPENFILENAME);
  36. BOOL  FAR PASCAL     GetSaveFileName(LPOPENFILENAME);
  37. short FAR PASCAL     GetFileTitle(LPSTR, LPSTR, WORD);
  38.  
  39. #define OFN_READONLY                 0x00000001
  40. #define OFN_OVERWRITEPROMPT          0x00000002
  41. #define OFN_HIDEREADONLY             0x00000004
  42. #define OFN_NOCHANGEDIR              0x00000008
  43. #define OFN_SHOWHELP                 0x00000010
  44. #define OFN_ENABLEHOOK               0x00000020
  45. #define OFN_ENABLETEMPLATE           0x00000040
  46. #define OFN_ENABLETEMPLATEHANDLE     0x00000080
  47. #define OFN_NOVALIDATE               0x00000100
  48. #define OFN_ALLOWMULTISELECT         0x00000200
  49. #define OFN_EXTENSIONDIFFERENT       0x00000400
  50. #define OFN_PATHMUSTEXIST            0x00000800
  51. #define OFN_FILEMUSTEXIST            0x00001000
  52. #define OFN_CREATEPROMPT             0x00002000
  53. #define OFN_SHAREAWARE               0x00004000
  54. #define OFN_NOREADONLYRETURN         0x00008000
  55. #define OFN_NOTESTFILECREATE         0x00010000
  56.  
  57. /* Return values for the registered message sent to the hook function
  58.  * when a sharing violation occurs.  OFN_SHAREFALLTHROUGH allows the
  59.  * filename to be accepted, OFN_SHARENOWARN rejects the name but puts
  60.  * up no warning (returned when the app has already put up a warning
  61.  * message), and OFN_SHAREWARN puts up the default warning message
  62.  * for sharing violations.
  63.  *
  64.  * Note:  Undefined return values map to OFN_SHAREWARN, but are
  65.  *        reserved for future use.
  66.  */
  67.  
  68. #define OFN_SHAREFALLTHROUGH     2
  69. #define OFN_SHARENOWARN          1
  70. #define OFN_SHAREWARN            0
  71.  
  72. /* Avoids sharing violations.  Defined 21 Jan 1991   clarkc */
  73. #define SHARE_EXIST                  (OF_EXIST | OF_SHARE_DENY_NONE)
  74.  
  75. typedef struct
  76.   {
  77.     DWORD   lStructSize;
  78.     HWND    hwndOwner;
  79.     HWND    hInstance;
  80.     DWORD   rgbResult;
  81.     LPDWORD lpCustColors;
  82.     DWORD   Flags;
  83.     DWORD   lCustData;
  84.     WORD (FAR PASCAL *lpfnHook)(HWND, unsigned, WORD, LONG);
  85.     LPSTR   lpTemplateName;
  86.   } CHOOSECOLOR;
  87. typedef CHOOSECOLOR FAR *LPCHOOSECOLOR;
  88.  
  89. BOOL  FAR PASCAL ChooseColor(LPCHOOSECOLOR);
  90.  
  91. #define CC_RGBINIT               0x00000001
  92. #define CC_FULLOPEN              0x00000002
  93. #define CC_PREVENTFULLOPEN       0x00000004
  94. #define CC_SHOWHELP              0x00000008
  95. #define CC_ENABLEHOOK            0x00000010
  96. #define CC_ENABLETEMPLATE        0x00000020
  97. #define CC_ENABLETEMPLATEHANDLE  0x00000040
  98.  
  99. typedef struct
  100.   {
  101.     DWORD     lStructSize;         /* size of this struct 0x20 */
  102.     HWND     hwndOwner;         /* handle to owner's window */
  103.     HANDLE     hInstance;         /* instance handle of.EXE that
  104.                       * contains cust. dlg. template
  105.                       */
  106.     DWORD     Flags;          /* one or more of the FR_?? */
  107.     LPSTR     lpstrFindWhat;      /* ptr. to search string    */
  108.     LPSTR     lpstrReplaceWith;     /* ptr. to replace string   */
  109.     WORD      wFindWhatLen;        /* size of find buffer      */
  110.     WORD      wReplaceWithLen;     /* size of replace buffer   */
  111.     DWORD     lCustData;         /* data passed to hook fn.  */
  112.     WORD (FAR PASCAL *lpfnHook)(HWND, unsigned, WORD, LONG);
  113.                      /* ptr. to hook fn. or NULL */
  114.     LPSTR    lpTemplateName;     /* custom template name     */
  115.   } FINDREPLACE;
  116.  
  117. typedef FINDREPLACE FAR *LPFINDREPLACE;
  118.  
  119. #define FR_DOWN             0x00000001
  120. #define FR_WHOLEWORD            0x00000002
  121. #define FR_MATCHCASE            0x00000004
  122. #define FR_FINDNEXT            0x00000008
  123. #define FR_REPLACE            0x00000010
  124. #define FR_REPLACEALL            0x00000020
  125. #define FR_DIALOGTERM            0x00000040
  126. #define FR_SHOWHELP            0x00000080
  127. #define FR_ENABLEHOOK            0x00000100
  128. #define FR_ENABLETEMPLATE        0x00000200
  129. #define FR_NOUPDOWN            0x00000400
  130. #define FR_NOMATCHCASE            0x00000800
  131. #define FR_NOWHOLEWORD            0x00001000
  132. #define FR_ENABLETEMPLATEHANDLE     0x00002000
  133. #define FR_HIDEUPDOWN            0x00004000
  134. #define FR_HIDEMATCHCASE        0x00008000
  135. #define FR_HIDEWHOLEWORD        0x00010000
  136.  
  137. HWND  FAR PASCAL    FindText(LPFINDREPLACE);
  138. HWND  FAR PASCAL    ReplaceText(LPFINDREPLACE);
  139.  
  140. typedef struct
  141.   {
  142.     DWORD        lStructSize;    /* */
  143.     HWND        hwndOwner;        /* caller's window handle   */
  144.     HDC         hDC;        /* printer DC/IC or NULL    */
  145.     LPLOGFONT        lpLogFont;        /* ptr. to a LOGFONT struct */
  146.     int            iPointSize;        /* 10 * size in points of selected font */
  147.     DWORD        Flags;        /* enum. type flags        */
  148.     DWORD        rgbColors;        /* returned text color        */
  149.     DWORD        lCustData;        /* data passed to hook fn.  */
  150.     WORD (FAR PASCAL *lpfnHook)(HWND, unsigned, WORD, LONG);
  151.                     /* ptr. to hook function    */
  152.     LPSTR        lpTemplateName;    /* custom template name     */
  153.     HANDLE        hInstance;        /* instance handle of.EXE that
  154.                      * contains cust. dlg. template
  155.                      */
  156.     LPSTR        lpszStyle;        /* return the style field here 
  157.                      * must be LF_FACESIZE or bigger */
  158.     WORD        nFontType;        /* same value reported to the EnumFonts
  159.                      * call back with the extra FONTTYPE_ 
  160.                      * bits added */
  161.     int            nSizeMin;        /* minimum pt size allowed & */
  162.     int            nSizeMax;        /* max pt size allowed if    */
  163.                     /* CF_LIMITSIZE is used      */
  164.   } CHOOSEFONT;
  165.  typedef CHOOSEFONT FAR *LPCHOOSEFONT;
  166.  
  167. BOOL FAR PASCAL ChooseFont(LPCHOOSEFONT);
  168.  
  169. #define CF_SCREENFONTS             0x00000001
  170. #define CF_PRINTERFONTS          0x00000002
  171. #define CF_BOTH              (CF_SCREENFONTS | CF_PRINTERFONTS)
  172. #define CF_SHOWHELP             0x00000004L
  173. #define CF_ENABLEHOOK             0x00000008L
  174. #define CF_ENABLETEMPLATE         0x00000010L
  175. #define CF_ENABLETEMPLATEHANDLE      0x00000020L
  176. #define CF_INITTOLOGFONTSTRUCT       0x00000040L
  177. #define CF_USESTYLE             0x00000080L
  178. #define CF_EFFECTS             0x00000100L
  179. #define CF_APPLY             0x00000200L
  180. #define CF_ANSIONLY             0x00000400L
  181. #define CF_NOVECTORFONTS         0x00000800L
  182. #define CF_NOSIMULATIONS         0x00001000L
  183. #define CF_LIMITSIZE             0x00002000L
  184. #define CF_FIXEDPITCHONLY         0x00004000L
  185. #define CF_WYSIWYG             0x00008000L /* must also have CF_SCREENFONTS & CF_PRINTERFONTS */
  186. #define CF_FORCEFONTEXIST         0x00010000L
  187. #define CF_SCALABLEONLY             0x00020000L
  188. #define CF_TTONLY             0x00040000L
  189. #define CF_NOFACESEL             0x00080000L
  190. #define CF_NOSTYLESEL             0x00100000L
  191. #define CF_NOSIZESEL             0x00200000L
  192.  
  193. /* these are extra nFontType bits that are added to what is returned to the
  194.  * EnumFonts callback routine */
  195.  
  196. #define SIMULATED_FONTTYPE    0x8000
  197. #define PRINTER_FONTTYPE    0x4000
  198. #define SCREEN_FONTTYPE        0x2000
  199. #define BOLD_FONTTYPE        0x0100
  200. #define ITALIC_FONTTYPE        0x0200
  201. #define REGULAR_FONTTYPE    0x0400
  202.  
  203. #define WM_CHOOSEFONT_GETLOGFONT    (WM_USER + 1)
  204.  
  205.  
  206. /* strings used to obtain unique window message for communication
  207.  * between dialog and caller
  208.  */
  209. #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
  210. #define SHAREVISTRING  "commdlg_ShareViolation"
  211. #define FILEOKSTRING   "commdlg_FileNameOK"
  212. #define COLOROKSTRING  "commdlg_ColorOK"
  213. #define SETRGBSTRING   "commdlg_SetRGBColor"
  214. #define FINDMSGSTRING  "commdlg_FindReplace"
  215. #define HELPMSGSTRING  "commdlg_help"
  216.  
  217. /* HIWORD values for lParam of commdlg_LBSelChangeNotify message */
  218. #define CD_LBSELNOITEMS -1
  219. #define CD_LBSELCHANGE   0
  220. #define CD_LBSELSUB      1
  221. #define CD_LBSELADD      2
  222.  
  223.  
  224. typedef struct tagPD
  225.     {
  226.     DWORD   lStructSize;
  227.     HWND    hwndOwner;
  228.     HANDLE  hDevMode;
  229.     HANDLE  hDevNames;
  230.     HDC     hDC;
  231.     DWORD   Flags;
  232.     WORD    nFromPage;
  233.     WORD    nToPage;
  234.     WORD    nMinPage;
  235.     WORD    nMaxPage;
  236.     WORD    nCopies;
  237.     HANDLE  hInstance;
  238.     DWORD   lCustData;
  239.     WORD (FAR PASCAL *lpfnPrintHook)(HWND, WORD, WORD, LONG);
  240.     WORD (FAR PASCAL *lpfnSetupHook)(HWND, WORD, WORD, LONG);
  241.     LPSTR   lpPrintTemplateName;
  242.     LPSTR   lpSetupTemplateName;
  243.     HANDLE  hPrintTemplate;
  244.     HANDLE  hSetupTemplate;
  245.     }   PRINTDLG;
  246. typedef PRINTDLG  FAR * LPPRINTDLG;
  247.  
  248. BOOL  FAR PASCAL     PrintDlg(LPPRINTDLG);
  249.  
  250. #define PD_ALLPAGES                  0x00000000
  251. #define PD_SELECTION                 0x00000001
  252. #define PD_PAGENUMS                  0x00000002
  253. #define PD_NOSELECTION               0x00000004
  254. #define PD_NOPAGENUMS                0x00000008
  255. #define PD_COLLATE                   0x00000010
  256. #define PD_PRINTTOFILE               0x00000020
  257. #define PD_PRINTSETUP                0x00000040
  258. #define PD_NOWARNING                 0x00000080
  259. #define PD_RETURNDC                  0x00000100
  260. #define PD_RETURNIC                  0x00000200
  261. #define PD_RETURNDEFAULT             0x00000400
  262. #define PD_SHOWHELP                  0x00000800
  263. #define PD_ENABLEPRINTHOOK           0x00001000
  264. #define PD_ENABLESETUPHOOK           0x00002000
  265. #define PD_ENABLEPRINTTEMPLATE       0x00004000
  266. #define PD_ENABLESETUPTEMPLATE       0x00008000
  267. #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
  268. #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
  269. #define PD_USEDEVMODECOPIES          0x00040000
  270. #define PD_DISABLEPRINTTOFILE        0x00080000
  271. #define PD_HIDEPRINTTOFILE           0x00100000
  272.  
  273. typedef struct tagDEVNAMES
  274.     {
  275.     WORD wDriverOffset;
  276.     WORD wDeviceOffset;
  277.     WORD wOutputOffset;
  278.     WORD wDefault;
  279.     }   DEVNAMES;
  280. typedef DEVNAMES  FAR * LPDEVNAMES;
  281.  
  282. #define DN_DEFAULTPRN      0x0001
  283.  
  284.  
  285. DWORD FAR PASCAL     CommDlgExtendedError(VOID);
  286.  
  287. #ifndef RC_INVOKED
  288. #pragma pack()       /* Revert to default packing */
  289. #endif
  290.  
  291.