Leaked source code of windows server 2003
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.

91 lines
2.4 KiB

  1. /******************************************************************************
  2. Source File: Freeze.CPP
  3. This file implements the REC freezing and unfreezing routines.
  4. ******************************************************************************/
  5. #include "StdAfx.H"
  6. #include "MiniDev.H"
  7. #include <tom.h>
  8. #ifdef DEFINE_GUID
  9. #undef DEFINE_GUID
  10. #endif
  11. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  12. EXTERN_C const GUID name \
  13. = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
  14. DEFINE_GUID(IID_ITextDocument,0x8CC497C0L,0xA1DF,0x11CE,0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D);
  15. /******************************************************************************
  16. InitFreeze
  17. Get the COM pointers needed to freeze and unfreeze a Rich Edit Control.
  18. ******************************************************************************/
  19. void InitFreeze(HWND hedit, void** ppunk, void** ppdoc, long* plcount)
  20. {
  21. ::SendMessage(hedit, EM_GETOLEINTERFACE, 0, (LPARAM) ppunk) ;
  22. ASSERT(*ppunk != NULL) ;
  23. ((IUnknown *) *ppunk)->QueryInterface(IID_ITextDocument, ppdoc) ;
  24. ASSERT(*ppdoc != NULL) ;
  25. *plcount = 0 ;
  26. TRACE("FRZ: punk = %x\tpdoc = %x\n", *ppunk, *ppdoc) ;
  27. }
  28. /******************************************************************************
  29. Freeze
  30. Freeze a Rich Edit Control.
  31. ******************************************************************************/
  32. void Freeze(void* pdoc, long* plcount)
  33. {
  34. ASSERT(pdoc != NULL) ;
  35. ((ITextDocument *) pdoc)->Freeze(plcount) ;
  36. }
  37. /******************************************************************************
  38. Unfreeze
  39. Unfreeze a Rich Edit Control.
  40. ******************************************************************************/
  41. void Unfreeze(void* pdoc, long* plcount)
  42. {
  43. ASSERT(pdoc != NULL) ;
  44. ((ITextDocument *) pdoc)->Unfreeze(plcount) ;
  45. }
  46. /******************************************************************************
  47. ReleaseFreeze
  48. Release the COM pointers used to freeze and unfreeze a Rich Edit Control.
  49. ******************************************************************************/
  50. void ReleaseFreeze(void** ppunk, void** ppdoc)
  51. {
  52. if (*ppdoc)
  53. ((ITextDocument *) *ppdoc)->Release() ;
  54. if (*ppunk)
  55. ((IUnknown *) *ppunk)->Release() ;
  56. *ppdoc = *ppunk = NULL ;
  57. }