home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / MFCINC.PAK / AFXPRIV.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  32.7 KB  |  1,059 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1995 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. // Note: This header file contains useful classes that are documented only
  12. //  in the MFC Technical Notes.  These classes may change from version to
  13. //  version, so be prepared to change your code accordingly if you utilize
  14. //  this header.  In the future, commonly used portions of this header
  15. //  may be moved and officially documented.
  16.  
  17. #ifndef __AFXPRIV_H__
  18. #define __AFXPRIV_H__
  19.  
  20. #ifndef __AFXADV_H__
  21.     #include <afxadv.h>
  22. #endif
  23.  
  24. #ifndef _INC_MALLOC
  25.     #include <malloc.h>
  26. #endif
  27.  
  28. #ifdef _AFX_MINREBUILD
  29. #pragma component(minrebuild, off)
  30. #endif
  31. #ifndef _AFX_FULLTYPEINFO
  32. #pragma component(mintypeinfo, on)
  33. #endif
  34.  
  35. #ifdef _AFX_PACKING
  36. #pragma pack(push, _AFX_PACKING)
  37. #endif
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // AFXPRIV - MFC Private Classes
  41.  
  42. // Implementation structures
  43. struct AFX_SIZEPARENTPARAMS;    // Control bar implementation
  44. struct AFX_CMDHANDLERINFO;      // Command routing implementation
  45.  
  46. // Classes declared in this file
  47.  
  48.     //CDC
  49.         class CPreviewDC;               // Virtual DC for print preview
  50.  
  51.     //CCmdTarget
  52.         //CWnd
  53.             //CView
  54.                 class CPreviewView;     // Print preview view
  55.         //CFrameWnd
  56.             class COleCntrFrameWnd;
  57.             //CMiniFrameWnd
  58.                 class CMiniDockFrameWnd;
  59.  
  60. class CDockContext;                     // for dragging control bars
  61.  
  62. //IStream
  63.     class CArchiveStream;
  64.  
  65. /////////////////////////////////////////////////////////////////////////////
  66.  
  67. #undef AFX_DATA
  68. #define AFX_DATA AFX_CORE_DATA
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // Global ID ranges (see Technical note TN020 for more details)
  72.  
  73. // 8000 -> FFFF command IDs (used for menu items, accelerators and controls)
  74. #define IS_COMMAND_ID(nID)  ((nID) & 0x8000)
  75.  
  76. // 8000 -> DFFF : user commands
  77. // E000 -> EFFF : AFX commands and other things
  78. // F000 -> FFFF : standard windows commands and other things etc
  79.     // E000 -> E7FF standard commands
  80.     // E800 -> E8FF control bars (first 32 are special)
  81.     // E900 -> EEFF standard window controls/components
  82.     // EF00 -> EFFF SC_ menu help
  83.     // F000 -> FFFF standard strings
  84. #define ID_COMMAND_FROM_SC(sc)  (((sc - 0xF000) >> 4) + AFX_IDS_SCFIRST)
  85.  
  86. // 0000 -> 7FFF IDR range
  87. // 0000 -> 6FFF : user resources
  88. // 7000 -> 7FFF : AFX (and standard windows) resources
  89. // IDR ranges (NOTE: IDR_ values must be <32768)
  90. #define ASSERT_VALID_IDR(nIDR) ASSERT((nIDR) != 0 && (nIDR) < 0x8000)
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // Context sensitive help support (see Technical note TN028 for more details)
  94.  
  95. // Help ID bases
  96. #define HID_BASE_COMMAND    0x00010000UL        // ID and IDM
  97. #define HID_BASE_RESOURCE   0x00020000UL        // IDR and IDD
  98. #define HID_BASE_PROMPT     0x00030000UL        // IDP
  99. #define HID_BASE_NCAREAS    0x00040000UL
  100. #define HID_BASE_CONTROL    0x00050000UL        // IDC
  101. #define HID_BASE_DISPATCH   0x00060000UL        // IDispatch help codes
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104. // Internal AFX Windows messages (see Technical note TN024 for more details)
  105. // (0x0360 - 0x037F are reserved for MFC)
  106.  
  107. #define WM_QUERYAFXWNDPROC  0x0360  // lResult = 1 if processed by AfxWndProc
  108. #define WM_SIZEPARENT       0x0361  // lParam = &AFX_SIZEPARENTPARAMS
  109. #define WM_SETMESSAGESTRING 0x0362  // wParam = nIDS (or 0),
  110.                                     // lParam = lpszOther (or NULL)
  111. #define WM_IDLEUPDATECMDUI  0x0363  // wParam == bDisableIfNoHandler
  112. #define WM_INITIALUPDATE    0x0364  // (params unused) - sent to children
  113. #define WM_COMMANDHELP      0x0365  // lResult = TRUE/FALSE,
  114.                                     // lParam = dwContext
  115. #define WM_HELPHITTEST      0x0366  // lResult = dwContext,
  116.                                     // lParam = MAKELONG(x,y)
  117. #define WM_EXITHELPMODE     0x0367  // (params unused)
  118. #define WM_RECALCPARENT     0x0368  // force RecalcLayout on frame window
  119.                                     //  (only for inplace frame windows)
  120. #define WM_SIZECHILD        0x0369  // special notify from COleResizeBar
  121.                                     // wParam = ID of child window
  122.                                     // lParam = lpRectNew (new position/size)
  123. #define WM_KICKIDLE         0x036A  // (params unused) causes idles to kick in
  124. #define WM_QUERYCENTERWND   0x036B  // lParam = HWND to use as centering parent
  125. #define WM_DISABLEMODAL     0x036C  // lResult = 0, disable during modal state
  126.                                     // lResult = 1, don't disable
  127. #define WM_FLOATSTATUS      0x036D  // wParam combination of FS_* flags below
  128.  
  129. // WM_ACTIVATETOPLEVEL is like WM_ACTIVATEAPP but works with hierarchies
  130. //   of mixed processes (as is the case with OLE in-place activation)
  131. #define WM_ACTIVATETOPLEVEL 0x036E  // wParam = nState (like WM_ACTIVATE)
  132.                                     // lParam = pointer to HWND[2]
  133.                                     //  lParam[0] = hWnd getting WM_ACTIVATE
  134.                                     //  lParam[1] = hWndOther
  135.  
  136. #define WM_QUERY3DCONTROLS  0x036F  // lResult != 0 if 3D controls wanted
  137.  
  138. // Note: Messages 0x0370, 0x0371, and 0x372 were incorrectly used by
  139. //  some versions of Windows.  To remain compatible, MFC does not
  140. //  use messages in that range.
  141. #define WM_RESERVED_0370    0x0370
  142. #define WM_RESERVED_0371    0x0371
  143. #define WM_RESERVED_0372    0x0372
  144.  
  145. // WM_SOCKET_NOTIFY and WM_SOCKET_DEAD are used internally by MFC's
  146. // Windows sockets implementation.  For more information, see sockcore.cpp
  147. #define WM_SOCKET_NOTIFY    0x0373
  148. #define WM_SOCKET_DEAD      0x0374
  149.  
  150. // same as WM_SETMESSAGESTRING except not popped if IsTracking()
  151. #define WM_POPMESSAGESTRING 0x0375
  152.  
  153. // Constants used in DLGINIT resources for OLE control containers
  154. #define WM_OCC_LOADFROMSTREAM   0x0376
  155. #define WM_OCC_LOADFROMSTORAGE  0x0377
  156. #define WM_OCC_INITNEW          0x0378
  157.  
  158. // Marker used while rearranging the message queue
  159. #define WM_QUEUE_SENTINEL   0x0379
  160.  
  161. // Note: Messages 0x037A - 0x37F reserved for future MFC use.
  162. #define WM_RESERVED_037A    0x037A
  163. #define WM_RESERVED_037B    0x037B
  164. #define WM_RESERVED_037C    0x037C
  165. #define WM_RESERVED_037D    0x037D
  166. #define WM_RESERVED_037E    0x037E
  167. #define WM_RESERVED_037F    0x037F
  168.  
  169. // like ON_MESSAGE but no return value
  170. #define ON_MESSAGE_VOID(message, memberFxn) \
  171.     { message, 0, 0, 0, AfxSig_vv, \
  172.         (AFX_PMSG)(AFX_PMSGW)(void (AFX_MSG_CALL CWnd::*)(void))memberFxn },
  173.  
  174. // special struct for WM_SIZEPARENT
  175. struct AFX_SIZEPARENTPARAMS
  176. {
  177.     HDWP hDWP;       // handle for DeferWindowPos
  178.     RECT rect;       // parent client rectangle (trim as appropriate)
  179.     SIZE sizeTotal;  // total size on each side as layout proceeds
  180.     BOOL bStretch;   // should stretch to fill all space
  181. };
  182.  
  183. // flags for wParam in the WM_FLOATSTATUS message
  184. enum {  FS_SHOW = 0x01, FS_HIDE = 0x02,
  185.         FS_ACTIVATE = 0x04, FS_DEACTIVATE = 0x08,
  186.         FS_ENABLE = 0x10, FS_DISABLE = 0x20,
  187.         FS_SYNCACTIVE = 0x40 };
  188.  
  189. void AFXAPI AfxRepositionWindow(AFX_SIZEPARENTPARAMS* lpLayout,
  190.     HWND hWnd, LPCRECT lpRect);
  191.  
  192. /////////////////////////////////////////////////////////////////////////////
  193. // Implementation of command routing
  194.  
  195. struct AFX_CMDHANDLERINFO
  196. {
  197.     CCmdTarget* pTarget;
  198.     void (AFX_MSG_CALL CCmdTarget::*pmf)(void);
  199. };
  200.  
  201. /////////////////////////////////////////////////////////////////////////////
  202. // Implementation of event sink handling
  203.  
  204. #ifndef _AFX_NO_OLE_SUPPORT
  205. #ifdef _OBJBASE_H_
  206.  
  207. struct AFX_EVENT
  208. {
  209.     enum { event, propRequest, propChanged };
  210.  
  211.     AFX_EVENT(int eventKind, DISPID dispid, DISPPARAMS* pDispParams = NULL,
  212.         EXCEPINFO* pExcepInfo = NULL, UINT* puArgError = NULL);
  213.  
  214.     int m_eventKind;
  215.     DISPID m_dispid;
  216.     DISPPARAMS* m_pDispParams;
  217.     EXCEPINFO* m_pExcepInfo;
  218.     UINT* m_puArgError;
  219.     BOOL m_bPropChanged;
  220.     HRESULT m_hResult;
  221. };
  222.  
  223. inline AFX_EVENT::AFX_EVENT(int eventKind, DISPID dispid,
  224.     DISPPARAMS* pDispParams, EXCEPINFO* pExcepInfo, UINT* puArgError)
  225. {
  226.     m_eventKind = eventKind;
  227.     m_dispid = dispid;
  228.     m_pDispParams = pDispParams;
  229.     m_pExcepInfo = pExcepInfo;
  230.     m_puArgError = puArgError;
  231.     m_hResult = NOERROR;
  232. }
  233.  
  234. #endif
  235. #endif // _AFX_NO_OLE_SUPPORT
  236.  
  237. /////////////////////////////////////////////////////////////////////////////
  238. // Robust file save support
  239. // opens a temp file if modeCreate specified and enough free space
  240. // renaming, etc occurs automatically if everything succeeds
  241.  
  242. class CMirrorFile : public CFile
  243. {
  244. // Implementation
  245. public:
  246.     virtual void Abort();
  247.     virtual void Close();
  248.     virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags,
  249.         CFileException* pError = NULL);
  250.  
  251. protected:
  252.     CString m_strMirrorName;
  253. };
  254.  
  255. /////////////////////////////////////////////////////////////////////////////
  256. // Implementation of PrintPreview
  257.  
  258. class CPreviewDC : public CDC
  259. {
  260.     DECLARE_DYNAMIC(CPreviewDC)
  261.  
  262. public:
  263.     virtual void SetAttribDC(HDC hDC);  // Set the Attribute DC
  264.     virtual void SetOutputDC(HDC hDC);
  265.  
  266.     virtual void ReleaseOutputDC();
  267.  
  268. // Constructors
  269.     CPreviewDC();
  270.  
  271. // Implementation
  272. public:
  273.     virtual ~CPreviewDC();
  274. #ifdef _DEBUG
  275.     virtual void AssertValid() const;
  276.     virtual void Dump(CDumpContext& dc) const;
  277. #endif
  278.  
  279.     void SetScaleRatio(int nNumerator, int nDenominator);
  280.     void SetTopLeftOffset(CSize TopLeft);
  281.     void ClipToPage();
  282.  
  283.     // These conversion functions can be used without an output DC
  284.  
  285.     void PrinterDPtoScreenDP(LPPOINT lpPoint) const;
  286.  
  287. // Device-Context Functions
  288.     virtual int SaveDC();
  289.     virtual BOOL RestoreDC(int nSavedDC);
  290.  
  291. public:
  292.     virtual CGdiObject* SelectStockObject(int nIndex);
  293.     virtual CFont* SelectObject(CFont* pFont);
  294.  
  295. // Drawing-Attribute Functions
  296.     virtual COLORREF SetBkColor(COLORREF crColor);
  297.     virtual COLORREF SetTextColor(COLORREF crColor);
  298.  
  299. // Mapping Functions
  300.     virtual int SetMapMode(int nMapMode);
  301.     virtual CPoint SetViewportOrg(int x, int y);
  302.     virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
  303.     virtual CSize SetViewportExt(int x, int y);
  304.     virtual CSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
  305.     virtual CSize SetWindowExt(int x, int y);
  306.     virtual CSize ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom);
  307.  
  308. // Text Functions
  309.     virtual BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount);
  310.     virtual BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  311.                 LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths);
  312.     virtual CSize TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount,
  313.                 int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
  314.     virtual int DrawText(LPCTSTR lpszString, int nCount, LPRECT lpRect,
  315.                 UINT nFormat);
  316.     virtual BOOL GrayString(CBrush* pBrush,
  317.                 BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int),
  318.                     LPARAM lpData, int nCount,
  319.                     int x, int y, int nWidth, int nHeight);
  320.  
  321. // Printer Escape Functions
  322.     virtual int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData);
  323.  
  324. // Implementation
  325. protected:
  326.     void MirrorMappingMode(BOOL bCompute);
  327.     void MirrorViewportOrg();
  328.     void MirrorFont();
  329.     void MirrorAttributes();
  330.  
  331.     CSize ComputeDeltas(int& x, LPCTSTR lpszString, UINT& nCount, BOOL bTabbed,
  332.                     UINT nTabStops, LPINT lpnTabStops, int nTabOrigin,
  333.                     LPTSTR lpszOutputString, int* pnDxWidths, int& nRightFixup);
  334.  
  335. protected:
  336.     int m_nScaleNum;    // Scale ratio Numerator
  337.     int m_nScaleDen;    // Scale ratio Denominator
  338.     int m_nSaveDCIndex; // DC Save index when Screen DC Attached
  339.     int m_nSaveDCDelta; // delta between Attrib and output restore indices
  340.     CSize m_sizeTopLeft;// Offset for top left corner of page
  341.     HFONT m_hFont;      // Font selected into the screen DC (NULL if none)
  342.     HFONT m_hPrinterFont; // Font selected into the print DC
  343. #ifdef _MAC
  344.     int m_aCharWidthsDraw[256];   // character widths for m_hDC
  345.     int m_aCharWidthsAttrib[256]; // character widths for m_hAttribDC
  346. #endif
  347.  
  348.     CSize m_sizeWinExt; // cached window extents computed for screen
  349.     CSize m_sizeVpExt;  // cached viewport extents computed for screen
  350. };
  351.  
  352. /////////////////////////////////////////////////////////////////////////////
  353. // CPreviewView
  354.  
  355. class CDialogBar;
  356.  
  357. class CPreviewView : public CScrollView
  358. {
  359.     DECLARE_DYNCREATE(CPreviewView)
  360.  
  361. // Constructors
  362. public:
  363.     CPreviewView();
  364.     BOOL SetPrintView(CView* pPrintView);
  365.  
  366. // Attributes
  367. protected:
  368.     CView* m_pOrigView;
  369.     CView* m_pPrintView;
  370.     CPreviewDC* m_pPreviewDC;  // Output and attrib DCs Set, not created
  371.     CDC m_dcPrint;             // Actual printer DC
  372.  
  373. // Operations
  374.     void SetZoomState(UINT nNewState, UINT nPage, CPoint point);
  375.     void SetCurrentPage(UINT nPage, BOOL bClearRatios);
  376.  
  377.     // Returns TRUE if in a page rect. Returns the page index
  378.     // in nPage and the point converted to 1:1 screen device coordinates
  379.     BOOL FindPageRect(CPoint& point, UINT& nPage);
  380.  
  381.  
  382. // Overridables
  383.     virtual void OnActivateView(BOOL bActivate,
  384.             CView* pActivateView, CView* pDeactiveView);
  385.  
  386.     // Returns .cx/.cy as the numerator/denominator pair for the ratio
  387.     // using CSize for convenience
  388.     virtual CSize CalcScaleRatio(CSize windowSize, CSize actualSize);
  389.  
  390.     virtual void PositionPage(UINT nPage);
  391.     virtual void OnDisplayPageNumber(UINT nPage, UINT nPagesDisplayed);
  392.  
  393. // Implementation
  394. public:
  395.     virtual ~CPreviewView();
  396.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  397. #ifdef _DEBUG
  398.     void AssertValid() const;
  399.     void Dump(CDumpContext& dc) const;
  400. #endif
  401. #ifdef _MAC
  402.     virtual void CalcWindowRect(LPRECT lpClientRect);
  403. #endif
  404.  
  405. protected:
  406.     //{{AFX_MSG(CPreviewView)
  407.     afx_msg void OnPreviewClose();
  408.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  409.     afx_msg void OnSize(UINT nType, int cx, int cy);
  410.     afx_msg void OnDraw(CDC* pDC);
  411.     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  412.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  413.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  414.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  415.     afx_msg void OnNumPageChange();
  416.     afx_msg void OnNextPage();
  417.     afx_msg void OnPrevPage();
  418.     afx_msg void OnPreviewPrint();
  419.     afx_msg void OnZoomIn();
  420.     afx_msg void OnZoomOut();
  421.     afx_msg void OnUpdateNumPageChange(CCmdUI* pCmdUI);
  422.     afx_msg void OnUpdateNextPage(CCmdUI* pCmdUI);
  423.     afx_msg void OnUpdatePrevPage(CCmdUI* pCmdUI);
  424.     afx_msg void OnUpdateZoomIn(CCmdUI* pCmdUI);
  425.     afx_msg void OnUpdateZoomOut(CCmdUI* pCmdUI);
  426.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  427.     //}}AFX_MSG
  428.  
  429.     void DoZoom(UINT nPage, CPoint point);
  430.     void SetScaledSize(UINT nPage);
  431.     CSize CalcPageDisplaySize();
  432.  
  433.     CPrintPreviewState* m_pPreviewState; // State to restore
  434.     CDialogBar* m_pToolBar; // Toolbar for preview
  435.  
  436.     struct PAGE_INFO
  437.     {
  438.         CRect rectScreen; // screen rect (screen device units)
  439.         CSize sizeUnscaled; // unscaled screen rect (screen device units)
  440.         CSize sizeScaleRatio; // scale ratio (cx/cy)
  441.         CSize sizeZoomOutRatio; // scale ratio when zoomed out (cx/cy)
  442.     };
  443.  
  444.     PAGE_INFO* m_pPageInfo; // Array of page info structures
  445.     PAGE_INFO m_pageInfoArray[2]; // Embedded array for the default implementation
  446.  
  447.     BOOL m_bPageNumDisplayed;// Flags whether or not page number has yet
  448.                                 // been displayed on status line
  449.     UINT m_nZoomOutPages; // number of pages when zoomed out
  450.     UINT m_nZoomState;
  451.     UINT m_nMaxPages; // for sanity checks
  452.     UINT m_nCurrentPage;
  453.     UINT m_nPages;
  454.     int m_nSecondPageOffset; // used to shift second page position
  455.  
  456.     HCURSOR m_hMagnifyCursor;
  457.  
  458.     CSize m_sizePrinterPPI; // printer pixels per inch
  459.     CPoint m_ptCenterPoint;
  460.     CPrintInfo* m_pPreviewInfo;
  461.  
  462.     DECLARE_MESSAGE_MAP()
  463.  
  464.     friend class CView;
  465.     friend BOOL CALLBACK _AfxPreviewCloseProc(CFrameWnd* pFrameWnd);
  466. };
  467.  
  468. // Zoom States
  469. #define ZOOM_OUT    0
  470. #define ZOOM_MIDDLE 1
  471. #define ZOOM_IN     2
  472.  
  473. /////////////////////////////////////////////////////////////////////////////
  474. // toolbar docking support
  475.  
  476. class CDockContext
  477. {
  478. public:
  479. // Construction
  480.     CDockContext(CControlBar* pBar);
  481.  
  482. // Attributes
  483.     CPoint m_ptLast;            // last mouse position during drag
  484.     CRect m_rectLast;
  485.     CSize m_sizeLast;
  486.     BOOL m_bDitherLast;
  487.  
  488.     // Rectangles used during dragging or resizing
  489.     CRect m_rectDragHorz;
  490.     CRect m_rectDragVert;
  491.     CRect m_rectFrameDragHorz;
  492.     CRect m_rectFrameDragVert;
  493.  
  494.     CControlBar* m_pBar;        // the toolbar that created this context
  495.     CFrameWnd* m_pDockSite;     // the controlling frame of the CControlBar
  496.     DWORD m_dwDockStyle;        // allowable dock styles for bar
  497.     DWORD m_dwOverDockStyle;    // style of dock that rect is over
  498.     DWORD m_dwStyle;            // style of control bar
  499.     BOOL m_bFlip;               // if shift key is down
  500.     BOOL m_bForceFrame;         // if ctrl key is down
  501.  
  502.     CDC* m_pDC;                 // where to draw during drag
  503.     BOOL m_bDragging;
  504.     int m_nHitTest;
  505.  
  506.     UINT m_uMRUDockID;
  507.     CRect m_rectMRUDockPos;
  508.  
  509.     DWORD m_dwMRUFloatStyle;
  510.     CPoint m_ptMRUFloatPos;
  511.  
  512. // Drag Operations
  513.     virtual void StartDrag(CPoint pt);
  514.     void Move(CPoint pt);       // called when mouse has moved
  515.     void EndDrag();             // drop
  516.     void OnKey(int nChar, BOOL bDown);
  517.  
  518. // Resize Operations
  519.     virtual void StartResize(int nHitTest, CPoint pt);
  520.     void Stretch(CPoint pt);
  521.     void EndResize();
  522.  
  523. // Double Click Operations
  524.     virtual void ToggleDocking();
  525.  
  526. // Operations
  527.     void InitLoop();
  528.     void CancelLoop();
  529.  
  530. // Implementation
  531. public:
  532.     ~CDockContext();
  533.     BOOL Track();
  534.     void DrawFocusRect(BOOL bRemoveRect = FALSE);
  535.         // draws the correct outline
  536.     void UpdateState(BOOL* pFlag, BOOL bNewValue);
  537.     DWORD CanDock();
  538.     CDockBar* GetDockBar(DWORD dwOverDockStyle);
  539. };
  540.  
  541. /////////////////////////////////////////////////////////////////////////////
  542. // CControlBarInfo - used for docking serialization
  543.  
  544. class CControlBarInfo
  545. {
  546. public:
  547. // Implementation
  548.     CControlBarInfo();
  549.  
  550. // Attributes
  551.     UINT m_nBarID;      // ID of this bar
  552.     BOOL m_bVisible;    // visibility of this bar
  553.     BOOL m_bFloating;   // whether floating or not
  554.     BOOL m_bHorz;       // orientation of floating dockbar
  555.     BOOL m_bDockBar;    // true if a dockbar
  556.     CPoint m_pointPos;  // topleft point of window
  557.  
  558.     UINT m_nMRUWidth;   // MRUWidth for Dynamic Toolbars
  559.     BOOL m_bDocking;    // TRUE if this bar has a DockContext
  560.     UINT m_uMRUDockID;  // most recent docked dockbar
  561.     CRect m_rectMRUDockPos; // most recent docked position
  562.     DWORD m_dwMRUFloatStyle; // most recent floating orientation
  563.     CPoint m_ptMRUFloatPos; // most recent floating position
  564.  
  565.     CPtrArray m_arrBarID;   // bar IDs for bars contained within this one
  566.     CControlBar* m_pBar;    // bar which this refers to (transient)
  567.  
  568.     void Serialize(CArchive& ar, CDockState* pDockState);
  569.     BOOL LoadState(LPCTSTR lpszProfileName, int nIndex, CDockState* pDockState);
  570.     BOOL SaveState(LPCTSTR lpszProfileName, int nIndex);
  571. };
  572.  
  573. /////////////////////////////////////////////////////////////////////////////
  574. // CDockBar - used for docking
  575.  
  576. class CDockBar : public CControlBar
  577. {
  578.     DECLARE_DYNAMIC(CDockBar)
  579.  
  580. // Construction
  581. public:
  582.     CDockBar(BOOL bFloating = FALSE);   //true if attached to CMiniDockFrameWnd
  583.     BOOL Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID);
  584.  
  585. // Attributes
  586.     BOOL m_bFloating;
  587.  
  588.     virtual BOOL IsDockBar() const;
  589.     int GetDockedCount() const;
  590.     virtual int GetDockedVisibleCount() const;
  591.  
  592. // Operations
  593.     void DockControlBar(CControlBar* pBar, LPCRECT lpRect = NULL);
  594.     void ReDockControlBar(CControlBar* pBar, LPCRECT lpRect = NULL);
  595.     BOOL RemoveControlBar(CControlBar*, int nPosExclude = -1);
  596.     void RemovePlaceHolder(CControlBar* pBar);
  597.  
  598. // Implementation
  599. public:
  600.     virtual ~CDockBar();
  601. #ifdef _DEBUG
  602.     virtual void AssertValid() const;
  603.     virtual void Dump(CDumpContext& dc) const;
  604. #endif
  605.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  606.     virtual void DoPaint(CDC* pDC);
  607.  
  608.     // public implementation helpers
  609.     void GetBarInfo(CControlBarInfo* pInfo);
  610.     void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd);
  611.     int FindBar(CControlBar* pBar, int nPosExclude = -1);
  612.     void ShowAll(BOOL bShow);
  613.  
  614. protected:
  615.     CPtrArray m_arrBars;    // each element is a CControlBar
  616.     BOOL m_bLayoutQuery;
  617.     CRect m_rectLayout;
  618.  
  619.     CControlBar* GetDockedControlBar(int nPos) const;
  620.  
  621.     // implementation helpers
  622.     int Insert(CControlBar* pBar, CRect rect, CPoint ptMid);
  623.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  624.  
  625.     //{{AFX_MSG(CDockBar)
  626.     afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
  627.     afx_msg void OnNcPaint();
  628.     afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
  629.     afx_msg void OnPaint();
  630.     afx_msg LRESULT OnSizeParent(WPARAM, LPARAM);
  631.     //}}AFX_MSG
  632.     DECLARE_MESSAGE_MAP()
  633.  
  634.     friend class CMiniDockFrameWnd;
  635. };
  636.  
  637. class CMiniDockFrameWnd : public CMiniFrameWnd
  638. {
  639.     DECLARE_DYNCREATE(CMiniDockFrameWnd)
  640.  
  641. public:
  642. // Construction
  643.     CMiniDockFrameWnd();
  644.     virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
  645.  
  646. // Operations
  647.     virtual void RecalcLayout(BOOL bNotify = TRUE);
  648.  
  649. // Implementation
  650. public:
  651.     CDockBar m_wndDockBar;
  652.  
  653.     //{{AFX_MSG(CMiniFrameWnd)
  654.     afx_msg void OnClose();
  655.     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  656.     afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
  657.     //}}AFX_MSG
  658. #ifdef _MAC
  659.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  660. #endif
  661.     afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  662.     DECLARE_MESSAGE_MAP()
  663. };
  664.  
  665. /////////////////////////////////////////////////////////////////////////////
  666. // COleCntrFrameWnd
  667.  
  668. class COleIPFrameWnd;
  669.  
  670. class COleCntrFrameWnd : public CFrameWnd
  671. {
  672. // Constructor
  673. public:
  674.     COleCntrFrameWnd(COleIPFrameWnd* pInPlaceFrame);
  675.  
  676. // Implementation
  677. protected:
  678.     COleIPFrameWnd* m_pInPlaceFrame;
  679.     virtual void PostNcDestroy();
  680.  
  681. public:
  682.     virtual ~COleCntrFrameWnd();
  683.     virtual void RecalcLayout(BOOL bNotify = TRUE);
  684.     void OnIdleUpdateCmdUI();
  685. #ifdef _DEBUG
  686.     void AssertValid() const;
  687. #endif
  688. };
  689.  
  690. /////////////////////////////////////////////////////////////////////////////
  691. // COleControlLock
  692.  
  693. #ifdef __AFXDISP_H__
  694.  
  695. class COleControlLock
  696. {
  697. // Constructors
  698. public:
  699.     COleControlLock(REFCLSID clsid);
  700.  
  701. // Attributes
  702.     CLSID m_clsid;
  703.     LPCLASSFACTORY m_pClassFactory;
  704.     COleControlLock* m_pNextLock;
  705.  
  706. // Implementation
  707. public:
  708.     virtual ~COleControlLock();
  709. };
  710.  
  711. /////////////////////////////////////////////////////////////////////////////
  712. // CArchiveStream
  713.  
  714. class CArchiveStream : public IStream
  715. {
  716. public:
  717.     CArchiveStream(CArchive* pArchive);
  718.  
  719. // Implementation
  720.     CArchive* m_pArchive;
  721.  
  722.     STDMETHOD_(ULONG, AddRef)();
  723.     STDMETHOD_(ULONG, Release)();
  724.     STDMETHOD(QueryInterface)(REFIID, LPVOID*);
  725.  
  726.     STDMETHOD(Read)(void*, ULONG, ULONG*);
  727.     STDMETHOD(Write)(const void*, ULONG cb, ULONG*);
  728.     STDMETHOD(Seek)(LARGE_INTEGER, DWORD, ULARGE_INTEGER*);
  729.     STDMETHOD(SetSize)(ULARGE_INTEGER);
  730.     STDMETHOD(CopyTo)(LPSTREAM, ULARGE_INTEGER, ULARGE_INTEGER*,
  731.         ULARGE_INTEGER*);
  732.     STDMETHOD(Commit)(DWORD);
  733.     STDMETHOD(Revert)();
  734.     STDMETHOD(LockRegion)(ULARGE_INTEGER, ULARGE_INTEGER,DWORD);
  735.     STDMETHOD(UnlockRegion)(ULARGE_INTEGER, ULARGE_INTEGER, DWORD);
  736.     STDMETHOD(Stat)(STATSTG*, DWORD);
  737.     STDMETHOD(Clone)(LPSTREAM*);
  738. };
  739.  
  740. #endif // __AFX_DISP_H__
  741.  
  742. /////////////////////////////////////////////////////////////////////////////
  743. // CDialogTemplate
  744.  
  745. #ifndef _MAC
  746.  
  747. class CDialogTemplate
  748. {
  749. // Constructors
  750. public:
  751.     CDialogTemplate(const DLGTEMPLATE* pTemplate = NULL);
  752.     CDialogTemplate(HGLOBAL hGlobal);
  753.  
  754. // Attributes
  755.     BOOL HasFont() const;
  756.     BOOL SetFont(LPCTSTR lpFaceName, WORD nFontSize);
  757.     BOOL SetSystemFont(WORD nFontSize = 0);
  758.     BOOL GetFont(CString& strFaceName, WORD& nFontSize) const;
  759.     void GetSizeInDialogUnits(SIZE* pSize) const;
  760.     void GetSizeInPixels(SIZE* pSize) const;
  761.  
  762.     static BOOL AFX_CDECL GetFont(const DLGTEMPLATE* pTemplate,
  763.         CString& strFaceName, WORD& nFontSize);
  764.  
  765. // Operations
  766.     BOOL Load(LPCTSTR lpDialogTemplateID);
  767.     HGLOBAL Detach();
  768.  
  769. // Implementation
  770. public:
  771.     ~CDialogTemplate();
  772.  
  773.     HGLOBAL m_hTemplate;
  774.     DWORD m_dwTemplateSize;
  775.     BOOL m_bSystemFont;
  776.  
  777. protected:
  778.     static BYTE* AFX_CDECL GetFontSizeField(const DLGTEMPLATE* pTemplate);
  779.     static UINT AFX_CDECL GetTemplateSize(const DLGTEMPLATE* pTemplate);
  780.     BOOL SetTemplate(const DLGTEMPLATE* pTemplate, UINT cb);
  781. };
  782.  
  783. #endif //!_MAC
  784.  
  785. /////////////////////////////////////////////////////////////////////////////
  786. // WM_NOTIFY support
  787.  
  788. struct AFX_NOTIFY
  789. {
  790.     LRESULT* pResult;
  791.     NMHDR* pNMHDR;
  792. };
  793.  
  794. /////////////////////////////////////////////////////////////////////////////
  795. // Global implementation helpers
  796.  
  797. // window creation hooking
  798. void AFXAPI AfxHookWindowCreate(CWnd* pWnd);
  799. BOOL AFXAPI AfxUnhookWindowCreate();
  800. void AFXAPI AfxResetMsgCache();
  801.  
  802. // for backward compatibility to previous versions
  803. #define _AfxHookWindowCreate    AfxHookWindowCreate
  804. #define _AfxUnhookWindowCreate  AfxUnhookWindowCreate
  805.  
  806. // string helpers
  807. void AFXAPI AfxSetWindowText(HWND hWndCtrl, LPCTSTR lpszNew);
  808. int AFXAPI AfxLoadString(UINT nIDS, LPTSTR lpszBuf, UINT nMaxBuf = 256);
  809.  
  810. HDC AFXAPI AfxCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode);
  811.  
  812. void AFXAPI AfxGetModuleShortFileName(HINSTANCE hInst, CString& strShortName);
  813.  
  814. // Failure dialog helpers
  815. void AFXAPI AfxFailMaxChars(CDataExchange* pDX, int nChars);
  816. void AFXAPI AfxFailRadio(CDataExchange* pDX);
  817.  
  818. // DLL load helpers
  819. HINSTANCE AFXAPI AfxLoadDll(HINSTANCE& hInst, LPCSTR lpszDLL);
  820. HINSTANCE AFXAPI AfxLoadDll(HINSTANCE& hInst, LPCSTR lpszDLL,
  821.     FARPROC* pProcPtrs, LPCSTR lpszProcName);
  822.  
  823. /////////////////////////////////////////////////////////////////////////////
  824. // Global UNICODE<>ANSI translation helpers
  825.  
  826. LPDEVMODEW AFXAPI AfxDevModeA2W(LPDEVMODEW lpDevModeW, LPDEVMODEA lpDevModeA);
  827. LPDEVMODEA AFXAPI AfxDevModeW2A(LPDEVMODEA lpDevModeA, LPDEVMODEW lpDevModeW);
  828.  
  829. //
  830. // Using alloca as a parameter to a function results in the stack becoming
  831. // misaligned. Not a problem for VC++ as it special cases usage of alloca.
  832. //
  833.  
  834. #ifdef __BORLANDC__
  835.  
  836. #define DEVMODEW2A(lpw)\
  837.    (pBAfxConv = alloca(sizeof(DEVMODEA)+lpw->dmDriverExtra),\
  838.     ((lpw == NULL) ? NULL : AfxDevModeW2A((LPDEVMODEA)pBAfxConv, lpw)))
  839. #define DEVMODEA2W(lpa)\
  840.    (pBAfxConv = alloca(sizeof(DEVMODEW)+lpa->dmDriverExtra),\
  841.     ((lpa == NULL) ? NULL : AfxDevModeA2W((LPDEVMODEW)pBAfxConv, lpa)))
  842.  
  843. #else    // __BORLANDC__
  844.  
  845. #define DEVMODEW2A(lpw)\
  846.     ((lpw == NULL) ? NULL : AfxDevModeW2A((LPDEVMODEA)alloca(sizeof(DEVMODEA)+lpw->dmDriverExtra), lpw))
  847. #define DEVMODEA2W(lpa)\
  848.     ((lpa == NULL) ? NULL : AfxDevModeA2W((LPDEVMODEW)alloca(sizeof(DEVMODEW)+lpa->dmDriverExtra), lpa))
  849.  
  850. #endif   // __BORLANDC__
  851.  
  852. LPTEXTMETRICW AFXAPI AfxTextMetricA2W(LPTEXTMETRICW lptmW, LPTEXTMETRICA pltmA);
  853. LPTEXTMETRICA AFXAPI AfxTextMetricW2A(LPTEXTMETRICA lptmA, LPTEXTMETRICW pltmW);
  854.  
  855. #ifdef __BORLANDC__
  856.  
  857. #define TEXTMETRICW2A(lptmw)\
  858.    (pBAfxConv = alloca(sizeof(TEXTMETRICA)),\
  859.     ((lptmw == NULL) ? NULL : AfxTextMetricW2A((LPTEXTMETRICA)pBAfxConv, lptmw)))
  860. #define TEXTMETRICA2W(lptma)\
  861.    (pBAfxConv = alloca(sizeof(TEXTMETRICW)),\
  862.     ((lptma == NULL) ? NULL : AfxTextMetricA2W((LPTEXTMETRICW)pBAfxConv, lptma)))
  863.  
  864. #else    // __BORLANDC__
  865.  
  866. #define TEXTMETRICW2A(lptmw)\
  867.     ((lptmw == NULL) ? NULL : AfxTextMetricW2A((LPTEXTMETRICA)alloca(sizeof(TEXTMETRICA)), lptmw))
  868. #define TEXTMETRICA2W(lptma)\
  869.     ((lptma == NULL) ? NULL : AfxTextMetricA2W((LPTEXTMETRICW)alloca(sizeof(TEXTMETRICW)), lptma))
  870.  
  871. #endif   // __BORLANDC__
  872.  
  873. LPWSTR AFXAPI AfxA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars);
  874. LPSTR AFXAPI AfxW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars);
  875.  
  876. #ifdef __BORLANDC__
  877.  
  878. #define A2CW(lpa) (\
  879.     ((LPCSTR)lpa == NULL) ? NULL : (\
  880.         _convert = (strlen(lpa)+1),\
  881.       pBAfxConv = alloca(_convert*2),\
  882.         (LPCWSTR)AfxA2WHelper((LPWSTR)pBAfxConv, lpa, _convert)\
  883.     )\
  884. )
  885.  
  886. #define A2W(lpa) (\
  887.     ((LPCSTR)lpa == NULL) ? NULL : (\
  888.         _convert = (strlen(lpa)+1),\
  889.       pBAfxConv = alloca(_convert*2),\
  890.         AfxA2WHelper((LPWSTR)pBAfxConv, lpa, _convert)\
  891.     )\
  892. )
  893.  
  894. #define W2CA(lpw) (\
  895.     ((LPCWSTR)lpw == NULL) ? NULL : (\
  896.         _convert = (wcslen(lpw)+1)*2,\
  897.       pBAfxConv = alloca(_convert),\
  898.         (LPCSTR)AfxW2AHelper((LPSTR)pBAfxConv, lpw, _convert)\
  899.     )\
  900. )
  901.  
  902. #define W2A(lpw) (\
  903.     ((LPCWSTR)lpw == NULL) ? NULL : (\
  904.         _convert = (wcslen(lpw)+1)*2,\
  905.       pBAfxConv = alloca(_convert),\
  906.         AfxW2AHelper((LPSTR)pBAfxConv, lpw, _convert)\
  907.     )\
  908. )
  909.  
  910. #else // __BORLANDC__
  911.  
  912. #define A2CW(lpa) (\
  913.     ((LPCSTR)lpa == NULL) ? NULL : (\
  914.         _convert = (strlen(lpa)+1),\
  915.         (LPCWSTR)AfxA2WHelper((LPWSTR) alloca(_convert*2), lpa, _convert)\
  916.     )\
  917. )
  918.  
  919. #define A2W(lpa) (\
  920.     ((LPCSTR)lpa == NULL) ? NULL : (\
  921.         _convert = (strlen(lpa)+1),\
  922.         AfxA2WHelper((LPWSTR) alloca(_convert*2), lpa, _convert)\
  923.     )\
  924. )
  925.  
  926. #define W2CA(lpw) (\
  927.     ((LPCWSTR)lpw == NULL) ? NULL : (\
  928.         _convert = (wcslen(lpw)+1)*2,\
  929.         (LPCSTR)AfxW2AHelper((LPSTR) alloca(_convert), lpw, _convert)\
  930.     )\
  931. )
  932.  
  933. #define W2A(lpw) (\
  934.     ((LPCWSTR)lpw == NULL) ? NULL : (\
  935.         _convert = (wcslen(lpw)+1)*2,\
  936.         AfxW2AHelper((LPSTR) alloca(_convert), lpw, _convert)\
  937.     )\
  938. )
  939.  
  940. #endif   // __BORLANDC__
  941.  
  942. #ifdef __BORLANDC__
  943. #  ifndef _DEBUG
  944. #     define USES_CONVERSION void * pBAfxConv=0; int _convert;
  945. #  else
  946. #     define USES_CONVERSION void * pBAfxConv=0; int _convert = 0;
  947. #  endif
  948. #else    // __BORLANDC__
  949. #  ifndef _DEBUG
  950. #     define USES_CONVERSION int _convert; _convert
  951. #  else
  952. #     define USES_CONVERSION int _convert = 0;
  953. #  endif
  954. #endif   // __BORLANDC__
  955.  
  956. #ifdef __AFXDISP_H__
  957.  
  958. void AFXAPI AfxBSTR2CString(CString* pStr, BSTR bstr);
  959.  
  960. #if !defined(_UNICODE) && !defined(OLE2ANSI)
  961. BSTR AFXAPI AfxBSTR2ABSTR(BSTR bstrW);
  962. LPWSTR AFXAPI AfxTaskStringA2W(LPCSTR lpa);
  963. LPSTR AFXAPI AfxTaskStringW2A(LPCWSTR lpw);
  964. #endif
  965.  
  966. #define OLESTDDELIMOLE OLESTR("\\")
  967.  
  968. #if defined(_UNICODE)
  969. // in these cases the default (TCHAR) is the same as OLECHAR
  970.     #define DEVMODEOLE DEVMODEW
  971.     #define LPDEVMODEOLE LPDEVMODEW
  972.     #define TEXTMETRICOLE TEXTMETRICW
  973.     #define LPTEXTMETRICOLE LPTEXTMETRICW
  974.     inline size_t ocslen(LPCOLESTR x) { return wcslen(x); }
  975.     inline OLECHAR* ocscpy(LPOLESTR dest, LPCOLESTR src) { return wcscpy(dest, src); }
  976.     inline LPCOLESTR T2COLE(LPCTSTR lp) { return lp; }
  977.     inline LPCTSTR OLE2CT(LPCOLESTR lp) { return lp; }
  978.     inline LPOLESTR T2OLE(LPTSTR lp) { return lp; }
  979.     inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }
  980.     inline LPOLESTR TASKSTRINGT2OLE(LPOLESTR lp) { return lp; }
  981.     inline LPTSTR TASKSTRINGOLE2T(LPOLESTR lp) { return lp; }
  982.     inline LPDEVMODEW DEVMODEOLE2T(LPDEVMODEOLE lp) { return lp; }
  983.     inline LPDEVMODEOLE DEVMODET2OLE(LPDEVMODEW lp) { return lp; }
  984.     inline LPTEXTMETRICW TEXTMETRICOLE2T(LPTEXTMETRICOLE lp) { return lp; }
  985.     inline LPTEXTMETRICOLE TEXTMETRICT2OLE(LPTEXTMETRICW lp) { return lp; }
  986.     inline BSTR BSTR2TBSTR(BSTR bstr) { return bstr;}
  987. #elif defined(OLE2ANSI)
  988. // in these cases the default (TCHAR) is the same as OLECHAR
  989.     #define DEVMODEOLE DEVMODEA
  990.     #define LPDEVMODEOLE LPDEVMODEA
  991.     #define TEXTMETRICOLE TEXTMETRICA
  992.     #define LPTEXTMETRICOLE LPTEXTMETRICA
  993.     inline size_t ocslen(LPCOLESTR x) { return strlen(x); }
  994.     inline OLECHAR* ocscpy(LPOLESTR dest, LPCOLESTR src) { return strcpy(dest, src); }
  995.     inline LPCOLESTR T2COLE(LPCTSTR lp) { return lp; }
  996.     inline LPCTSTR OLE2CT(LPCOLESTR lp) { return lp; }
  997.     inline LPOLESTR T2OLE(LPTSTR lp) { return lp; }
  998.     inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }
  999.     inline LPOLESTR TASKSTRINGT2OLE(LPOLESTR lp) { return lp; }
  1000.     inline LPTSTR TASKSTRINGOLE2T(LPOLESTR lp) { return lp; }
  1001.     inline LPDEVMODE DEVMODEOLE2T(LPDEVMODEOLE lp) { return lp; }
  1002.     inline LPDEVMODEOLE DEVMODET2OLE(LPDEVMODE lp) { return lp; }
  1003.     inline LPTEXTMETRIC TEXTMETRICOLE2T(LPTEXTMETRICOLE lp) { return lp; }
  1004.     inline LPTEXTMETRICOLE TEXTMETRICT2OLE(LPTEXTMETRIC lp) { return lp; }
  1005.     inline BSTR BSTR2TBSTR(BSTR bstr) { return bstr; }
  1006. #else
  1007.     #define DEVMODEOLE DEVMODEW
  1008.     #define LPDEVMODEOLE LPDEVMODEW
  1009.     #define TEXTMETRICOLE TEXTMETRICW
  1010.     #define LPTEXTMETRICOLE LPTEXTMETRICW
  1011.     inline size_t ocslen(LPCOLESTR x) { return wcslen(x); }
  1012.     inline OLECHAR* ocscpy(LPOLESTR dest, LPCOLESTR src) { return wcscpy(dest, src); }
  1013.     #define T2COLE(lpa) A2CW(lpa)
  1014.     #define T2OLE(lpa) A2W(lpa)
  1015.     #define OLE2CT(lpo) W2CA(lpo)
  1016.     #define OLE2T(lpo) W2A(lpo)
  1017.     #define TASKSTRINGT2OLE(lpa)    AfxTaskStringA2W(lpa)
  1018.     #define TASKSTRINGOLE2T(lpo) AfxTaskStringW2A(lpo)
  1019.     #define DEVMODEOLE2T(lpo) DEVMODEW2A(lpo)
  1020.     #define DEVMODET2OLE(lpa) DEVMODEA2W(lpa)
  1021.     #define TEXTMETRICOLE2T(lptmw) TEXTMETRICW2A(lptmw)
  1022.     #define TEXTMETRICT2OLE(lptma) TEXTMETRICA2W(lptma)
  1023.     #define BSTR2TBSTR(bstr) AfxBSTR2ABSTR(bstr)
  1024. #endif
  1025.  
  1026. #ifdef _UNICODE
  1027.     #define T2A W2A
  1028.     #define A2T A2W
  1029.     #define T2W(x)  (x)
  1030.     #define W2T(x)  (x)
  1031. #else
  1032.     #define T2W A2W
  1033.     #define W2T W2A
  1034.     #define T2A(x)  (x)
  1035.     #define A2T(x)  (x)
  1036. #endif
  1037.  
  1038. #endif //__AFXDISP_H__
  1039.  
  1040. /////////////////////////////////////////////////////////////////////////////
  1041.  
  1042. #ifdef _AFX_PACKING
  1043. #pragma pack(pop)
  1044. #endif
  1045.  
  1046. #undef AFX_DATA
  1047. #define AFX_DATA
  1048.  
  1049. #ifdef _AFX_MINREBUILD
  1050. #pragma component(minrebuild, on)
  1051. #endif
  1052. #ifndef _AFX_FULLTYPEINFO
  1053. #pragma component(mintypeinfo, off)
  1054. #endif
  1055.  
  1056. #endif // __AFXPRIV_H__
  1057.  
  1058. /////////////////////////////////////////////////////////////////////////////
  1059.