Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
6.6 KiB

  1. /* CLIPBRD.H */
  2. /* */
  3. /* Copyright 1985-92, Microsoft Corporation */
  4. #include <windows.h>
  5. #include <port1632.h>
  6. #include <commdlg.h>
  7. #ifndef MAXSHORT
  8. #define MAXSHORT 0x7fff
  9. #endif
  10. #define SIZE_OF_WIN31_BITMAP_STRUCT 14 //Win 3.1 BITMAP structure is 14 bytes long
  11. #define SIZE_OF_WIN31_METAFILEPICT_STRUCT 8 //Win 3.1 METAFILEPICT structure is 8 bytes long
  12. #define PRIVATE_FORMAT(fmt) ((fmt) >= 0xC000)
  13. /* Header text string ids */
  14. #define IDS_NAME 100 /* CF_TEXT to CF_OEMTEXT (1 to 7) are also used */
  15. #define IDS_ERROR 102 /* as string ids. Be sure to keep these */
  16. #define IDS_BINARY 103 /* different. */
  17. #define IDS_CLEAR 104
  18. #define IDS_FMTNOTSAV 105
  19. #define IDS_DEFAULT 106
  20. #define IDS_CANTDISPLAY 107 /* "Can't display data in this format" */
  21. #define IDS_NOTRENDERED 108 /* "Application Couldn't render data" */
  22. #define IDS_HELPFILE 109 /* Clipbrd.hlp */
  23. #define IDS_CLEARTITLE 110
  24. #define IDS_CONFIRMCLEAR 111
  25. #define IDS_ALREADYOPEN 112 /* OpenClipboard() fails */
  26. #define IDS_INVALIDFILENAME 113 /* Filename is invalid */
  27. #define IDS_OPENCAPTION 114 /* ID of File/Open dlg. caption string */
  28. #define IDS_SAVECAPTION 115 /* ID of File/Save dlg. caption string */
  29. #define IDS_MEMERROR 116
  30. #define IDS_DEFEXTENSION 117 /* Default extension for clipboard files */
  31. #ifdef JAPAN
  32. #define IDS_ENOTVALIDFILE 130 /* ID of invalid file format messagebox*/
  33. #endif
  34. #define IDS_READERR 200 /* ID of base ReadClipboardFile error */
  35. #define IDS_READFORMATERR 201
  36. #define IDS_READOPENCLIPERR 202
  37. #define IDS_FILTERTEXT 301 /* ID of filter string for File/Open */
  38. /* Dialogbox resource id */
  39. #define ABOUTBOX 1
  40. #define CONFIRMBOX 2
  41. #define CDEFFMTS 8 /* Count of predifined clipboard formats */
  42. #define VPOSLAST 100 /* Highest vert scroll bar value */
  43. #define HPOSLAST 100 /* Highest horiz scroll bar value */
  44. #define CCHFMTNAMEMAX 79 /* Longest clipboard data fmt name, including
  45. terminator */
  46. #define cLineAlwaysShow 3 /* # of "standard text height" lines to show
  47. when maximally scrolled down */
  48. #define BUFFERLEN 200 /* String buffer length */
  49. #define SMALLBUFFERLEN 90
  50. #define IDSABOUT 1
  51. #define CBMENU 1 /* Number for the Clipboard main menu */
  52. #define CBICON 2
  53. #define CBACCEL 3
  54. #define FILTERMAX 100 /* max len. of File/Open filter string */
  55. #define CAPTIONMAX 30 /* len of caption text for above dlg. */
  56. #define PATHMAX 128 /* max. len of DOS pathname */
  57. #define MSGMAX 255
  58. /* The menu ids */
  59. #define CBM_AUTO WM_USER
  60. #define CBM_CLEAR WM_USER+1
  61. #define CBM_OPEN WM_USER+2
  62. #define CBM_SAVEAS WM_USER+3
  63. #define CBM_ABOUT WM_USER+4
  64. #define CBM_EXIT WM_USER+5
  65. #define CBM_HELP 0xFFFF /* Standard numbers */
  66. #define CBM_USEHELP 0xFFFC /* Standard numbers */
  67. #define CBM_SEARCH 0x0021
  68. /* Last parameter to SetDIBits() and GetDIBits() calls */
  69. #define DIB_RGB_COLORS 0
  70. #define DIB_PAL_COLORS 1
  71. #define IDCLEAR IDOK
  72. /* Structures for saving/loading clipboard data from disk */
  73. #define CLP_ID 0xC350
  74. #define CLP_NT_ID 0xC351
  75. // Windows 3.1 used byte packing on structs. These structs are used in
  76. // files common between NT and Win 3.1, therefore need byte packing.
  77. // a-mgates 9/28/92
  78. #ifndef RC_INVOKED
  79. #pragma pack(1)
  80. typedef struct {
  81. WORD magic;
  82. WORD FormatCount;
  83. } FILEHEADER;
  84. typedef struct {
  85. UINT FormatID;
  86. DWORD DataLen;
  87. DWORD DataOffset;
  88. TCHAR Name[CCHFMTNAMEMAX];
  89. } FORMATHEADER;
  90. #pragma pack()
  91. #endif
  92. void NEAR PASCAL SaveClipboardToFile(HWND);
  93. void NEAR PASCAL OpenClipboardFile(HWND);
  94. BOOL MyOpenClipboard(HWND);
  95. BOOL NEAR PASCAL ClearClipboard(HWND);
  96. void NEAR PASCAL GetClipboardName(UINT fmt, LPSTR szName, INT iSize);
  97. BOOL RenderFormat(FORMATHEADER *f,INT);
  98. DWORD APIENTRY lread(INT fh, void FAR *pv, DWORD ul);
  99. DWORD APIENTRY lwrite(INT fh, void FAR *pv, DWORD ul);
  100. void UpdateCBMenu(HWND);
  101. void ChangeCharDimensions(HWND,UINT,UINT);
  102. void SetCharDimensions(HWND,HFONT);
  103. void SaveOwnerScrollInfo(HWND);
  104. void RestoreOwnerScrollInfo(HWND);
  105. void SendOwnerMessage(UINT, WPARAM, LPARAM);
  106. void SendOwnerSizeMessage(HWND, INT, INT, INT, INT);
  107. void DrawStuff(HWND,PAINTSTRUCT *f);
  108. void ClipbrdVScroll(HWND, WORD, WORD);
  109. void ClipbrdHScroll(HWND, WORD, WORD);
  110. UINT GetBestFormat(UINT);
  111. LONG APIENTRY ClipbrdWndProc(HWND, UINT, WPARAM, LONG);
  112. BOOL APIENTRY ConfirmDlgProc(HWND, UINT, WPARAM, LONG);
  113. /* Far low mem situations. */
  114. void FAR PASCAL MemErrorMessage(void);
  115. /***************************** global data *******************************/
  116. extern HINSTANCE hInst;
  117. extern TCHAR szFileName[];
  118. extern HWND hwndMain;
  119. extern TCHAR szAppName[];
  120. extern TCHAR szFileSpecifier[];
  121. /* variables for the new File Open,File SaveAs and Find Text dialogs */
  122. #define CCH_szDefExt 8
  123. extern OPENFILENAME OFN;
  124. extern TCHAR szFileName [];
  125. extern BOOL fNTReadFileFormat;
  126. extern TCHAR szLastDir [];
  127. extern TCHAR szFilterSpec[]; /* default filter spec. for above */
  128. extern TCHAR szCustFilterSpec[]; /* buffer for custom filters created */
  129. extern UINT wHlpMsg; /* message used to invoke Help */
  130. extern TCHAR szOpenCaption []; /* File open dialog caption text */
  131. extern TCHAR szSaveCaption []; /* File Save as dialog caption text */
  132. extern TCHAR szDefExt [CCH_szDefExt]; /* default file extension to use */
  133. #define MAXBITSPERPIXEL 24
  134. extern BOOL fAnythingToRender;
  135. extern BOOL fOwnerDisplay;
  136. extern BOOL fDisplayFormatChanged;
  137. extern TCHAR szAppName[];
  138. extern TCHAR szCaptionName[CAPTIONMAX];
  139. extern TCHAR szHelpFileName[20];
  140. extern TCHAR szMemErr[MSGMAX];
  141. extern HWND hwndNextViewer;
  142. extern HWND hwndMain;
  143. extern HANDLE hAccel;
  144. extern HANDLE hfontSys;
  145. extern HANDLE hfontOem;
  146. extern HANDLE hfontUni;
  147. extern HBRUSH hbrWhite;
  148. extern HBRUSH hbrBackground;
  149. extern HMENU hMainMenu;
  150. extern HMENU hDispMenu;
  151. extern INT OwnVerMin, OwnVerMax, OwnHorMin, OwnHorMax;
  152. extern INT OwnVerPos, OwnHorPos;
  153. extern LONG cyScrollLast;
  154. extern LONG cyScrollNow;
  155. extern INT cxScrollLast;
  156. extern INT cxScrollNow;
  157. extern RECT rcWindow;
  158. extern UINT cyLine, cxChar, cxMaxCharWidth;
  159. extern UINT cxMargin, cyMargin;
  160. extern UINT CurSelFormat;
  161. extern UINT rgfmt[];