Annotation of mstools/mfc/include/afxole.h, revision 1.1

1.1     ! root        1: // Microsoft Foundation Classes C++ library. 
        !             2: // Copyright (C) 1992 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 Microsoft 
        !             7: // QuickHelp documentation provided with the library. 
        !             8: // See these sources for detailed information regarding the 
        !             9: // Microsoft Foundation Classes product. 
        !            10: 
        !            11:  
        !            12: #ifndef __AFXOLE_H__
        !            13: #define __AFXOLE_H__
        !            14: 
        !            15: /////////////////////////////////////////////////////////////////////////////
        !            16: // Classes declared in this file
        !            17: 
        !            18:        //CException
        !            19:                class COleException;    // caught by client
        !            20: 
        !            21: // Client side of linking and embedding
        !            22:        class COleClientItem;       // embedded ole object
        !            23:        class COleClientDoc;        // a document containing COleClientItems
        !            24: 
        !            25: // Server (/provider) side of linking and embedding
        !            26:        class COleServerItem;       // embedded ole object
        !            27:        class COleServerDoc;        // server document
        !            28:        class COleServer;           // server application
        !            29: 
        !            30: /////////////////////////////////////////////////////////////////////////////
        !            31: // Make sure 'afxwin.h' is included first
        !            32: #ifndef __AFXWIN_H__
        !            33: #include "afxwin.h"
        !            34: #endif
        !            35: 
        !            36: #define SERVERONLY  /* use smaller server version of OLEOBJECT VTable */
        !            37: #include "ole.h"
        !            38: 
        !            39: #define OLE_MAXNAMESIZE     256         /* 255 real characters */
        !            40: 
        !            41: /////////////////////////////////////////////////////////////////////////////
        !            42: // COleException - something going wrong
        !            43: 
        !            44: class COleException : public CException
        !            45: {
        !            46:        DECLARE_DYNAMIC(COleException)
        !            47: public:
        !            48:        OLESTATUS   m_status;
        !            49:        COleException(OLESTATUS status);
        !            50: 
        !            51:        static  OLESTATUS   Process(CException*);   // helper
        !            52: };
        !            53: 
        !            54: void    AfxThrowOleException(OLESTATUS status);
        !            55: 
        !            56: /////////////////////////////////////////////////////////////////////////////
        !            57: // User interface helper functions
        !            58: 
        !            59: void AfxOleSetEditMenu(COleClientItem* pClient, CMenu* pMenu,
        !            60:        UINT iMenuItem, UINT nIDVerbMin);
        !            61: BOOL AfxOleInsertDialog(CString& name);
        !            62: BOOL AfxOleLinksDialog(COleClientDoc* pDoc);
        !            63: 
        !            64: //////////////////////////////////////////////////////////////////////////////
        !            65: // COleClientItem - Client view of an OLEOBJECT + OLECLIENT for callbacks
        !            66: 
        !            67: class COleClientItem : public CObject
        !            68: {
        !            69: // Implementation
        !            70: protected:
        !            71:        OLECLIENT   m_oleClient;        // must be first member variable
        !            72: public: // in case you want direct access
        !            73:        LPOLEOBJECT m_lpObject;
        !            74: protected:
        !            75:        OLESTATUS   m_lastStatus;
        !            76:        COleClientDoc* m_pDocument;
        !            77: 
        !            78:        DECLARE_DYNAMIC(COleClientItem)
        !            79: 
        !            80: // Constructors
        !            81: public:
        !            82:        COleClientItem(COleClientDoc* pContainerDoc);
        !            83:        ~COleClientItem();
        !            84: 
        !            85:        // create from the clipboard
        !            86:        BOOL    CreateFromClipboard(LPCSTR lpszItemName,
        !            87:                                OLEOPT_RENDER renderopt = olerender_draw,
        !            88:                                OLECLIPFORMAT cfFormat = 0);
        !            89:        BOOL    CreateStaticFromClipboard(LPCSTR lpszItemName,
        !            90:                                OLEOPT_RENDER renderopt = olerender_draw,
        !            91:                                OLECLIPFORMAT cfFormat = 0);
        !            92:        BOOL    CreateLinkFromClipboard(LPCSTR lpszItemName,
        !            93:                                OLEOPT_RENDER renderopt = olerender_draw,
        !            94:                                OLECLIPFORMAT cfFormat = 0);
        !            95: 
        !            96:        // create from a protocol name (Insert New Object dialog)
        !            97:        BOOL    CreateNewObject(LPCSTR lpszClass, LPCSTR lpszItemName,
        !            98:                                OLEOPT_RENDER renderopt = olerender_draw,
        !            99:                                OLECLIPFORMAT cfFormat = 0);
        !           100:        // special create for invisible
        !           101:        BOOL    CreateInvisibleObject(LPCSTR lpszClass, LPCSTR lpszItemName,
        !           102:                                OLEOPT_RENDER renderopt = olerender_draw,
        !           103:                                OLECLIPFORMAT cfFormat = 0, BOOL bActivate = FALSE);
        !           104: 
        !           105:        // create a copy
        !           106:        BOOL    CreateCloneFrom(COleClientItem* pObject, LPCSTR lpszItemName);
        !           107: 
        !           108: // General Attributes
        !           109:        OLESTATUS GetLastStatus() const;
        !           110:        UINT    GetType();  // OT_LINK, OT_EMBEDDED or OT_STATIC
        !           111:        CString GetName();
        !           112: 
        !           113:        BOOL    GetSize(LPPOINT lpSize);    // return FALSE if BLANK
        !           114:        BOOL    GetBounds(LPRECT lpBounds); // return FALSE if BLANK
        !           115: 
        !           116:        BOOL    IsOpen();                   // currently open on server side
        !           117: 
        !           118:        // Data access
        !           119:        OLECLIPFORMAT EnumFormats(OLECLIPFORMAT nFormat) const;
        !           120:        HANDLE  GetData(OLECLIPFORMAT nFormat, BOOL& bMustDelete);
        !           121:        void    SetData(OLECLIPFORMAT nFormat, HANDLE hData);
        !           122:        void    RequestData(OLECLIPFORMAT nFormat);
        !           123: 
        !           124:        // Other rare access information
        !           125:        BOOL    IsEqual(COleClientItem* pObject);
        !           126:        HANDLE  GetLinkFormatData();        // internal use
        !           127:        COleClientDoc* GetDocument() const; // return container
        !           128: 
        !           129:        // global state - if anyone waiting for release => not normal operations
        !           130:        static BOOL InWaitForRelease();
        !           131: 
        !           132:        // Helpers for checking clipboard data availability
        !           133:        static BOOL CanPaste(OLEOPT_RENDER renderopt = olerender_draw,
        !           134:                                OLECLIPFORMAT cfFormat = 0);
        !           135:        static BOOL CanPasteLink(OLEOPT_RENDER renderopt = olerender_draw,
        !           136:                                OLECLIPFORMAT cfFormat = 0);
        !           137: 
        !           138: // Attributes that apply to Linked Objects only
        !           139: 
        !           140:        // Link options are rarely changed (except through Links dialog)
        !           141:        OLEOPT_UPDATE GetLinkUpdateOptions();
        !           142:        void    SetLinkUpdateOptions(OLEOPT_UPDATE updateOpt);
        !           143: 
        !           144: // General Operations
        !           145:        // Clean up
        !           146:        void    Release();              // detach (close if needed)
        !           147:        void    Delete();               // get rid of it then detach
        !           148: 
        !           149:        // Drawing
        !           150:        BOOL    Draw(CDC *pDC, LPRECT lpBounds, LPRECT lpWBounds,
        !           151:                                CDC* pFormatDC);
        !           152: 
        !           153:        // Activation
        !           154:        void    Activate(UINT nVerb, BOOL bShow = TRUE, BOOL bTakeFocus = TRUE,
        !           155:                                CWnd * pWndContainer = NULL, LPRECT lpBounds = NULL);
        !           156: 
        !           157:        // more advanced operations
        !           158:        void    Rename(LPCSTR lpszNewname);    // call to rename item
        !           159:        void    CopyToClipboard();
        !           160:        void    SetTargetDevice(HANDLE hData);
        !           161:                        // handle to an OLETARGETDEVICE
        !           162: 
        !           163: // Operations that apply to Embedded Objects only
        !           164:        void    SetHostNames(LPCSTR lpszHost, LPCSTR lpszHostObj);
        !           165:        void    SetBounds(LPRECT lpRect);
        !           166:        void    SetColorScheme(LPLOGPALETTE lpLogPalette);
        !           167: 
        !           168: // Operations that apply to Linked Objects only
        !           169:        void    UpdateLink();               // make up-to-date
        !           170:        void    CloseLink();                // close connection
        !           171:                                                                                // can be used for embedded (rare)
        !           172:        void    ReconnectLink();            // reactivate connection
        !           173: 
        !           174:        virtual BOOL FreezeLink(LPCSTR lpszFrozenName);
        !           175:                                // link -> embedded
        !           176: 
        !           177: 
        !           178: // Overridables (notifications of OLECLIENT)
        !           179: protected:
        !           180:        // standard notifications from the server telling you about
        !           181:        //    changes to the item
        !           182: 
        !           183:        // notifications you must implement
        !           184:        virtual void OnChange(OLE_NOTIFICATION wNotification) = 0;
        !           185:                        // Change due to link update, document save or document close
        !           186: 
        !           187:        // notifications you can re-implement (not necessary)
        !           188:        virtual void OnRenamed();           // document has been renamed
        !           189:        virtual void OnRelease();
        !           190: 
        !           191:        // low level notification hook from the OLE DLLs
        !           192:        virtual int ClientCallBack(OLE_NOTIFICATION wNotification);
        !           193: 
        !           194: // Overridables for User Interface and Error traps
        !           195: protected:
        !           196:        // deciding what are exceptions and what are ok for creation
        !           197:        virtual BOOL CheckCreate(OLESTATUS status);
        !           198:        virtual void CheckAsync(OLESTATUS status);
        !           199:        virtual void CheckGeneral(OLESTATUS status);
        !           200: 
        !           201:        virtual void WaitForServer();
        !           202: public:
        !           203:        virtual BOOL ReportError(OLESTATUS status);
        !           204: 
        !           205: // Implementation
        !           206: #ifdef _DEBUG
        !           207: public:
        !           208:        virtual void AssertValid() const;
        !           209:        virtual void Dump(CDumpContext& dc) const;
        !           210: #endif
        !           211: 
        !           212: protected:
        !           213:        static int cWaitForRelease;
        !           214: public:
        !           215:        virtual void Serialize(CArchive& ar);   // from CObject for storing only
        !           216:        static COleClientItem* FromLp(LPOLECLIENT lpClient);
        !           217: 
        !           218:        friend struct _afxOleClientItemImplementation;
        !           219:        friend class COleClientDoc;
        !           220: };
        !           221: 
        !           222: 
        !           223: //////////////////////////////////////////////////////////////////////////////
        !           224: // COleClientDoc - registered client document
        !           225: 
        !           226: class COleClientDoc : public CObject
        !           227: {
        !           228:        DECLARE_DYNAMIC(COleClientDoc)
        !           229: 
        !           230: // Constructors and Destructors
        !           231: public:
        !           232:        COleClientDoc();
        !           233:        ~COleClientDoc();
        !           234: 
        !           235:        BOOL    Register(LPCSTR lpszClass, LPCSTR lpszDoc);
        !           236:        void    Revoke();           // called by destructor
        !           237: 
        !           238: // Attributes
        !           239:        BOOL    IsOpen() const;     // TRUE if successfully registered
        !           240: 
        !           241: // Operations (notify the global registry)
        !           242:        void    NotifyRename(LPCSTR lpszNewName);
        !           243:                                                                // call this after document is renamed
        !           244:        void    NotifyRevert();     // call this after document reverts to original
        !           245:        void    NotifySaved();      // call this after document is saved
        !           246: 
        !           247: // Overridables you must implement for yourself
        !           248: 
        !           249:        // iteration
        !           250:        POSITION GetStartPosition() const
        !           251:                                { return NULL; }    // start of iteration
        !           252:        virtual COleClientItem* GetNextItem(POSITION& rPosition,
        !           253:                BOOL* pIsSelected) = 0;
        !           254:                        // return next item, update BOOL according to selection
        !           255: 
        !           256: // Overridables you do not have to implement
        !           257: protected:
        !           258:        virtual void CheckGeneral(OLESTATUS status) const;
        !           259: 
        !           260: // Implementation
        !           261: public:
        !           262:        LHCLIENTDOC m_lhClientDoc;
        !           263: 
        !           264: #ifdef _DEBUG
        !           265: public:
        !           266:        virtual void AssertValid() const;
        !           267:        virtual void Dump(CDumpContext& dc) const;
        !           268: #endif
        !           269: };
        !           270: 
        !           271: /////////////////////////////////////////////////////////////////////////////
        !           272: /////////////////////////////////////////////////////////////////////////////
        !           273: // COleServerItem - Server view of an OLEOBJECT + OLECLIENT
        !           274: 
        !           275: 
        !           276: class COleServerItem : public CObject
        !           277: {
        !           278: protected:
        !           279:        // NOTE: EVERYTHING in this class is protected - since everything
        !           280:        //   in this class is designed for implementing an OLE server.
        !           281:        // Requests will come from OLE Clients through non-C++ mechanisms,
        !           282:        //   which will result in virtual functions in this class being
        !           283:        //   called.
        !           284: 
        !           285: // Implementation
        !           286:        OLEOBJECT   m_oleObject;        // must be first member variable
        !           287:        LPOLECLIENT m_lpClient;
        !           288:        DECLARE_DYNAMIC(COleServerItem)
        !           289: 
        !           290: // Constructors
        !           291:        COleServerItem();
        !           292:        ~COleServerItem();
        !           293: 
        !           294: // Public Attributes
        !           295: public:
        !           296:        COleServerDoc* GetDocument() const; // return container
        !           297: 
        !           298: // Implementation Attributes
        !           299: protected:
        !           300:        COleServerDoc* m_pDocument;
        !           301:        HPALETTE m_hPalette;
        !           302:        CRect   m_rectBounds;       // HIMETRIC ! -  if IsRectNull => not set yet
        !           303: 
        !           304:        BOOL    IsConnected();  // TRUE if connected to client
        !           305: 
        !           306: // Operations for notifying client
        !           307: public:
        !           308:        int     NotifyClient(OLE_NOTIFICATION wNotification);
        !           309:        void    NotifyChanged();        // call this after you change item
        !           310: 
        !           311:        void    BeginRevoke();          // revoke client connection
        !           312: 
        !           313: // Overridables you must implement for yourself
        !           314:        // Raw data access
        !           315:        virtual void Serialize(CArchive& ar) = 0; // for Native data
        !           316: 
        !           317: protected:
        !           318:        // User interface
        !           319:        virtual OLESTATUS OnShow(BOOL bTakeFocus) = 0;
        !           320: 
        !           321:        // Drawing for metafile format (return FALSE if not supported)
        !           322:        virtual BOOL OnDraw(CMetaFileDC* pDC) = 0;
        !           323:                        // draw to boundaries set in m_rectBounds
        !           324: 
        !           325: // Overridables you may want to implement yourself
        !           326:        virtual OLESTATUS OnRelease();
        !           327:                                                        // do extra cleanup
        !           328:        virtual OLESTATUS OnExtraVerb(UINT nVerb);
        !           329:                                                        // do extra verbs - default is not implemented
        !           330:        virtual OLESTATUS OnSetTargetDevice(LPOLETARGETDEVICE lpTargetDevice);
        !           331:                                                        // track target device changes - default ignores
        !           332:        virtual OLESTATUS OnSetBounds(LPRECT lpRect);
        !           333:                                                        // track size changes - default updates m_rectBounds
        !           334: 
        !           335:        // standard get data as text
        !           336:        virtual BOOL OnGetTextData(CString& rStringReturn);
        !           337:                                                        // default to not supported
        !           338: 
        !           339:        // more advanced implementation
        !           340:        virtual OLESTATUS OnGetData(OLECLIPFORMAT nFormat, LPHANDLE lphReturn);
        !           341: 
        !           342: public: // may be called for direct clipboard access too
        !           343:        virtual HANDLE GetMetafileData();
        !           344:                                                        // calls 'OnDraw(...)'
        !           345:        virtual HANDLE GetNativeData();
        !           346:                                                        // calls 'Serialize(...)'
        !           347: 
        !           348: protected:
        !           349: // Overridables you do not have to implement
        !           350:        virtual LPVOID OnQueryProtocol(LPCSTR lpszProtocol) const;
        !           351:                                                        // default handles "StdFileEditing"
        !           352:        virtual OLESTATUS OnSetColorScheme(LPLOGPALETTE lpLogPalette);
        !           353:                                                        // default updates m_hPalette
        !           354:        virtual OLECLIPFORMAT OnEnumFormats(OLECLIPFORMAT nFormat) const;
        !           355:                                                        // default handles native + std. formats
        !           356:        virtual OLESTATUS OnSetData(OLECLIPFORMAT nFormat, HANDLE hData);
        !           357:                                                        // default routes to GetNativeData
        !           358:        virtual OLESTATUS OnDoVerb(UINT nVerb, BOOL bShow, BOOL bTakeFocus);
        !           359:                                                        // default routes to OnShow &/or OnExtraVerb
        !           360: 
        !           361: // Implementation
        !           362: #ifdef _DEBUG
        !           363: public:
        !           364:        virtual void AssertValid() const;
        !           365:        virtual void Dump(CDumpContext& dc) const;
        !           366: #endif
        !           367: protected:
        !           368:        static COleServerItem* FromLp(LPOLEOBJECT lpObject);
        !           369:        friend struct _afxOleServerItemImplementation;
        !           370:        friend class COleServerDoc;
        !           371:        friend struct _afxOleServerDocImplementation;
        !           372: };
        !           373: 
        !           374: 
        !           375: //////////////////////////////////////////////////////////////////////////////
        !           376: // COleServerDoc - registered server document containing COleServerItems
        !           377: 
        !           378: class COleServerDoc : public CObject
        !           379: {
        !           380: protected:
        !           381: // Implementation
        !           382:        OLESERVERDOC m_oleServerDoc;        // must be first member variable
        !           383:        LHSERVERDOC m_lhServerDoc;          // registered handle
        !           384:        BOOL    m_bWaiting;
        !           385:        DECLARE_DYNAMIC(COleServerDoc)
        !           386: 
        !           387: // Constructors and Destructors
        !           388: public:
        !           389:        COleServerDoc();
        !           390:        ~COleServerDoc();
        !           391: 
        !           392: // Special construction routines if opened by user (or linked file)
        !           393:        BOOL    Register(COleServer* pServer, LPCSTR lpszDoc);
        !           394:                                                        // call if opened by user (eg: File Open)
        !           395:        void    Revoke();       // Revoke and wait to finish
        !           396: 
        !           397: // Attributes
        !           398:        COleServer* m_pServer;
        !           399:        HPALETTE m_hPalette;
        !           400: 
        !           401:        BOOL    IsOpen() const;     // TRUE if successfully registered
        !           402: 
        !           403: // Operations
        !           404:        // changes to the entire document (automatically notifies clients)
        !           405:        void    NotifyRename(LPCSTR lpszNewName);
        !           406:        void    NotifyRevert();
        !           407:        void    NotifySaved();
        !           408: 
        !           409:        // specific notifications for all clients
        !           410:        void    NotifyAllClients(OLE_NOTIFICATION wNotification);
        !           411:        void    NotifyClosed();         // call this after you close document
        !           412:        void    NotifyChanged();        // call this after you change some
        !           413:                                                                        //   global attibute like doc dimensions
        !           414: 
        !           415: protected:
        !           416: // Overridables you must implement for yourself
        !           417:        virtual COleServerItem* OnGetDocument() = 0;
        !           418:                                // return new item representing entire document
        !           419:        virtual COleServerItem* OnGetItem(LPCSTR lpszItemName) = 0;
        !           420:                                // return new item for the named item
        !           421: 
        !           422:        // iteration
        !           423:        POSITION GetStartPosition() const
        !           424:                                { return NULL; }    // start of iteration
        !           425:        virtual COleServerItem* GetNextItem(POSITION& rPosition) = 0;
        !           426:                                // return next item in iteration
        !           427: 
        !           428: // Overridables you may want to implement yourself
        !           429:        virtual OLESTATUS OnSave();
        !           430:        virtual OLESTATUS OnClose();
        !           431:        virtual OLESTATUS OnExecute(LPVOID lpCommands);
        !           432:        virtual OLESTATUS OnSetDocDimensions(LPRECT lpRect);
        !           433: 
        !           434: // Overridables you do not have to implement
        !           435:        virtual OLESTATUS OnSetHostNames(LPCSTR lpszHost, LPCSTR lpszHostObj);
        !           436:        virtual OLESTATUS OnSetColorScheme(LPLOGPALETTE lpLogPalette);
        !           437:        virtual OLESTATUS OnRelease();
        !           438: 
        !           439: // Overridables for Error traps
        !           440: protected:
        !           441:        virtual void CheckAsync(OLESTATUS status);
        !           442: 
        !           443: // Implementation
        !           444: protected:
        !           445:        static COleServerDoc* FromLp(LPOLESERVERDOC lpServerDoc);
        !           446:        void    AddItem(COleServerItem* pItem, LPOLECLIENT lpClient);
        !           447: 
        !           448:        // Used in implementation (opened by COleServer)
        !           449:        OLESTATUS   BeginRevoke();  // Revoke but don't wait
        !           450: 
        !           451: #ifdef _DEBUG
        !           452: public:
        !           453:        virtual void AssertValid() const;
        !           454:        virtual void Dump(CDumpContext& dc) const;
        !           455: #endif
        !           456:        friend struct _afxOleServerDocImplementation;
        !           457:        friend class COleServer;
        !           458:        friend struct _afxOleServerImplementation;
        !           459: };
        !           460: 
        !           461: //////////////////////////////////////////////////////////////////////////////
        !           462: // COleServer - registered server application
        !           463: 
        !           464: class COleServer : public CObject
        !           465: {
        !           466: protected:
        !           467: // Implementation
        !           468:        OLESERVER m_oleServer;          // must be first member variable
        !           469:        LHSERVER m_lhServer;            // registered handle
        !           470:        DECLARE_DYNAMIC(COleServer)
        !           471: 
        !           472: // Constructors and Destructors
        !           473: public:
        !           474:        COleServer(BOOL bLaunchEmbedded);
        !           475:        ~COleServer();
        !           476: 
        !           477:        BOOL    Register(LPCSTR lpszClass, BOOL bMultiInstance);
        !           478:        void    BeginRevoke();
        !           479: 
        !           480: // Attributes
        !           481:        BOOL    IsOpen() const;         // TRUE if successfully registered
        !           482:        BOOL    m_bLaunchEmbedded;
        !           483: 
        !           484: // Overridables you must implement for yourself
        !           485: protected:
        !           486:        // for those supporting embedding
        !           487:        virtual COleServerDoc* OnCreateDoc(LPCSTR lpszClass,
        !           488:                                LPCSTR lpszDoc) = 0;
        !           489:        virtual COleServerDoc* OnEditDoc(LPCSTR lpszClass,
        !           490:                                LPCSTR lpszDoc) = 0;
        !           491: 
        !           492: // Overridables you may want to implement yourself
        !           493:        // for those supporting links
        !           494:        virtual COleServerDoc* OnOpenDoc(LPCSTR lpszDoc);
        !           495:        // for those supporting embedding from templates
        !           496:        virtual COleServerDoc* OnCreateDocFromTemplate(LPCSTR lpszClass,
        !           497:                                LPCSTR lpszDoc, LPCSTR lpszTemplate);
        !           498:        // for those supporting DDE execute commands
        !           499:        virtual OLESTATUS OnExecute(LPVOID lpCommands);
        !           500: 
        !           501: // Overridables you do not have to implement
        !           502:        virtual OLESTATUS OnExit();     // default to BeginRevoke
        !           503:        virtual OLESTATUS OnRelease();  // default to cleanup
        !           504: 
        !           505: // Implementation support of managing # of open documents
        !           506: protected:
        !           507:        int     m_cOpenDocuments;
        !           508:        void    AddDocument(COleServerDoc* pDoc, LHSERVERDOC lhServerDoc);
        !           509:        void    RemoveDocument(COleServerDoc* pDoc);
        !           510: 
        !           511: // Implementation
        !           512: #ifdef _DEBUG
        !           513: public:
        !           514:        virtual void AssertValid() const;
        !           515:        virtual void Dump(CDumpContext& dc) const;
        !           516: #endif
        !           517: protected:
        !           518:        static COleServer * FromLp(LPOLESERVER lpServer);
        !           519:        friend class COleServerDoc;
        !           520: 
        !           521:        friend struct _afxOleServerImplementation;
        !           522: };
        !           523: 
        !           524: // Helper to register server in case of no .REG file loaded
        !           525: BOOL AfxOleRegisterServerName(LPCSTR lpszClass, LPCSTR lpszLocalClassName);
        !           526: 
        !           527: //////////////////////////////////////////////////////////////////////////////
        !           528: // Helper class for implementation
        !           529: 
        !           530: class CSharedFile : public CMemFile
        !           531: {
        !           532:        DECLARE_DYNAMIC(CSharedFile)
        !           533: 
        !           534: public:
        !           535: // Constructors
        !           536:        CSharedFile(UINT nAllocFlags = GMEM_DDESHARE, UINT nGrowBytes = 1024);
        !           537:        ~CSharedFile();
        !           538: 
        !           539: // Attributes
        !           540:        HANDLE  Detach();
        !           541:        void    SetHandle(HANDLE hGlobalMemory);
        !           542: 
        !           543: // Special implementation
        !           544: protected:
        !           545:        virtual BYTE FAR* Alloc(UINT nBytes);
        !           546:        virtual BYTE FAR* Realloc(BYTE FAR* lpMem, UINT nBytes);
        !           547:        virtual void Free(BYTE FAR* lpMem);
        !           548: 
        !           549:        UINT    m_nAllocFlags;
        !           550:        HANDLE  m_hGlobalMemory;
        !           551: };
        !           552: 
        !           553: //////////////////////////////////////////////////////////////////////////////
        !           554: // Inlines
        !           555: 
        !           556: // for client classes
        !           557: inline OLESTATUS COleClientItem::GetLastStatus() const
        !           558:        { return m_lastStatus; }
        !           559: inline COleClientDoc* COleClientItem::GetDocument() const
        !           560:        { return m_pDocument; }
        !           561: inline OLECLIPFORMAT COleClientItem::EnumFormats(OLECLIPFORMAT nFormat) const
        !           562:        { return ::OleEnumFormats(m_lpObject, nFormat); }
        !           563: inline BOOL COleClientDoc::IsOpen() const
        !           564:        { return m_lhClientDoc != NULL; }
        !           565: 
        !           566: // for server classes
        !           567: inline COleServerDoc* COleServerItem::GetDocument() const
        !           568:        { return m_pDocument; }
        !           569: inline BOOL COleServerItem::IsConnected()
        !           570:        { return m_lpClient != NULL; }
        !           571: inline void COleServerItem::NotifyChanged()
        !           572:        { NotifyClient(OLE_CHANGED); }
        !           573: 
        !           574: inline BOOL COleServerDoc::IsOpen() const
        !           575:        { return m_lhServerDoc != NULL; }
        !           576: inline void COleServerDoc::NotifyChanged()
        !           577:        { NotifyAllClients(OLE_CHANGED); }
        !           578: inline void COleServerDoc::NotifyClosed()
        !           579:        { NotifyAllClients(OLE_CLOSED); }
        !           580: 
        !           581: inline BOOL COleServer::IsOpen() const
        !           582:        { return m_lhServer != NULL; }
        !           583: 
        !           584: //////////////////////////////////////////////////////////////////////////////
        !           585: 
        !           586: #endif //__AFXOLE_H__

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.