home *** CD-ROM | disk | FTP | other *** search
- // lst42Doc.cpp : implementation of the CLst42Doc class
- //
-
- #include "stdafx.h"
- #include "lst42.h"
-
- #include "lst42Doc.h"
- #include "SrvrItem.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst42Doc
-
- IMPLEMENT_DYNCREATE(CLst42Doc, COleServerDoc)
-
- BEGIN_MESSAGE_MAP(CLst42Doc, COleServerDoc)
- //{{AFX_MSG_MAP(CLst42Doc)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- BEGIN_DISPATCH_MAP(CLst42Doc, COleServerDoc)
- //{{AFX_DISPATCH_MAP(CLst42Doc)
- DISP_FUNCTION(CLst42Doc, "GetMachineName", GetMachineName, VT_BSTR, VTS_NONE)
- //}}AFX_DISPATCH_MAP
- END_DISPATCH_MAP()
-
- // Note: we add support for IID_ILst42 to support typesafe binding
- // from VBA. This IID must match the GUID that is attached to the
- // dispinterface in the .ODL file.
-
- // {06B70DA2-1818-11D0-A6AD-00AA00602553}
- static const IID IID_ILst42 =
- { 0x6b70da2, 0x1818, 0x11d0, { 0xa6, 0xad, 0x0, 0xaa, 0x0, 0x60, 0x25, 0x53 } };
-
- BEGIN_INTERFACE_MAP(CLst42Doc, COleServerDoc)
- INTERFACE_PART(CLst42Doc, IID_ILst42, Dispatch)
- END_INTERFACE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst42Doc construction/destruction
-
- CLst42Doc::CLst42Doc()
- {
- // Use OLE compound files
- EnableCompoundFile();
-
- // TODO: add one-time construction code here
-
- EnableAutomation();
-
- AfxOleLockApp();
- }
-
- CLst42Doc::~CLst42Doc()
- {
- AfxOleUnlockApp();
- }
-
- BOOL CLst42Doc::OnNewDocument()
- {
- if (!COleServerDoc::OnNewDocument())
- return FALSE;
-
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
-
- return TRUE;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst42Doc server implementation
-
- COleServerItem* CLst42Doc::OnGetEmbeddedItem()
- {
- // OnGetEmbeddedItem is called by the framework to get the COleServerItem
- // that is associated with the document. It is only called when necessary.
-
- CLst42SrvrItem* pItem = new CLst42SrvrItem(this);
- ASSERT_VALID(pItem);
- return pItem;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst42Doc serialization
-
- void CLst42Doc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
- }
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst42Doc diagnostics
-
- #ifdef _DEBUG
- void CLst42Doc::AssertValid() const
- {
- COleServerDoc::AssertValid();
- }
-
- void CLst42Doc::Dump(CDumpContext& dc) const
- {
- COleServerDoc::Dump(dc);
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CLst42Doc commands
-
- BSTR CLst42Doc::GetMachineName()
- {
- CString strResult;
- ULONG ulLen;
-
- char *lpName;
-
- lpName = new char[MAX_PATH];
- ulLen = MAX_PATH;
-
- GetComputerName(lpName, &ulLen );
- strResult = lpName;
- delete [] lpName;
-
- return strResult.AllocSysString();
- }
-