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.

133 lines
2.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: utils.cpp
  7. //
  8. // Contents: various utility functions for oletest
  9. //
  10. // Classes:
  11. //
  12. // Functions: DumpFormatetc
  13. //
  14. // History: dd-mmm-yy Author Comment
  15. // 11-Aug-94 alexgo author
  16. //
  17. //--------------------------------------------------------------------------
  18. #include "oletest.h"
  19. //+-------------------------------------------------------------------------
  20. //
  21. // Function: DumpFormatetc
  22. //
  23. // Synopsis: prints the contents of the formatetc to the given file
  24. //
  25. // Effects:
  26. //
  27. // Arguments: [pformatetc] -- the formatetc
  28. // [fp] -- the file pointer
  29. //
  30. // Requires:
  31. //
  32. // Returns: void
  33. //
  34. // Signals:
  35. //
  36. // Modifies:
  37. //
  38. // Algorithm:
  39. //
  40. // History: dd-mmm-yy Author Comment
  41. // 11-Aug-94 alexgo author
  42. //
  43. // Notes:
  44. //
  45. //--------------------------------------------------------------------------
  46. void DumpFormatetc( FORMATETC *pformatetc, FILE *fp)
  47. {
  48. char szBuf[256];
  49. fprintf(fp, "\n\n");
  50. // clipboard format
  51. GetClipboardFormatName(pformatetc->cfFormat, szBuf, sizeof(szBuf));
  52. fprintf(fp, "cfFormat: %s\n", szBuf);
  53. // target device
  54. fprintf(fp, "ptd: %p\n", pformatetc->ptd);
  55. // aspect
  56. if( pformatetc->dwAspect == DVASPECT_CONTENT )
  57. {
  58. sprintf(szBuf, "DVASPECT_CONTENT");
  59. }
  60. else if( pformatetc->dwAspect == DVASPECT_ICON )
  61. {
  62. sprintf(szBuf, "DVASPECT_ICON");
  63. }
  64. else if( pformatetc->dwAspect == DVASPECT_THUMBNAIL )
  65. {
  66. sprintf(szBuf, "DVASPECT_THUMBNAIL");
  67. }
  68. else if( pformatetc->dwAspect == DVASPECT_DOCPRINT )
  69. {
  70. sprintf(szBuf, "DVASPECT_DOCPRINT");
  71. }
  72. else
  73. {
  74. sprintf(szBuf, "UNKNOWN ASPECT");
  75. }
  76. fprintf(fp, "dwAspect: %s\n", szBuf);
  77. // lindex
  78. fprintf(fp, "lindex: %lx\n", pformatetc->lindex);
  79. // medium
  80. szBuf[0] = '\0';
  81. if( pformatetc->tymed & TYMED_HGLOBAL )
  82. {
  83. strcat(szBuf, "TYMED_HGLOBAL ");
  84. }
  85. if( pformatetc->tymed & TYMED_FILE )
  86. {
  87. strcat(szBuf, "TYMED_FILE");
  88. }
  89. if( pformatetc->tymed & TYMED_ISTREAM )
  90. {
  91. strcat(szBuf, "TYMED_ISTREAM");
  92. }
  93. if( pformatetc->tymed & TYMED_ISTORAGE )
  94. {
  95. strcat(szBuf, "TYMED_ISTORAGE");
  96. }
  97. if( pformatetc->tymed & TYMED_GDI )
  98. {
  99. strcat(szBuf, "TYMED_GDI");
  100. }
  101. if( pformatetc->tymed & TYMED_MFPICT )
  102. {
  103. strcat(szBuf, "TYMED_MFPICT");
  104. }
  105. // TYMED_EMFPICT (not in 16bit)
  106. if( (ULONG)pformatetc->tymed & (ULONG)64L )
  107. {
  108. strcat(szBuf, "TYMED_ENHMF");
  109. }
  110. fprintf(fp, "tymed: %s\n\n", szBuf);
  111. }
  112.