Index: /trunk/MFCtooling/TestProg/ChildFrm.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/ChildFrm.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/ChildFrm.cpp	(revision 32)
@@ -0,0 +1,59 @@
+// ChildFrm.cpp : implementation of the CChildFrame class
+//
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "ChildFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CChildFrame
+
+IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
+
+BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
+END_MESSAGE_MAP()
+
+
+// CChildFrame construction/destruction
+
+CChildFrame::CChildFrame()
+{
+	// TODO: add member initialization code here
+}
+
+CChildFrame::~CChildFrame()
+{
+}
+
+
+BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
+	if( !CMDIChildWnd::PreCreateWindow(cs) )
+		return FALSE;
+
+	return TRUE;
+}
+
+
+// CChildFrame diagnostics
+
+#ifdef _DEBUG
+void CChildFrame::AssertValid() const
+{
+	CMDIChildWnd::AssertValid();
+}
+
+void CChildFrame::Dump(CDumpContext& dc) const
+{
+	CMDIChildWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+
+// CChildFrame message handlers
Index: /trunk/MFCtooling/TestProg/ChildFrm.h
===================================================================
--- /trunk/MFCtooling/TestProg/ChildFrm.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/ChildFrm.h	(revision 32)
@@ -0,0 +1,34 @@
+// ChildFrm.h : interface of the CChildFrame class
+//
+
+
+#pragma once
+
+
+class CChildFrame : public CMDIChildWnd
+{
+	DECLARE_DYNCREATE(CChildFrame)
+public:
+	CChildFrame();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// Implementation
+public:
+	virtual ~CChildFrame();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+// Generated message map functions
+protected:
+	DECLARE_MESSAGE_MAP()
+};
Index: /trunk/MFCtooling/TestProg/CntrItem.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/CntrItem.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/CntrItem.cpp	(revision 32)
@@ -0,0 +1,181 @@
+// CntrItem.cpp : implementation of the CTestProgCntrItem class
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "TestProgDoc.h"
+#include "TestProgView.h"
+#include "CntrItem.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CTestProgCntrItem implementation
+
+IMPLEMENT_SERIAL(CTestProgCntrItem, COleClientItem, 0)
+
+CTestProgCntrItem::CTestProgCntrItem(CTestProgDoc* pContainer)
+	: COleClientItem(pContainer)
+{
+	// TODO: add one-time construction code here
+}
+
+CTestProgCntrItem::~CTestProgCntrItem()
+{
+	// TODO: add cleanup code here
+}
+
+void CTestProgCntrItem::OnChange(OLE_NOTIFICATION nCode, DWORD dwParam)
+{
+	ASSERT_VALID(this);
+
+	COleClientItem::OnChange(nCode, dwParam);
+
+	// When an item is being edited (either in-place or fully open)
+	//  it sends OnChange notifications for changes in the state of the
+	//  item or visual appearance of its content.
+
+	// TODO: invalidate the item by calling UpdateAllViews
+	//  (with hints appropriate to your application)
+
+	GetDocument()->UpdateAllViews(NULL);
+		// for now just update ALL views/no hints
+}
+
+BOOL CTestProgCntrItem::OnChangeItemPosition(const CRect& rectPos)
+{
+	ASSERT_VALID(this);
+
+	// During in-place activation CTestProgCntrItem::OnChangeItemPosition
+	//  is called by the server to change the position of the in-place
+	//  window.  Usually, this is a result of the data in the server
+	//  document changing such that the extent has changed or as a result
+	//  of in-place resizing.
+	//
+	// The default here is to call the base class, which will call
+	//  COleClientItem::SetItemRects to move the item
+	//  to the new position.
+
+	if (!COleClientItem::OnChangeItemPosition(rectPos))
+		return FALSE;
+
+	// TODO: update any cache you may have of the item's rectangle/extent
+
+	return TRUE;
+}
+
+void CTestProgCntrItem::OnGetItemPosition(CRect& rPosition)
+{
+	ASSERT_VALID(this);
+
+	// During in-place activation, CTestProgCntrItem::OnGetItemPosition
+	//  will be called to determine the location of this item.  Usually, this 
+	//  rectangle would reflect the current position of the item relative to the 
+	//  view used for activation.  You can obtain the view by calling 
+	//  CTestProgCntrItem::GetActiveView.
+
+	// TODO: return correct rectangle (in pixels) in rPosition
+
+	CSize size;
+	rPosition.SetRectEmpty();
+	if (GetExtent(&size, m_nDrawAspect))
+	{
+		CTestProgView* pView = GetActiveView();
+		ASSERT_VALID(pView);
+		if (!pView)
+			return;
+		CDC *pDC = pView->GetDC();
+		ASSERT(pDC);
+		if (!pDC)
+			return;
+		pDC->HIMETRICtoLP(&size);
+		rPosition.SetRect(10, 10, size.cx + 10, size.cy + 10);
+	}
+	else
+		rPosition.SetRect(10, 10, 210, 210);
+}
+
+void CTestProgCntrItem::OnActivate()
+{
+    // Allow only one inplace activate item per frame
+    CTestProgView* pView = GetActiveView();
+    ASSERT_VALID(pView);
+	if (!pView)
+		return;
+    COleClientItem* pItem = GetDocument()->GetInPlaceActiveItem(pView);
+    if (pItem != NULL && pItem != this)
+        pItem->Close();
+    
+    COleClientItem::OnActivate();
+}
+
+void CTestProgCntrItem::OnDeactivateUI(BOOL bUndoable)
+{
+	COleClientItem::OnDeactivateUI(bUndoable);
+
+    DWORD dwMisc = 0;
+    m_lpObject->GetMiscStatus(GetDrawAspect(), &dwMisc);
+    if (dwMisc & OLEMISC_INSIDEOUT)
+        DoVerb(OLEIVERB_HIDE, NULL);
+}
+
+void CTestProgCntrItem::Serialize(CArchive& ar)
+{
+	ASSERT_VALID(this);
+
+	// Call base class first to read in COleClientItem data.
+	// Since this sets up the m_pDocument pointer returned from
+	//  CTestProgCntrItem::GetDocument, it is a good idea to call
+	//  the base class Serialize first.
+	COleClientItem::Serialize(ar);
+
+	// now store/retrieve data specific to CTestProgCntrItem
+	if (ar.IsStoring())
+	{
+		// TODO: add storing code here
+	}
+	else
+	{
+		// TODO: add loading code here
+	}
+}
+
+BOOL CTestProgCntrItem::CanActivate()
+{
+	// Editing in-place while the server itself is being edited in-place
+	//  does not work and is not supported.  So, disable in-place
+	//  activation in this case.
+	CTestProgDoc* pDoc = GetDocument();
+	ASSERT_VALID(pDoc);
+	if (!pDoc)
+		return FALSE;
+	ASSERT_KINDOF(COleServerDoc, pDoc);
+	if (!pDoc->IsKindOf(RUNTIME_CLASS(COleServerDoc)))
+	{
+		return FALSE;
+	}
+	if (pDoc->IsInPlaceActive())
+		return FALSE;
+
+	// otherwise, rely on default behavior
+	return COleClientItem::CanActivate();
+}
+
+
+// CTestProgCntrItem diagnostics
+
+#ifdef _DEBUG
+void CTestProgCntrItem::AssertValid() const
+{
+	COleClientItem::AssertValid();
+}
+
+void CTestProgCntrItem::Dump(CDumpContext& dc) const
+{
+	COleClientItem::Dump(dc);
+}
+#endif
+
Index: /trunk/MFCtooling/TestProg/CntrItem.h
===================================================================
--- /trunk/MFCtooling/TestProg/CntrItem.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/CntrItem.h	(revision 32)
@@ -0,0 +1,46 @@
+// CntrItem.h : interface of the CTestProgCntrItem class
+//
+
+#pragma once
+
+class CTestProgDoc;
+class CTestProgView;
+
+class CTestProgCntrItem : public COleClientItem
+{
+	DECLARE_SERIAL(CTestProgCntrItem)
+
+// Constructors
+public:
+	CTestProgCntrItem(CTestProgDoc* pContainer = NULL);
+		// Note: pContainer is allowed to be NULL to enable IMPLEMENT_SERIALIZE
+		//  IMPLEMENT_SERIALIZE requires the class have a constructor with
+		//  zero arguments.  Normally, OLE items are constructed with a
+		//  non-NULL document pointer
+
+// Attributes
+public:
+	CTestProgDoc* GetDocument()
+		{ return reinterpret_cast<CTestProgDoc*>(COleClientItem::GetDocument()); }
+	CTestProgView* GetActiveView()
+		{ return reinterpret_cast<CTestProgView*>(COleClientItem::GetActiveView()); }
+
+	public:
+	virtual void OnChange(OLE_NOTIFICATION wNotification, DWORD dwParam);
+	virtual void OnActivate();
+	protected:
+	virtual void OnGetItemPosition(CRect& rPosition);
+	virtual void OnDeactivateUI(BOOL bUndoable);
+	virtual BOOL OnChangeItemPosition(const CRect& rectPos);
+	virtual BOOL CanActivate();
+
+// Implementation
+public:
+	~CTestProgCntrItem();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+	virtual void Serialize(CArchive& ar);
+};
+
Index: /trunk/MFCtooling/TestProg/IpFrame.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/IpFrame.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/IpFrame.cpp	(revision 32)
@@ -0,0 +1,106 @@
+// IpFrame.cpp : implementation of the CInPlaceFrame class
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "IpFrame.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CInPlaceFrame
+
+IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
+
+BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
+	ON_WM_CREATE()
+END_MESSAGE_MAP()
+
+
+// CInPlaceFrame construction/destruction
+
+CInPlaceFrame::CInPlaceFrame()
+{
+}
+
+CInPlaceFrame::~CInPlaceFrame()
+{
+}
+
+int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
+		return -1;
+
+	// CResizeBar implements in-place resizing.
+	if (!m_wndResizeBar.Create(this))
+	{
+		TRACE0("Failed to create resize bar\n");
+		return -1;      // fail to create
+	}
+
+	// By default, it is a good idea to register a drop-target that does
+	//  nothing with your frame window.  This prevents drops from
+	//  "falling through" to a container that supports drag-drop.
+	m_dropTarget.Register(this);
+
+	return 0;
+}
+
+// OnCreateControlBars is called by the framework to create control bars on the
+//  container application's windows.  pWndFrame is the top level frame window of
+//  the container and is always non-NULL.  pWndDoc is the doc level frame window
+//  and will be NULL when the container is an SDI application.  A server
+//  application can place MFC control bars on either window.
+BOOL CInPlaceFrame::OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc)
+{
+	// Remove this if you use pWndDoc
+	UNREFERENCED_PARAMETER(pWndDoc);
+
+	// Set owner to this window, so messages are delivered to correct app
+	m_wndToolBar.SetOwner(this);
+
+	// Create toolbar on client's frame window
+	if (!m_wndToolBar.CreateEx(pWndFrame, TBSTYLE_FLAT,WS_CHILD | WS_VISIBLE | CBRS_TOP
+		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
+		!m_wndToolBar.LoadToolBar(IDR_TestProgTYPE_SRVR_IP))
+	{
+		TRACE0("Failed to create toolbar\n");
+		return FALSE;
+	}
+
+	// TODO: Delete these three lines if you don't want the toolbar to be dockable
+	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+	pWndFrame->EnableDocking(CBRS_ALIGN_ANY);
+	pWndFrame->DockControlBar(&m_wndToolBar);
+
+	return TRUE;
+}
+
+BOOL CInPlaceFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
+
+	return COleIPFrameWnd::PreCreateWindow(cs);
+}
+
+
+// CInPlaceFrame diagnostics
+
+#ifdef _DEBUG
+void CInPlaceFrame::AssertValid() const
+{
+	COleIPFrameWnd::AssertValid();
+}
+
+void CInPlaceFrame::Dump(CDumpContext& dc) const
+{
+	COleIPFrameWnd::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CInPlaceFrame commands
Index: /trunk/MFCtooling/TestProg/IpFrame.h
===================================================================
--- /trunk/MFCtooling/TestProg/IpFrame.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/IpFrame.h	(revision 32)
@@ -0,0 +1,41 @@
+// IpFrame.h : interface of the CInPlaceFrame class
+//
+
+#pragma once
+
+class CInPlaceFrame : public COleIPFrameWnd
+{
+	DECLARE_DYNCREATE(CInPlaceFrame)
+public:
+	CInPlaceFrame();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	public:
+	virtual BOOL OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc);
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// Implementation
+public:
+	virtual ~CInPlaceFrame();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+	CToolBar    m_wndToolBar;
+	COleDropTarget	m_dropTarget;
+	COleResizeBar   m_wndResizeBar;
+
+// Generated message map functions
+protected:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	DECLARE_MESSAGE_MAP()
+};
+
Index: /trunk/MFCtooling/TestProg/MainFrm.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/MainFrm.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/MainFrm.cpp	(revision 32)
@@ -0,0 +1,102 @@
+// MainFrm.cpp : implementation of the CMainFrame class
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "MainFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CMainFrame
+
+IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
+
+BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
+	ON_WM_CREATE()
+END_MESSAGE_MAP()
+
+static UINT indicators[] =
+{
+	ID_SEPARATOR,           // status line indicator
+	ID_INDICATOR_CAPS,
+	ID_INDICATOR_NUM,
+	ID_INDICATOR_SCRL,
+};
+
+
+// CMainFrame construction/destruction
+
+CMainFrame::CMainFrame()
+{
+	// TODO: add member initialization code here
+}
+
+CMainFrame::~CMainFrame()
+{
+}
+
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	
+	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
+		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
+		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
+	{
+		TRACE0("Failed to create toolbar\n");
+		return -1;      // fail to create
+	}
+
+	if (!m_wndStatusBar.Create(this) ||
+		!m_wndStatusBar.SetIndicators(indicators,
+		  sizeof(indicators)/sizeof(UINT)))
+	{
+		TRACE0("Failed to create status bar\n");
+		return -1;      // fail to create
+	}
+
+	// TODO: Delete these three lines if you don't want the toolbar to be dockable
+	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+	EnableDocking(CBRS_ALIGN_ANY);
+	DockControlBar(&m_wndToolBar);
+
+	return 0;
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+	if( !CMDIFrameWnd::PreCreateWindow(cs) )
+		return FALSE;
+	// TODO: Modify the Window class or styles here by modifying
+	//  the CREATESTRUCT cs
+
+	return TRUE;
+}
+
+
+// CMainFrame diagnostics
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+	CMDIFrameWnd::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+	CMDIFrameWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+
+// CMainFrame message handlers
+
+
+
Index: /trunk/MFCtooling/TestProg/MainFrm.h
===================================================================
--- /trunk/MFCtooling/TestProg/MainFrm.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/MainFrm.h	(revision 32)
@@ -0,0 +1,41 @@
+// MainFrm.h : interface of the CMainFrame class
+//
+
+
+#pragma once
+
+class CMainFrame : public CMDIFrameWnd
+{
+	DECLARE_DYNAMIC(CMainFrame)
+public:
+	CMainFrame();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+public:
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// Implementation
+public:
+	virtual ~CMainFrame();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:  // control bar embedded members
+	CStatusBar  m_wndStatusBar;
+	CToolBar    m_wndToolBar;
+
+// Generated message map functions
+protected:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	DECLARE_MESSAGE_MAP()
+};
+
+
Index: /trunk/MFCtooling/TestProg/ReadMe.txt
===================================================================
--- /trunk/MFCtooling/TestProg/ReadMe.txt	(revision 32)
+++ /trunk/MFCtooling/TestProg/ReadMe.txt	(revision 32)
@@ -0,0 +1,166 @@
+================================================================================
+    MICROSOFT FOUNDATION CLASS LIBRARY : TestProg Project Overview
+===============================================================================
+
+The application wizard has created this TestProg application for
+you.  This application not only demonstrates the basics of using the Microsoft
+Foundation Classes but is also a starting point for writing your application.
+
+This file contains a summary of what you will find in each of the files that
+make up your TestProg application.
+
+TestProg.vcproj
+    This is the main project file for VC++ projects generated using an application wizard.
+    It contains information about the version of Visual C++ that generated the file, and
+    information about the platforms, configurations, and project features selected with the
+    application wizard.
+
+TestProg.h
+    This is the main header file for the application.  It includes other
+    project specific headers (including Resource.h) and declares the
+    CTestProgApp application class.
+
+TestProg.cpp
+    This is the main application source file that contains the application
+    class CTestProgApp.
+
+TestProg.rc
+    This is a listing of all of the Microsoft Windows resources that the
+    program uses.  It includes the icons, bitmaps, and cursors that are stored
+    in the RES subdirectory.  This file can be directly edited in Microsoft
+    Visual C++. Your project resources are in 1033.
+
+res\TestProg.ico
+    This is an icon file, which is used as the application's icon.  This
+    icon is included by the main resource file TestProg.rc.
+
+res\TestProg.rc2
+    This file contains resources that are not edited by Microsoft
+    Visual C++. You should place all resources not editable by
+    the resource editor in this file.
+
+TestProg.reg
+    This is an example .reg file that shows you the kind of registration
+    settings the framework will set for you.  You can use this as a .reg
+    file to go along with your application or just delete it and rely
+    on the default RegisterShellFileTypes registration.
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+For the main frame window:
+    The project includes a standard MFC interface.
+
+MainFrm.h, MainFrm.cpp
+    These files contain the frame class CMainFrame, which is derived from
+    CMDIFrameWnd and controls all MDI frame features.
+
+res\Toolbar.bmp
+    This bitmap file is used to create tiled images for the toolbar.
+    The initial toolbar and status bar are constructed in the CMainFrame
+    class. Edit this toolbar bitmap using the resource editor, and
+    update the IDR_MAINFRAME TOOLBAR array in TestProg.rc to add
+    toolbar buttons.
+
+res\IToolbar.bmp
+    This bitmap file is used to create tiled images for the toolbar
+    when your server application is in-place activated inside another
+    container. This toolbar is constructed in the CInPlaceFrame
+    class. This bitmap is similar to the bitmap in res\Toolbar.bmp
+    except that it has many nonserver commands removed.
+
+/////////////////////////////////////////////////////////////////////////////
+
+For the child frame window:
+
+ChildFrm.h, ChildFrm.cpp
+    These files define and implement the CChildFrame class, which
+    supports the child windows in an MDI application.
+
+/////////////////////////////////////////////////////////////////////////////
+
+The application wizard creates one document type and one view:
+
+TestProgDoc.h, TestProgDoc.cpp - the document
+    These files contain your CTestProgDoc class.  Edit these files to
+    add your special document data and to implement file saving and loading
+    (via CTestProgDoc::Serialize).
+
+TestProgView.h, TestProgView.cpp - the view of the document
+    These files contain your CTestProgView class.
+    CTestProgView objects are used to view CTestProgDoc objects.
+
+res\TestProgDoc.ico
+    This is an icon file, which is used as the icon for MDI child windows
+    for the CTestProgDoc class.  This icon is included by the main
+    resource file TestProg.rc.
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+The application wizard has also created classes specific to OLE
+
+CntrItem.h, CntrItem.cpp
+    These files contain your CTestProgCntrItem class. This class is used to
+    manipulate OLE objects.  OLE objects are usually displayed by your
+    CTestProgView class and serialized as part of your CTestProgDoc class.
+
+SrvrItem.h, SrvrItem.cpp
+    These files contain your CTestProgSrvrItem. This class is used to
+    connect your CTestProgDoc class to the OLE system, and optionally
+    provide links to your document.
+
+IpFrame.h, IpFrame.cpp
+    These files contain your CInPlaceFrame. This class is derived
+    from COleIPFrameWnd and controls all frame features during in-place activation.
+
+    The project has support for Compound files. The Compound-file format stores a document
+    that contains one or more Automation objects to one file and still allows access to
+    the it for the individual objects.
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+Other Features:
+
+ActiveX Controls
+    The application includes support to use ActiveX controls.
+
+Printing and Print Preview support
+    The application wizard has generated code to handle the print, print setup, and print preview
+    commands by calling member functions in the CView class from the MFC library.
+
+/////////////////////////////////////////////////////////////////////////////
+
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named TestProg.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+    This is the standard header file, which defines new resource IDs.
+    Microsoft Visual C++ reads and updates this file.
+
+TestProg.manifest
+	Application manifest files are used by Windows XP to describe an applications
+	dependency on specific versions of Side-by-Side assemblies. The loader uses this
+	information to load the appropriate assembly from the assembly cache or private
+	from the application. The Application manifest  maybe included for redistribution
+	as an external .manifest file that is installed in the same folder as the application
+	executable or it may be included in the executable in the form of a resource.
+/////////////////////////////////////////////////////////////////////////////
+
+Other notes:
+
+The application wizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+If your application uses MFC in a shared DLL, you will need
+to redistribute the MFC DLLs. If your application is in a language
+other than the operating system's locale, you will also have to
+redistribute the corresponding localized resources MFC90XXX.DLL.
+For more information on both of these topics, please see the section on
+redistributing Visual C++ applications in MSDN documentation.
+
+/////////////////////////////////////////////////////////////////////////////
Index: /trunk/MFCtooling/TestProg/SrvrItem.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/SrvrItem.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/SrvrItem.cpp	(revision 32)
@@ -0,0 +1,121 @@
+// SrvrItem.cpp : implementation of the CTestProgSrvrItem class
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "TestProgDoc.h"
+#include "SrvrItem.h"
+#include "CntrItem.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CTestProgSrvrItem implementation
+
+IMPLEMENT_DYNAMIC(CTestProgSrvrItem, COleServerItem)
+
+CTestProgSrvrItem::CTestProgSrvrItem(CTestProgDoc* pContainerDoc)
+	: COleServerItem(pContainerDoc, TRUE)
+{
+	// TODO: add one-time construction code here
+	//  (eg, adding additional clipboard formats to the item's data source)
+}
+
+CTestProgSrvrItem::~CTestProgSrvrItem()
+{
+	// TODO: add cleanup code here
+}
+
+void CTestProgSrvrItem::Serialize(CArchive& ar)
+{
+	// CTestProgSrvrItem::Serialize will be called by the framework if
+	//  the item is copied to the clipboard.  This can happen automatically
+	//  through the OLE callback OnGetClipboardData.  A good default for
+	//  the embedded item is simply to delegate to the document's Serialize
+	//  function.  If you support links, then you will want to serialize
+	//  just a portion of the document.
+
+	if (!IsLinkedItem())
+	{
+		CTestProgDoc* pDoc = GetDocument();
+		ASSERT_VALID(pDoc);
+		if (pDoc)
+			pDoc->Serialize(ar);
+	}
+}
+
+BOOL CTestProgSrvrItem::OnGetExtent(DVASPECT dwDrawAspect, CSize& rSize)
+{
+	// Most applications, like this one, only handle drawing the content
+	//  aspect of the item.  If you wish to support other aspects, such
+	//  as DVASPECT_THUMBNAIL (by overriding OnDrawEx), then this
+	//  implementation of OnGetExtent should be modified to handle the
+	//  additional aspect(s).
+
+	if (dwDrawAspect != DVASPECT_CONTENT)
+		return COleServerItem::OnGetExtent(dwDrawAspect, rSize);
+
+	// CTestProgSrvrItem::OnGetExtent is called to get the extent in
+	//  HIMETRIC units of the entire item.  The default implementation
+	//  here simply returns a hard-coded number of units.
+
+	// TODO: replace this arbitrary size
+
+	rSize = CSize(3000, 3000);   // 3000 x 3000 HIMETRIC units
+
+	return TRUE;
+}
+
+BOOL CTestProgSrvrItem::OnDraw(CDC* pDC, CSize& rSize)
+{
+	if (!pDC)
+		return FALSE;
+
+	// Remove this if you use rSize
+	UNREFERENCED_PARAMETER(rSize);
+
+	// TODO: set mapping mode and extent
+	//  (The extent is usually the same as the size returned from OnGetExtent)
+	pDC->SetMapMode(MM_ANISOTROPIC);
+	pDC->SetWindowOrg(0,0);
+	pDC->SetWindowExt(3000, 3000);
+
+	// TODO: add drawing code here.  Optionally, fill in the HIMETRIC extent.
+	//  All drawing takes place in the metafile device context (pDC).
+
+	// TODO: also draw embedded CTestProgCntrItem objects.
+
+	// The following code draws the first item at an arbitrary position.
+
+	// TODO: remove this code when your real drawing code is complete
+
+	CTestProgDoc* pDoc = GetDocument();
+	ASSERT_VALID(pDoc);
+	if (!pDoc)
+		return FALSE;
+
+	POSITION pos = pDoc->GetStartPosition();
+	CTestProgCntrItem* pItem = DYNAMIC_DOWNCAST(CTestProgCntrItem, pDoc->GetNextClientItem(pos));
+	if (pItem != NULL)
+		pItem->Draw(pDC, CRect(10, 10, 1010, 1010));
+	return TRUE;
+}
+
+
+// CTestProgSrvrItem diagnostics
+
+#ifdef _DEBUG
+void CTestProgSrvrItem::AssertValid() const
+{
+	COleServerItem::AssertValid();
+}
+
+void CTestProgSrvrItem::Dump(CDumpContext& dc) const
+{
+	COleServerItem::Dump(dc);
+}
+#endif
+
Index: /trunk/MFCtooling/TestProg/SrvrItem.h
===================================================================
--- /trunk/MFCtooling/TestProg/SrvrItem.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/SrvrItem.h	(revision 32)
@@ -0,0 +1,34 @@
+// SrvrItem.h : interface of the CTestProgSrvrItem class
+//
+
+#pragma once
+
+class CTestProgSrvrItem : public COleServerItem
+{
+	DECLARE_DYNAMIC(CTestProgSrvrItem)
+
+// Constructors
+public:
+	CTestProgSrvrItem(CTestProgDoc* pContainerDoc);
+
+// Attributes
+	CTestProgDoc* GetDocument() const
+		{ return reinterpret_cast<CTestProgDoc*>(COleServerItem::GetDocument()); }
+
+// Overrides
+	public:
+	virtual BOOL OnDraw(CDC* pDC, CSize& rSize);
+	virtual BOOL OnGetExtent(DVASPECT dwDrawAspect, CSize& rSize);
+
+// Implementation
+public:
+	~CTestProgSrvrItem();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+	virtual void Serialize(CArchive& ar);   // overridden for document i/o
+};
+
Index: /trunk/MFCtooling/TestProg/TestProg.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/TestProg.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProg.cpp	(revision 32)
@@ -0,0 +1,235 @@
+// TestProg.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+#include "MainFrm.h"
+
+#include "ChildFrm.h"
+#include "IpFrame.h"
+#include "TestProgDoc.h"
+#include "TestProgView.h"
+#include "afxwin.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CTestProgApp
+
+BEGIN_MESSAGE_MAP(CTestProgApp, CWinApp)
+	ON_COMMAND(ID_APP_ABOUT, &CTestProgApp::OnAppAbout)
+	// Standard file based document commands
+	ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
+	ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
+	// Standard print setup command
+	ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)
+END_MESSAGE_MAP()
+
+
+// CTestProgApp construction
+
+CTestProgApp::CTestProgApp()
+{
+	// TODO: add construction code here,
+	// Place all significant initialization in InitInstance
+}
+
+
+// The one and only CTestProgApp object
+
+CTestProgApp theApp;
+// This identifier was generated to be statistically unique for your app
+// You may change it if you prefer to choose a specific identifier
+
+// {81A5B9DA-E0DC-4E02-9097-38F90D423C7B}
+static const CLSID clsid =
+{ 0x81A5B9DA, 0xE0DC, 0x4E02, { 0x90, 0x97, 0x38, 0xF9, 0xD, 0x42, 0x3C, 0x7B } };
+
+
+// CTestProgApp initialization
+
+BOOL CTestProgApp::InitInstance()
+{
+	// InitCommonControlsEx() is required on Windows XP if an application
+	// manifest specifies use of ComCtl32.dll version 6 or later to enable
+	// visual styles.  Otherwise, any window creation will fail.
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// Set this to include all the common control classes you want to use
+	// in your application.
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinApp::InitInstance();
+
+	void (__cdecl *InitUsagelogPtr)(void) = NULL;
+	
+	hinstDll = LoadLibrary(L"userlog.dll");
+	if( hinstDll==NULL ) {
+		MessageBox(0, L"Loading of DLL failed", L"Failure", MB_OK);
+	}
+	InitUsagelogPtr = (void (*)(void)) GetProcAddress(hinstDll, "InitUsagelog");
+	if( InitUsagelogPtr==NULL ) {
+		MessageBox(0, L"Loading of InitFuncPtr failed", L"Failure", MB_OK);
+	}
+	if( InitUsagelogPtr!=NULL ) {
+		InitUsagelogPtr();
+	}
+
+
+	// Initialize OLE libraries
+	if (!AfxOleInit())
+	{
+		AfxMessageBox(IDP_OLE_INIT_FAILED);
+		return FALSE;
+	}
+	AfxEnableControlContainer();
+	// Standard initialization
+	// If you are not using these features and wish to reduce the size
+	// of your final executable, you should remove from the following
+	// the specific initialization routines you do not need
+	// Change the registry key under which our settings are stored
+	// TODO: You should modify this string to be something appropriate
+	// such as the name of your company or organization
+	SetRegistryKey(_T("Local AppWizard-Generated Applications"));
+	LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)
+	// Register the application's document templates.  Document templates
+	//  serve as the connection between documents, frame windows and views
+	CMultiDocTemplate* pDocTemplate;
+	pDocTemplate = new CMultiDocTemplate(IDR_TestProgTYPE,
+		RUNTIME_CLASS(CTestProgDoc),
+		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
+		RUNTIME_CLASS(CTestProgView));
+	if (!pDocTemplate)
+		return FALSE;
+	pDocTemplate->SetContainerInfo(IDR_TestProgTYPE_CNTR_IP);
+	pDocTemplate->SetServerInfo(
+		IDR_TestProgTYPE_SRVR_EMB, IDR_TestProgTYPE_SRVR_IP,
+		RUNTIME_CLASS(CInPlaceFrame));
+	AddDocTemplate(pDocTemplate);
+	// Connect the COleTemplateServer to the document template
+	//  The COleTemplateServer creates new documents on behalf
+	//  of requesting OLE containers by using information
+	//  specified in the document template
+	m_server.ConnectTemplate(clsid, pDocTemplate, FALSE);
+	// Register all OLE server factories as running.  This enables the
+	//  OLE libraries to create objects from other applications
+	COleTemplateServer::RegisterAll();
+		// Note: MDI applications register all server objects without regard
+		//  to the /Embedding or /Automation on the command line
+
+	// create main MDI Frame window
+	CMainFrame* pMainFrame = new CMainFrame;
+	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
+	{
+		delete pMainFrame;
+		return FALSE;
+	}
+	m_pMainWnd = pMainFrame;
+	// call DragAcceptFiles only if there's a suffix
+	//  In an MDI app, this should occur immediately after setting m_pMainWnd
+
+
+	// Parse command line for standard shell commands, DDE, file open
+	CCommandLineInfo cmdInfo;
+	ParseCommandLine(cmdInfo);
+
+	// App was launched with /Embedding or /Automation switch.
+	// Run app as automation server.
+	if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
+	{
+		// Don't show the main window
+		return TRUE;
+	}
+	// App was launched with /Unregserver or /Unregister switch.  Unregister
+	// typelibrary.  Other unregistration occurs in ProcessShellCommand().
+	else if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
+	{
+		m_server.UpdateRegistry(OAT_INPLACE_SERVER, NULL, NULL, FALSE);
+	}
+	// App was launched standalone or with other switches (e.g. /Register
+	// or /Regserver).  Update registry entries, including typelibrary.
+	else
+	{
+		m_server.UpdateRegistry(OAT_INPLACE_SERVER);
+	}
+
+	// Dispatch commands specified on the command line.  Will return FALSE if
+	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
+	if (!ProcessShellCommand(cmdInfo))
+		return FALSE;
+	// The main window has been initialized, so show and update it
+	pMainFrame->ShowWindow(m_nCmdShow);
+	pMainFrame->UpdateWindow();
+
+	return TRUE;
+}
+
+
+int CTestProgApp::ExitInstance()
+{
+	//TODO: Zusätzliche Ressourcen behandeln, die Sie möglicherweise hinzugefügt haben
+	AfxOleTerm(FALSE);
+	
+	void (*ReleaseUsagelogPtr)(void) = NULL;
+		
+	ReleaseUsagelogPtr = (void (*)(void)) GetProcAddress(hinstDll, "ReleaseUsagelog");
+	if( ReleaseUsagelogPtr==NULL ) {
+		MessageBox(0, L"Loading of ReleaseFuncPtr failed", L"Failure", MB_OK);
+	}
+	if( ReleaseUsagelogPtr!=NULL ) {
+		ReleaseUsagelogPtr();
+	}
+
+	FreeLibrary(hinstDll);
+
+	return CWinApp::ExitInstance();
+}
+
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+	CAboutDlg();
+
+// Dialog Data
+	enum { IDD = IDD_ABOUTBOX };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+
+// Implementation
+protected:
+	DECLARE_MESSAGE_MAP()
+public:
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+	
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+}
+
+
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+// App command to run the dialog
+void CTestProgApp::OnAppAbout()
+{
+	CAboutDlg aboutDlg;
+	aboutDlg.DoModal();
+	
+}
+
+
+// CTestProgApp message handlers
+
Index: /trunk/MFCtooling/TestProg/TestProg.h
===================================================================
--- /trunk/MFCtooling/TestProg/TestProg.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProg.h	(revision 32)
@@ -0,0 +1,35 @@
+// TestProg.h : main header file for the TestProg application
+//
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "include 'stdafx.h' before including this file for PCH"
+#endif
+
+#include "resource.h"       // main symbols
+
+
+// CTestProgApp:
+// See TestProg.cpp for the implementation of this class
+//
+
+class CTestProgApp : public CWinApp
+{
+public:
+	CTestProgApp();
+private:
+	HINSTANCE hinstDll;
+
+// Overrides
+public:
+	virtual BOOL InitInstance();
+	virtual BOOL ExitInstance();
+
+// Implementation
+	COleTemplateServer m_server;
+		// Server object for document creation
+	afx_msg void OnAppAbout();
+	DECLARE_MESSAGE_MAP()
+};
+
+extern CTestProgApp theApp;
Index: /trunk/MFCtooling/TestProg/TestProg.rc
===================================================================
--- /trunk/MFCtooling/TestProg/TestProg.rc	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProg.rc	(revision 32)
@@ -0,0 +1,641 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+    "LANGUAGE 9, 1\r\n"
+    "#pragma code_page(1252)\r\n"
+    "#include ""res\\TestProg.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
+    "#include ""afxres.rc""         // Standard components\r\n"
+    "#include ""afxprint.rc""       // printing/print preview resources\r\n"
+    "#include ""afxolecl.rc""       // OLE container resources\r\n"
+    "#include ""afxolesv.rc""       // OLE server resources\r\n"
+    "#endif\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME           ICON                    "res\\TestProg.ico"
+IDR_TestProgTYPE        ICON                    "res\\TestProgDoc.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDR_MAINFRAME           BITMAP                  "res\\Toolbar.bmp"
+IDR_TestProgTYPE_SRVR_IP BITMAP                  "res\\IToolbar.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Toolbar
+//
+
+IDR_MAINFRAME TOOLBAR  16, 15
+BEGIN
+    BUTTON      ID_FILE_NEW
+    BUTTON      ID_FILE_OPEN
+    BUTTON      ID_FILE_SAVE
+    SEPARATOR
+    BUTTON      ID_EDIT_CUT
+    BUTTON      ID_EDIT_COPY
+    BUTTON      ID_EDIT_PASTE
+    SEPARATOR
+    BUTTON      ID_FILE_PRINT
+    BUTTON      ID_APP_ABOUT
+END
+
+IDR_TestProgTYPE_SRVR_IP TOOLBAR  16, 15
+BEGIN
+    BUTTON      ID_EDIT_CUT
+    BUTTON      ID_EDIT_COPY
+    BUTTON      ID_EDIT_PASTE
+    SEPARATOR
+    BUTTON      ID_APP_ABOUT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MAINFRAME MENU 
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
+        MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
+        MENUITEM SEPARATOR
+        MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
+        MENUITEM SEPARATOR
+        MENUITEM "Recent File",                 ID_FILE_MRU_FILE1, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "&Close",                      ID_FILE_CLOSE
+        MENUITEM "E&xit",                       ID_APP_EXIT
+    END
+    POPUP "&View"
+    BEGIN
+        MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR
+        MENUITEM "&Status Bar",                 ID_VIEW_STATUS_BAR
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About TestProg...",          ID_APP_ABOUT
+    END
+END
+
+IDR_TestProgTYPE MENU 
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
+        MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
+        MENUITEM "&Close",                      ID_FILE_CLOSE
+        MENUITEM "&Save\tCtrl+S",               ID_FILE_SAVE
+        MENUITEM "Save &As...",                 ID_FILE_SAVE_AS
+        MENUITEM SEPARATOR
+        MENUITEM "&Print...\tCtrl+P",           ID_FILE_PRINT
+        MENUITEM "Print Pre&view",              ID_FILE_PRINT_PREVIEW
+        MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
+        MENUITEM SEPARATOR
+        MENUITEM "Recent File",                 ID_FILE_MRU_FILE1, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "E&xit",                       ID_APP_EXIT
+    END
+    POPUP "&Edit"
+    BEGIN
+        MENUITEM "&Undo\tCtrl+Z",               ID_EDIT_UNDO
+        MENUITEM SEPARATOR
+        MENUITEM "Cu&t\tCtrl+X",                ID_EDIT_CUT
+        MENUITEM "&Copy\tCtrl+C",               ID_EDIT_COPY
+        MENUITEM "&Paste\tCtrl+V",              ID_EDIT_PASTE
+        MENUITEM "Paste &Special...",           ID_EDIT_PASTE_SPECIAL
+        MENUITEM SEPARATOR
+        MENUITEM "Insert &New Object...",       ID_OLE_INSERT_NEW
+        MENUITEM "Lin&ks...",                   ID_OLE_EDIT_LINKS
+        MENUITEM "<<OLE VERBS GO HERE>>",       ID_OLE_VERB_FIRST
+    END
+    POPUP "&View"
+    BEGIN
+        MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR
+        MENUITEM "&Status Bar",                 ID_VIEW_STATUS_BAR
+    END
+    POPUP "&Window"
+    BEGIN
+        MENUITEM "&New Window",                 ID_WINDOW_NEW
+        MENUITEM "&Cascade",                    ID_WINDOW_CASCADE
+        MENUITEM "&Tile",                       ID_WINDOW_TILE_HORZ
+        MENUITEM "&Arrange Icons",              ID_WINDOW_ARRANGE
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About TestProg...",          ID_APP_ABOUT
+    END
+END
+
+IDR_TestProgTYPE_CNTR_IP MENU 
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
+        MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
+        MENUITEM "&Close",                      ID_FILE_CLOSE
+        MENUITEM "&Save\tCtrl+S",               ID_FILE_SAVE
+        MENUITEM "Save &As...",                 ID_FILE_SAVE_AS
+        MENUITEM SEPARATOR
+        MENUITEM "&Print...\tCtrl+P",           ID_FILE_PRINT
+        MENUITEM "Print Pre&view",              ID_FILE_PRINT_PREVIEW
+        MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
+        MENUITEM SEPARATOR
+        MENUITEM "Recent File",                 ID_FILE_MRU_FILE1, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "E&xit",                       ID_APP_EXIT
+    END
+    MENUITEM SEPARATOR
+    MENUITEM SEPARATOR
+    POPUP "&Window"
+    BEGIN
+        MENUITEM "&New Window",                 ID_WINDOW_NEW
+        MENUITEM "&Cascade",                    ID_WINDOW_CASCADE
+        MENUITEM "&Tile",                       ID_WINDOW_TILE_HORZ
+        MENUITEM "&Arrange Icons",              ID_WINDOW_ARRANGE
+    END
+END
+
+IDR_TestProgTYPE_SRVR_EMB MENU 
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
+        MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
+        MENUITEM "&Close",                      ID_FILE_CLOSE
+        MENUITEM "&Update\tCtrl+S",             ID_FILE_UPDATE
+        MENUITEM "Save Copy &As...",            ID_FILE_SAVE_COPY_AS
+        MENUITEM SEPARATOR
+        MENUITEM "&Print...\tCtrl+P",           ID_FILE_PRINT
+        MENUITEM "Print Pre&view",              ID_FILE_PRINT_PREVIEW
+        MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
+        MENUITEM SEPARATOR
+        MENUITEM "Recent File",                 ID_FILE_MRU_FILE1, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "E&xit",                       ID_APP_EXIT
+    END
+    POPUP "&Edit"
+    BEGIN
+        MENUITEM "&Undo\tCtrl+Z",               ID_EDIT_UNDO
+        MENUITEM SEPARATOR
+        MENUITEM "Cu&t\tCtrl+X",                ID_EDIT_CUT
+        MENUITEM "&Copy\tCtrl+C",               ID_EDIT_COPY
+        MENUITEM "&Paste\tCtrl+V",              ID_EDIT_PASTE
+        MENUITEM "Paste &Special...",           ID_EDIT_PASTE_SPECIAL
+        MENUITEM SEPARATOR
+        MENUITEM "Insert &New Object...",       ID_OLE_INSERT_NEW
+        MENUITEM "Lin&ks...",                   ID_OLE_EDIT_LINKS
+        MENUITEM "<<OLE VERBS GO HERE>>",       ID_OLE_VERB_FIRST
+    END
+    POPUP "&View"
+    BEGIN
+        MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR
+        MENUITEM "&Status Bar",                 ID_VIEW_STATUS_BAR
+    END
+    POPUP "&Window"
+    BEGIN
+        MENUITEM "&New Window",                 ID_WINDOW_NEW
+        MENUITEM "&Cascade",                    ID_WINDOW_CASCADE
+        MENUITEM "&Tile",                       ID_WINDOW_TILE_HORZ
+        MENUITEM "&Arrange Icons",              ID_WINDOW_ARRANGE
+    END
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About TestProg...",          ID_APP_ABOUT
+    END
+END
+
+IDR_TestProgTYPE_SRVR_IP MENU 
+BEGIN
+    POPUP "&Edit"
+    BEGIN
+        MENUITEM "&Undo\tCtrl+Z",               ID_EDIT_UNDO
+        MENUITEM SEPARATOR
+        MENUITEM "Cu&t\tCtrl+X",                ID_EDIT_CUT
+        MENUITEM "&Copy\tCtrl+C",               ID_EDIT_COPY
+        MENUITEM "&Paste\tCtrl+V",              ID_EDIT_PASTE
+        MENUITEM "Paste &Special...",           ID_EDIT_PASTE_SPECIAL
+        MENUITEM SEPARATOR
+        MENUITEM "Insert &New Object...",       ID_OLE_INSERT_NEW
+        MENUITEM "Lin&ks...",                   ID_OLE_EDIT_LINKS
+        MENUITEM "<<OLE VERBS GO HERE>>",       ID_OLE_VERB_FIRST
+    END
+    POPUP "&View"
+    BEGIN
+        MENUITEM "&Toolbar",                    ID_VIEW_TOOLBAR
+    END
+    MENUITEM SEPARATOR
+    MENUITEM SEPARATOR
+    POPUP "&Help"
+    BEGIN
+        MENUITEM "&About TestProg...",          ID_APP_ABOUT
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_MAINFRAME ACCELERATORS 
+BEGIN
+    "N",            ID_FILE_NEW,            VIRTKEY, CONTROL
+    "O",            ID_FILE_OPEN,           VIRTKEY, CONTROL
+    "S",            ID_FILE_SAVE,           VIRTKEY, CONTROL
+    "P",            ID_FILE_PRINT,          VIRTKEY, CONTROL
+    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL
+    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL
+    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL
+    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL
+    VK_BACK,        ID_EDIT_UNDO,           VIRTKEY, ALT
+    VK_DELETE,      ID_EDIT_CUT,            VIRTKEY, SHIFT
+    VK_INSERT,      ID_EDIT_COPY,           VIRTKEY, CONTROL
+    VK_INSERT,      ID_EDIT_PASTE,          VIRTKEY, SHIFT
+    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
+    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
+    VK_ESCAPE,      ID_CANCEL_EDIT_CNTR,    VIRTKEY, NOINVERT
+END
+
+IDR_TestProgTYPE_CNTR_IP ACCELERATORS 
+BEGIN
+    "N",            ID_FILE_NEW,            VIRTKEY, CONTROL
+    "O",            ID_FILE_OPEN,           VIRTKEY, CONTROL
+    "S",            ID_FILE_SAVE,           VIRTKEY, CONTROL
+    "P",            ID_FILE_PRINT,          VIRTKEY, CONTROL
+    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
+    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
+    VK_ESCAPE,      ID_CANCEL_EDIT_CNTR,    VIRTKEY, NOINVERT
+END
+
+IDR_TestProgTYPE_SRVR_IP ACCELERATORS 
+BEGIN
+    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL
+    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL
+    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL
+    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL
+    VK_BACK,        ID_EDIT_UNDO,           VIRTKEY, ALT
+    VK_DELETE,      ID_EDIT_CUT,            VIRTKEY, SHIFT
+    VK_INSERT,      ID_EDIT_COPY,           VIRTKEY, CONTROL
+    VK_INSERT,      ID_EDIT_PASTE,          VIRTKEY, SHIFT
+    VK_ESCAPE,      ID_CANCEL_EDIT_SRVR,    VIRTKEY, NOINVERT
+END
+
+IDR_TestProgTYPE_SRVR_EMB ACCELERATORS 
+BEGIN
+    "N",            ID_FILE_NEW,            VIRTKEY, CONTROL
+    "O",            ID_FILE_OPEN,           VIRTKEY, CONTROL
+    "S",            ID_FILE_UPDATE,         VIRTKEY, CONTROL
+    "P",            ID_FILE_PRINT,          VIRTKEY, CONTROL
+    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL
+    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL
+    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL
+    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL
+    VK_BACK,        ID_EDIT_UNDO,           VIRTKEY, ALT
+    VK_DELETE,      ID_EDIT_CUT,            VIRTKEY, SHIFT
+    VK_INSERT,      ID_EDIT_COPY,           VIRTKEY, CONTROL
+    VK_INSERT,      ID_EDIT_PASTE,          VIRTKEY, SHIFT
+    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
+    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
+    VK_ESCAPE,      ID_CANCEL_EDIT_CNTR,    VIRTKEY, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 171, 202
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About TestProg"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20
+    LTEXT           "TestProg, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
+    LTEXT           "Copyright (C) 2010",IDC_STATIC,42,26,114,8
+    DEFPUSHBUTTON   "OK",IDOK,114,181,50,14,WS_GROUP
+    EDITTEXT        IDC_EDIT1,37,57,86,16,ES_AUTOHSCROLL
+    CONTROL         "Check1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,79,39,10
+    COMBOBOX        IDC_COMBO1,42,92,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Radio1",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,19,124,38,10
+    CONTROL         "Radio2",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,19,139,38,10
+    CONTROL         "Radio3",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,18,156,38,10
+    GROUPBOX        "Static",IDC_STATIC,7,114,68,63
+    CONTROL         "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,71,122,100,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904e4"
+        BEGIN
+            VALUE "CompanyName", "TODO: <Company name>"
+            VALUE "FileDescription", "TODO: <File description>"
+            VALUE "FileVersion", "1.0.0.1"
+            VALUE "InternalName", "TestProg.exe"
+            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
+            VALUE "OriginalFilename", "TestProg.exe"
+            VALUE "ProductName", "TODO: <Product name>"
+            VALUE "ProductVersion", "1.0.0.1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1252
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO 
+BEGIN
+    IDD_ABOUTBOX, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 164
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 195
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_ABOUTBOX DLGINIT
+BEGIN
+    IDC_COMBO1, 0x403, 6, 0
+0x7449, 0x6d65, 0x0031, 
+    IDC_COMBO1, 0x403, 6, 0
+0x7449, 0x6d65, 0x0032, 
+    0
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE 
+BEGIN
+    IDP_OLE_INIT_FAILED     "OLE initialization failed.  Make sure that the OLE libraries are the correct version."
+    IDP_FAILED_TO_CREATE    "Failed to create object.  Make sure the object is entered in the system registry."
+END
+
+STRINGTABLE 
+BEGIN
+    IDR_MAINFRAME           "TestProg"
+    IDR_TestProgTYPE        "\nTestProg\nTestProg\n\n\nTestProg.Document\nTestProg.Document"
+END
+
+STRINGTABLE 
+BEGIN
+    AFX_IDS_APP_TITLE       "TestProg"
+    AFX_IDS_IDLEMESSAGE     "Ready"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_INDICATOR_EXT        "EXT"
+    ID_INDICATOR_CAPS       "CAP"
+    ID_INDICATOR_NUM        "NUM"
+    ID_INDICATOR_SCRL       "SCRL"
+    ID_INDICATOR_OVR        "OVR"
+    ID_INDICATOR_REC        "REC"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_FILE_NEW             "Create a new document\nNew"
+    ID_FILE_OPEN            "Open an existing document\nOpen"
+    ID_FILE_CLOSE           "Close the active document\nClose"
+    ID_FILE_SAVE            "Save the active document\nSave"
+    ID_FILE_SAVE_AS         "Save the active document with a new name\nSave As"
+    ID_FILE_PAGE_SETUP      "Change the printing options\nPage Setup"
+    ID_FILE_PRINT_SETUP     "Change the printer and printing options\nPrint Setup"
+    ID_FILE_PRINT           "Print the active document\nPrint"
+    ID_FILE_PRINT_PREVIEW   "Display full pages\nPrint Preview"
+    ID_FILE_UPDATE          "Update the container to show any changes\nUpdate"
+    ID_FILE_SAVE_COPY_AS    "Save a copy of the active document with a new name\nSave Copy"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_APP_ABOUT            "Display program information, version number and copyright\nAbout"
+    ID_APP_EXIT             "Quit the application; prompts to save documents\nExit"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_FILE_MRU_FILE1       "Open this document"
+    ID_FILE_MRU_FILE2       "Open this document"
+    ID_FILE_MRU_FILE3       "Open this document"
+    ID_FILE_MRU_FILE4       "Open this document"
+    ID_FILE_MRU_FILE5       "Open this document"
+    ID_FILE_MRU_FILE6       "Open this document"
+    ID_FILE_MRU_FILE7       "Open this document"
+    ID_FILE_MRU_FILE8       "Open this document"
+    ID_FILE_MRU_FILE9       "Open this document"
+    ID_FILE_MRU_FILE10      "Open this document"
+    ID_FILE_MRU_FILE11      "Open this document"
+    ID_FILE_MRU_FILE12      "Open this document"
+    ID_FILE_MRU_FILE13      "Open this document"
+    ID_FILE_MRU_FILE14      "Open this document"
+    ID_FILE_MRU_FILE15      "Open this document"
+    ID_FILE_MRU_FILE16      "Open this document"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_NEXT_PANE            "Switch to the next window pane\nNext Pane"
+    ID_PREV_PANE            "Switch back to the previous window pane\nPrevious Pane"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_WINDOW_NEW           "Open another window for the active document\nNew Window"
+    ID_WINDOW_ARRANGE       "Arrange icons at the bottom of the window\nArrange Icons"
+    ID_WINDOW_CASCADE       "Arrange windows so they overlap\nCascade Windows"
+    ID_WINDOW_TILE_HORZ     "Arrange windows as non-overlapping tiles\nTile Windows"
+    ID_WINDOW_TILE_VERT     "Arrange windows as non-overlapping tiles\nTile Windows"
+    ID_WINDOW_SPLIT         "Split the active window into panes\nSplit"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_EDIT_CLEAR           "Erase the selection\nErase"
+    ID_EDIT_CLEAR_ALL       "Erase everything\nErase All"
+    ID_EDIT_COPY            "Copy the selection and put it on the Clipboard\nCopy"
+    ID_EDIT_CUT             "Cut the selection and put it on the Clipboard\nCut"
+    ID_EDIT_FIND            "Find the specified text\nFind"
+    ID_EDIT_PASTE           "Insert Clipboard contents\nPaste"
+    ID_EDIT_PASTE_LINK      "Insert Clipboard contents and a link to its source\nPaste Link"
+    ID_EDIT_PASTE_SPECIAL   "Insert Clipboard contents with options\nPaste Special"
+    ID_EDIT_REPEAT          "Repeat the last action\nRepeat"
+    ID_EDIT_REPLACE         "Replace specific text with different text\nReplace"
+    ID_EDIT_SELECT_ALL      "Select the entire document\nSelect All"
+    ID_EDIT_UNDO            "Undo the last action\nUndo"
+    ID_EDIT_REDO            "Redo the previously undone action\nRedo"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_VIEW_TOOLBAR         "Show or hide the toolbar\nToggle ToolBar"
+    ID_VIEW_STATUS_BAR      "Show or hide the status bar\nToggle StatusBar"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_OLE_INSERT_NEW       "Insert new embedded object\nNew Object"
+    ID_OLE_EDIT_LINKS       "Edit linked objects\nEdit Links"
+    ID_OLE_EDIT_CONVERT     "Convert object to different type\nConvert Object"
+END
+
+STRINGTABLE 
+BEGIN
+    ID_OLE_VERB_FIRST       "Activate embedded or linked object"
+    57873                   "Activate embedded or linked object"
+    57874                   "Activate embedded or linked object"
+    57875                   "Activate embedded or linked object"
+END
+
+STRINGTABLE 
+BEGIN
+    AFX_IDS_SCSIZE          "Change the window size"
+    AFX_IDS_SCMOVE          "Change the window position"
+    AFX_IDS_SCMINIMIZE      "Reduce the window to an icon"
+    AFX_IDS_SCMAXIMIZE      "Enlarge the window to full size"
+    AFX_IDS_SCNEXTWINDOW    "Switch to the next document window"
+    AFX_IDS_SCPREVWINDOW    "Switch to the previous document window"
+    AFX_IDS_SCCLOSE         "Close the active window and prompts to save the documents"
+END
+
+STRINGTABLE 
+BEGIN
+    AFX_IDS_SCRESTORE       "Restore the window to normal size"
+    AFX_IDS_SCTASKLIST      "Activate Task List"
+    AFX_IDS_MDICHILD        "Activate this window"
+END
+
+STRINGTABLE 
+BEGIN
+    AFX_IDS_PREVIEW_CLOSE   "Close print preview mode\nCancel Preview"
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\TestProg.rc2"  // non-Microsoft Visual C++ edited resources
+#include "afxres.rc"         // Standard components
+#include "afxprint.rc"       // printing/print preview resources
+#include "afxolecl.rc"       // OLE container resources
+#include "afxolesv.rc"       // OLE server resources
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
Index: /trunk/MFCtooling/TestProg/TestProg.reg
===================================================================
--- /trunk/MFCtooling/TestProg/TestProg.reg	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProg.reg	(revision 32)
@@ -0,0 +1,27 @@
+REGEDIT
+; This .REG file may be used by your SETUP program.
+;   If a SETUP program is not available, the entries below will be
+;   registered in your InitInstance automatically with a call to
+;   CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.
+
+
+HKEY_CLASSES_ROOT\TestProg.Document = TestProg.Document
+
+
+HKEY_CLASSES_ROOT\TestProg.Document\protocol\StdFileEditing\server = TestProg.EXE
+HKEY_CLASSES_ROOT\TestProg.Document\protocol\StdFileEditing\verb\0 = &Edit
+HKEY_CLASSES_ROOT\TestProg.Document\Insertable =
+HKEY_CLASSES_ROOT\TestProg.Document\CLSID = {81A5B9DA-E0DC-4E02-9097-38F90D423C7B}
+
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B} = TestProg.Document
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\DefaultIcon = TestProg.EXE,1
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\LocalServer32 = TestProg.EXE
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\ProgId = TestProg.Document
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\MiscStatus = 32
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\AuxUserType\3 = TestProg
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\AuxUserType\2 = TestProg
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\Insertable = 
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\verb\1 = &Open,0,2
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\verb\0 = &Edit,0,2
+HKEY_CLASSES_ROOT\CLSID\{81A5B9DA-E0DC-4E02-9097-38F90D423C7B}\InprocHandler32 = ole32.dll
+
Index: /trunk/MFCtooling/TestProg/TestProg.vcproj
===================================================================
--- /trunk/MFCtooling/TestProg/TestProg.vcproj	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProg.vcproj	(revision 32)
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="TestProg"
+	ProjectGUID="{98889796-F392-4C4F-A619-BD2C1509B392}"
+	RootNamespace="TestProg"
+	Keyword="MFCProj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			UseOfMFC="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+				ValidateParameters="true"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="true"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			UseOfMFC="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+				ValidateParameters="true"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+				MinimalRebuild="false"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="true"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\ChildFrm.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\CntrItem.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\IpFrame.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\MainFrm.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SrvrItem.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\TestProg.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\TestProgDoc.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\TestProgView.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\ChildFrm.h"
+				>
+			</File>
+			<File
+				RelativePath=".\CntrItem.h"
+				>
+			</File>
+			<File
+				RelativePath=".\IpFrame.h"
+				>
+			</File>
+			<File
+				RelativePath=".\MainFrm.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Resource.h"
+				>
+			</File>
+			<File
+				RelativePath=".\SrvrItem.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestProg.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestProgDoc.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestProgView.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\res\IToolbar.bmp"
+				>
+			</File>
+			<File
+				RelativePath=".\res\TestProg.ico"
+				>
+			</File>
+			<File
+				RelativePath=".\TestProg.rc"
+				>
+			</File>
+			<File
+				RelativePath=".\res\TestProg.rc2"
+				>
+			</File>
+			<File
+				RelativePath=".\res\TestProgDoc.ico"
+				>
+			</File>
+			<File
+				RelativePath=".\res\Toolbar.bmp"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+		<File
+			RelativePath=".\TestProg.reg"
+			>
+		</File>
+	</Files>
+	<Globals>
+		<Global
+			Name="RESOURCE_FILE"
+			Value="TestProg.rc"
+		/>
+	</Globals>
+</VisualStudioProject>
Index: /trunk/MFCtooling/TestProg/TestProgDoc.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/TestProgDoc.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProgDoc.cpp	(revision 32)
@@ -0,0 +1,108 @@
+// TestProgDoc.cpp : implementation of the CTestProgDoc class
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "TestProgDoc.h"
+#include "CntrItem.h"
+#include "SrvrItem.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CTestProgDoc
+
+IMPLEMENT_DYNCREATE(CTestProgDoc, COleServerDoc)
+
+BEGIN_MESSAGE_MAP(CTestProgDoc, COleServerDoc)
+	// Enable default OLE container implementation
+	ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, &COleServerDoc::OnUpdatePasteMenu)
+	ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE_LINK, &COleServerDoc::OnUpdatePasteLinkMenu)
+	ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_CONVERT, &COleServerDoc::OnUpdateObjectVerbMenu)
+	ON_COMMAND(ID_OLE_EDIT_CONVERT, &COleServerDoc::OnEditConvert)
+	ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_LINKS, &COleServerDoc::OnUpdateEditLinksMenu)
+	ON_COMMAND(ID_OLE_EDIT_LINKS, &COleServerDoc::OnEditLinks)
+	ON_UPDATE_COMMAND_UI_RANGE(ID_OLE_VERB_FIRST, ID_OLE_VERB_LAST, &COleServerDoc::OnUpdateObjectVerbMenu)
+END_MESSAGE_MAP()
+
+
+// CTestProgDoc construction/destruction
+
+CTestProgDoc::CTestProgDoc()
+{
+	// Use OLE compound files
+	EnableCompoundFile();
+
+	// TODO: add one-time construction code here
+
+}
+
+CTestProgDoc::~CTestProgDoc()
+{
+}
+
+BOOL CTestProgDoc::OnNewDocument()
+{
+	if (!COleServerDoc::OnNewDocument())
+		return FALSE;
+
+	// TODO: add reinitialization code here
+	// (SDI documents will reuse this document)
+
+	return TRUE;
+}
+
+
+// CTestProgDoc server implementation
+
+COleServerItem* CTestProgDoc::OnGetEmbeddedItem()
+{
+	// OnGetEmbeddedItem is called by the framework to get the COleServerItem
+	//  that is associated with the document.  It is only called when necessary.
+
+	CTestProgSrvrItem* pItem = new CTestProgSrvrItem(this);
+	ASSERT_VALID(pItem);
+	return pItem;
+}
+
+
+
+
+// CTestProgDoc serialization
+
+void CTestProgDoc::Serialize(CArchive& ar)
+{
+	if (ar.IsStoring())
+	{
+		// TODO: add storing code here
+	}
+	else
+	{
+		// TODO: add loading code here
+	}
+
+	// Calling the base class COleServerDoc enables serialization
+	//  of the container document's COleClientItem objects.
+	COleServerDoc::Serialize(ar);
+}
+
+
+// CTestProgDoc diagnostics
+
+#ifdef _DEBUG
+void CTestProgDoc::AssertValid() const
+{
+	COleServerDoc::AssertValid();
+}
+
+void CTestProgDoc::Dump(CDumpContext& dc) const
+{
+	COleServerDoc::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CTestProgDoc commands
Index: /trunk/MFCtooling/TestProg/TestProgDoc.h
===================================================================
--- /trunk/MFCtooling/TestProg/TestProgDoc.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProgDoc.h	(revision 32)
@@ -0,0 +1,46 @@
+// TestProgDoc.h : interface of the CTestProgDoc class
+//
+
+
+#pragma once
+
+
+class CTestProgSrvrItem;
+
+class CTestProgDoc : public COleServerDoc
+{
+protected: // create from serialization only
+	CTestProgDoc();
+	DECLARE_DYNCREATE(CTestProgDoc)
+
+// Attributes
+public:
+	CTestProgSrvrItem* GetEmbeddedItem()
+		{ return reinterpret_cast<CTestProgSrvrItem*>(COleServerDoc::GetEmbeddedItem()); }
+
+// Operations
+public:
+
+// Overrides
+protected:
+	virtual COleServerItem* OnGetEmbeddedItem();
+public:
+	virtual BOOL OnNewDocument();
+	virtual void Serialize(CArchive& ar);
+
+// Implementation
+public:
+	virtual ~CTestProgDoc();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// Generated message map functions
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+
Index: /trunk/MFCtooling/TestProg/TestProgView.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/TestProgView.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProgView.cpp	(revision 32)
@@ -0,0 +1,287 @@
+// TestProgView.cpp : implementation of the CTestProgView class
+//
+
+#include "stdafx.h"
+#include "TestProg.h"
+
+#include "TestProgDoc.h"
+#include "CntrItem.h"
+#include "TestProgView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CTestProgView
+
+IMPLEMENT_DYNCREATE(CTestProgView, CView)
+
+BEGIN_MESSAGE_MAP(CTestProgView, CView)
+	ON_WM_DESTROY()
+	ON_WM_SETFOCUS()
+	ON_WM_SIZE()
+	ON_COMMAND(ID_OLE_INSERT_NEW, &CTestProgView::OnInsertObject)
+	ON_COMMAND(ID_CANCEL_EDIT_CNTR, &CTestProgView::OnCancelEditCntr)
+	ON_COMMAND(ID_FILE_PRINT, &CTestProgView::OnFilePrint)
+	ON_COMMAND(ID_CANCEL_EDIT_SRVR, &CTestProgView::OnCancelEditSrvr)
+	ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
+	ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CView::OnFilePrintPreview)
+END_MESSAGE_MAP()
+
+// CTestProgView construction/destruction
+
+CTestProgView::CTestProgView()
+{
+	m_pSelection = NULL;
+	// TODO: add construction code here
+
+}
+
+CTestProgView::~CTestProgView()
+{
+}
+
+BOOL CTestProgView::PreCreateWindow(CREATESTRUCT& cs)
+{
+	// TODO: Modify the Window class or styles here by modifying
+	//  the CREATESTRUCT cs
+
+	return CView::PreCreateWindow(cs);
+}
+
+// CTestProgView drawing
+
+void CTestProgView::OnDraw(CDC* pDC)
+{
+	if (!pDC)
+		return;
+
+	CTestProgDoc* pDoc = GetDocument();
+	ASSERT_VALID(pDoc);
+	if (!pDoc)
+		return;
+
+	// TODO: add draw code for native data here
+	// TODO: also draw all OLE items in the document
+
+	// Draw the selection at an arbitrary position.  This code should be
+	//  removed once your real drawing code is implemented.  This position
+	//  corresponds exactly to the rectangle returned by CTestProgCntrItem,
+	//  to give the effect of in-place editing.
+
+	// TODO: remove this code when final draw code is complete.
+	if (m_pSelection != NULL)
+	{
+		CSize size;
+		CRect rect(10, 10, 210, 210);
+		
+		if (m_pSelection->GetExtent(&size, m_pSelection->m_nDrawAspect))
+		{
+			pDC->HIMETRICtoLP(&size);
+			rect.right = size.cx + 10;
+			rect.bottom = size.cy + 10;
+		}
+		m_pSelection->Draw(pDC, rect);
+	}
+}
+
+void CTestProgView::OnInitialUpdate()
+{
+	CView::OnInitialUpdate();
+
+
+	// TODO: remove this code when final selection model code is written
+	m_pSelection = NULL;    // initialize selection
+
+}
+
+
+// CTestProgView printing
+
+BOOL CTestProgView::OnPreparePrinting(CPrintInfo* pInfo)
+{
+	// default preparation
+	return DoPreparePrinting(pInfo);
+}
+
+void CTestProgView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+	// TODO: add extra initialization before printing
+}
+
+void CTestProgView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+	// TODO: add cleanup after printing
+}
+
+void CTestProgView::OnDestroy()
+{
+	// Deactivate the item on destruction; this is important
+	// when a splitter view is being used
+   COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
+   if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
+   {
+      pActiveItem->Deactivate();
+      ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
+   }
+   CView::OnDestroy();
+}
+
+
+
+// OLE Client support and commands
+
+BOOL CTestProgView::IsSelected(const CObject* pDocItem) const
+{
+	// The implementation below is adequate if your selection consists of
+	//  only CTestProgCntrItem objects.  To handle different selection
+	//  mechanisms, the implementation here should be replaced
+
+	// TODO: implement this function that tests for a selected OLE client item
+
+	return pDocItem == m_pSelection;
+}
+
+void CTestProgView::OnInsertObject()
+{
+	// Invoke the standard Insert Object dialog box to obtain information
+	//  for new CTestProgCntrItem object
+	COleInsertDialog dlg;
+	if (dlg.DoModal() != IDOK)
+		return;
+
+	BeginWaitCursor();
+
+	CTestProgCntrItem* pItem = NULL;
+	TRY
+	{
+		// Create new item connected to this document
+		CTestProgDoc* pDoc = GetDocument();
+		ASSERT_VALID(pDoc);
+		pItem = new CTestProgCntrItem(pDoc);
+		ASSERT_VALID(pItem);
+
+		// Initialize the item from the dialog data
+		if (!dlg.CreateItem(pItem))
+			AfxThrowMemoryException();  // any exception will do
+		ASSERT_VALID(pItem);
+		
+        if (dlg.GetSelectionType() == COleInsertDialog::createNewItem)
+			pItem->DoVerb(OLEIVERB_SHOW, this);
+
+		ASSERT_VALID(pItem);
+		// As an arbitrary user interface design, this sets the selection
+		//  to the last item inserted
+
+		// TODO: reimplement selection as appropriate for your application
+		m_pSelection = pItem;   // set selection to last inserted item
+		pDoc->UpdateAllViews(NULL);
+	}
+	CATCH(CException, e)
+	{
+		if (pItem != NULL)
+		{
+			ASSERT_VALID(pItem);
+			pItem->Delete();
+		}
+		AfxMessageBox(IDP_FAILED_TO_CREATE);
+	}
+	END_CATCH
+
+	EndWaitCursor();
+}
+
+// The following command handler provides the standard keyboard
+//  user interface to cancel an in-place editing session.  Here,
+//  the container (not the server) causes the deactivation
+void CTestProgView::OnCancelEditCntr()
+{
+	// Close any in-place active item on this view.
+	COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
+	if (pActiveItem != NULL)
+	{
+		pActiveItem->Close();
+	}
+	ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
+}
+
+// Special handling of OnSetFocus and OnSize are required for a container
+//  when an object is being edited in-place
+void CTestProgView::OnSetFocus(CWnd* pOldWnd)
+{
+	COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
+	if (pActiveItem != NULL &&
+		pActiveItem->GetItemState() == COleClientItem::activeUIState)
+	{
+		// need to set focus to this item if it is in the same view
+		CWnd* pWnd = pActiveItem->GetInPlaceWindow();
+		if (pWnd != NULL)
+		{
+			pWnd->SetFocus();   // don't call the base class
+			return;
+		}
+	}
+
+	CView::OnSetFocus(pOldWnd);
+}
+
+void CTestProgView::OnSize(UINT nType, int cx, int cy)
+{
+	CView::OnSize(nType, cx, cy);
+	COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
+	if (pActiveItem != NULL)
+		pActiveItem->SetItemRects();
+}
+
+void CTestProgView::OnFilePrint()
+{
+	//By default, we ask the Active document to print itself
+	//using IOleCommandTarget. If you don't want this behavior
+	//remove the call to COleDocObjectItem::DoDefaultPrinting.
+	//If the call fails for some reason, we will try printing
+	//the docobject using the IPrint interface.
+	CPrintInfo printInfo;
+	ASSERT(printInfo.m_pPD != NULL); 
+	if (S_OK == COleDocObjectItem::DoDefaultPrinting(this, &printInfo))
+		return;
+	
+	CView::OnFilePrint();
+
+}
+
+
+
+// OLE Server support
+
+// The following command handler provides the standard keyboard
+//  user interface to cancel an in-place editing session.  Here,
+//  the server (not the container) causes the deactivation
+void CTestProgView::OnCancelEditSrvr()
+{
+	GetDocument()->OnDeactivateUI(FALSE);
+}
+
+
+// CTestProgView diagnostics
+
+#ifdef _DEBUG
+void CTestProgView::AssertValid() const
+{
+	CView::AssertValid();
+}
+
+void CTestProgView::Dump(CDumpContext& dc) const
+{
+	CView::Dump(dc);
+}
+
+CTestProgDoc* CTestProgView::GetDocument() const // non-debug version is inline
+{
+	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestProgDoc)));
+	return (CTestProgDoc*)m_pDocument;
+}
+#endif //_DEBUG
+
+
+// CTestProgView message handlers
Index: /trunk/MFCtooling/TestProg/TestProgView.h
===================================================================
--- /trunk/MFCtooling/TestProg/TestProgView.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/TestProgView.h	(revision 32)
@@ -0,0 +1,67 @@
+// TestProgView.h : interface of the CTestProgView class
+//
+
+
+#pragma once
+
+class CTestProgCntrItem;
+
+class CTestProgView : public CView
+{
+protected: // create from serialization only
+	CTestProgView();
+	DECLARE_DYNCREATE(CTestProgView)
+
+// Attributes
+public:
+	CTestProgDoc* GetDocument() const;
+	// m_pSelection holds the selection to the current CTestProgCntrItem.
+	// For many applications, such a member variable isn't adequate to
+	//  represent a selection, such as a multiple selection or a selection
+	//  of objects that are not CTestProgCntrItem objects.  This selection
+	//  mechanism is provided just to help you get started
+
+	// TODO: replace this selection mechanism with one appropriate to your app
+	CTestProgCntrItem* m_pSelection;
+
+// Operations
+public:
+
+// Overrides
+public:
+	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+protected:
+	virtual void OnInitialUpdate(); // called first time after construct
+	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
+	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
+	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
+	virtual BOOL IsSelected(const CObject* pDocItem) const;// Container support
+
+// Implementation
+public:
+	virtual ~CTestProgView();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// Generated message map functions
+protected:
+	afx_msg void OnDestroy();
+	afx_msg void OnSetFocus(CWnd* pOldWnd);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnInsertObject();
+	afx_msg void OnCancelEditCntr();
+	afx_msg void OnFilePrint();
+	afx_msg void OnCancelEditSrvr();
+	DECLARE_MESSAGE_MAP()
+};
+
+#ifndef _DEBUG  // debug version in TestProgView.cpp
+inline CTestProgDoc* CTestProgView::GetDocument() const
+   { return reinterpret_cast<CTestProgDoc*>(m_pDocument); }
+#endif
+
Index: /trunk/MFCtooling/TestProg/res/TestProg.rc2
===================================================================
--- /trunk/MFCtooling/TestProg/res/TestProg.rc2	(revision 32)
+++ /trunk/MFCtooling/TestProg/res/TestProg.rc2	(revision 32)
@@ -0,0 +1,13 @@
+//
+// TestProg.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
Index: /trunk/MFCtooling/TestProg/resource.h
===================================================================
--- /trunk/MFCtooling/TestProg/resource.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/resource.h	(revision 32)
@@ -0,0 +1,33 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by TestProg.rc
+//
+#define IDR_TestProgTYPE_SRVR_IP        4
+#define IDR_TestProgTYPE_SRVR_EMB       5
+#define IDR_TestProgTYPE_CNTR_IP        6
+#define IDD_ABOUTBOX                    100
+#define IDP_OLE_INIT_FAILED             100
+#define IDP_FAILED_TO_CREATE            102
+#define IDR_MAINFRAME                   128
+#define IDR_TestProgTYPE                129
+#define IDC_EDIT1                       1000
+#define IDC_CHECK1                      1001
+#define IDC_COMBO1                      1002
+#define IDC_RADIO1                      1003
+#define IDC_RADIO2                      1004
+#define IDC_RADIO3                      1005
+#define IDC_SLIDER1                     1006
+#define IDC_SPIN1                       1007
+#define ID_CANCEL_EDIT_CNTR             32768
+#define ID_CANCEL_EDIT_SRVR             32769
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        131
+#define _APS_NEXT_COMMAND_VALUE         32771
+#define _APS_NEXT_CONTROL_VALUE         1008
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
Index: /trunk/MFCtooling/TestProg/stdafx.cpp
===================================================================
--- /trunk/MFCtooling/TestProg/stdafx.cpp	(revision 32)
+++ /trunk/MFCtooling/TestProg/stdafx.cpp	(revision 32)
@@ -0,0 +1,7 @@
+// stdafx.cpp : source file that includes just the standard includes
+// TestProg.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
Index: /trunk/MFCtooling/TestProg/stdafx.h
===================================================================
--- /trunk/MFCtooling/TestProg/stdafx.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/stdafx.h	(revision 32)
@@ -0,0 +1,59 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC core and standard components
+#include <afxext.h>         // MFC extensions
+
+#include <afxole.h>         // MFC OLE classes
+#include <afxodlgs.h>       // MFC OLE dialog classes
+
+#include <afxdisp.h>        // MFC Automation classes
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC support for Internet Explorer 4 Common Controls
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
Index: /trunk/MFCtooling/TestProg/targetver.h
===================================================================
--- /trunk/MFCtooling/TestProg/targetver.h	(revision 32)
+++ /trunk/MFCtooling/TestProg/targetver.h	(revision 32)
@@ -0,0 +1,26 @@
+
+#pragma once
+
+// The following macros define the minimum required platform.  The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 
+// your application.  The macros work by enabling all features available on platform versions up to and 
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER                          // Specifies that the minimum required platform is Windows Vista.
+#define WINVER 0x0600           // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS          // Specifies that the minimum required platform is Windows 98.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE                       // Specifies that the minimum required platform is Internet Explorer 7.0.
+#define _WIN32_IE 0x0700        // Change this to the appropriate value to target other versions of IE.
+#endif
+
Index: /trunk/MFCtooling/mfctooling.sln
===================================================================
--- /trunk/MFCtooling/mfctooling.sln	(revision 32)
+++ /trunk/MFCtooling/mfctooling.sln	(revision 32)
@@ -0,0 +1,35 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "userlog", "userlog\userlog.vcproj", "{A881CC90-25D4-4D76-A30D-C8CA09A3434D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestProg", "TestProg\TestProg.vcproj", "{98889796-F392-4C4F-A619-BD2C1509B392}"
+	ProjectSection(ProjectDependencies) = postProject
+		{A881CC90-25D4-4D76-A30D-C8CA09A3434D} = {A881CC90-25D4-4D76-A30D-C8CA09A3434D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replay", "replay\replay.vcproj", "{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A881CC90-25D4-4D76-A30D-C8CA09A3434D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A881CC90-25D4-4D76-A30D-C8CA09A3434D}.Debug|Win32.Build.0 = Debug|Win32
+		{A881CC90-25D4-4D76-A30D-C8CA09A3434D}.Release|Win32.ActiveCfg = Release|Win32
+		{A881CC90-25D4-4D76-A30D-C8CA09A3434D}.Release|Win32.Build.0 = Release|Win32
+		{98889796-F392-4C4F-A619-BD2C1509B392}.Debug|Win32.ActiveCfg = Debug|Win32
+		{98889796-F392-4C4F-A619-BD2C1509B392}.Debug|Win32.Build.0 = Debug|Win32
+		{98889796-F392-4C4F-A619-BD2C1509B392}.Release|Win32.ActiveCfg = Release|Win32
+		{98889796-F392-4C4F-A619-BD2C1509B392}.Release|Win32.Build.0 = Release|Win32
+		{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}.Debug|Win32.Build.0 = Debug|Win32
+		{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}.Release|Win32.ActiveCfg = Release|Win32
+		{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Index: /trunk/MFCtooling/replay/LogParser.cpp
===================================================================
--- /trunk/MFCtooling/replay/LogParser.cpp	(revision 32)
+++ /trunk/MFCtooling/replay/LogParser.cpp	(revision 32)
@@ -0,0 +1,135 @@
+#include "StdAfx.h"
+#include "LogParser.h"
+
+#include <iostream>
+
+#include "WindowFinder.h"
+
+LogParser::LogParser(void)
+{
+	
+}
+
+LogParser::~LogParser(void)
+{
+	
+}
+
+
+HRESULT STDMETHODCALLTYPE LogParser::startElement( 
+			wchar_t __RPC_FAR *pwchNamespaceUri,
+			int cchNamespaceUri,
+			wchar_t __RPC_FAR *pwchLocalName,
+			int cchLocalName,
+			wchar_t __RPC_FAR *pwchRawName,
+			int cchRawName,
+			MSXML2::ISAXAttributes __RPC_FAR *pAttributes)
+{
+	std::wstring localName(pwchLocalName);
+	if( localName.compare(L"session")==0 ) {
+		// TODO
+	}
+	else if( localName.compare(L"msg")==0 ) {
+		std::wstring type = GetAttributeValue(pAttributes, L"type", L"");
+		msgType = _wtoi(type.c_str());
+		std::wstring lParamStr = GetAttributeValue(pAttributes, L"LPARAM", L"");
+		lParam = _wtoi(lParamStr.c_str());
+		std::wstring wParamStr = GetAttributeValue(pAttributes, L"WPARAM", L"");
+		wParam = _wtoi(wParamStr.c_str());
+		std::wstring delayStr = GetAttributeValue(pAttributes, L"delay", L"");
+		delay = _wtoi(delayStr.c_str());
+		currentWindow = NULL;
+		currentParent = NULL;
+	}
+	else if( localName.compare(L"window")==0 ) {
+		WindowData * winData = new WindowData;
+		winData->name = GetAttributeValue(pAttributes, L"name", L"");
+		winData->className = GetAttributeValue(pAttributes, L"class", L"");
+		std::wstring resourceIdStr = GetAttributeValue(pAttributes, L"resourceId", L"");
+		winData->resourceId = _wtoi(resourceIdStr.c_str());
+		std::wstring isModalStr = GetAttributeValue(pAttributes, L"isModal", L"");
+		if( isModalStr.compare(L"true")==0 ) {
+			winData->isModal = true;
+		} else {
+			winData->isModal = false;
+		}
+		winData->child = NULL;
+		if( currentWindow==NULL ) {
+			currentWindow = winData;
+		} else {
+			currentParent->child = winData;
+		}
+		currentParent = winData;
+	} 
+	return S_OK;
+}
+
+
+HRESULT STDMETHODCALLTYPE LogParser::endElement( 
+			wchar_t __RPC_FAR *pwchNamespaceUri,
+			int cchNamespaceUri,
+			wchar_t __RPC_FAR *pwchLocalName,
+			int cchLocalName,
+			wchar_t __RPC_FAR *pwchRawName,
+			int cchRawName)
+{
+	std::wstring localName(pwchLocalName);
+	if( localName.compare(L"session")==0 ) {
+		// TODO
+	} 
+	else if( localName.compare(L"msg")==0 ) {
+		WindowFinder finder;
+		HWND hwnd = finder.find(currentWindow);
+		sendMessage(hwnd);
+		deleteWindowData(currentWindow);
+		currentWindow = NULL;
+	} 
+	else if( localName.compare(L"LPARAM")==0 ) {
+		WindowFinder finder;
+		HWND hwnd = finder.find(currentWindow);
+		lParam = (LPARAM) hwnd;
+		deleteWindowData(currentWindow);
+		currentWindow = NULL;
+	}
+	else if( localName.compare(L"WPARAM")==0 ) {
+		WindowFinder finder;
+		HWND hwnd = finder.find(currentWindow);
+		wParam = (WPARAM) hwnd;
+		deleteWindowData(currentWindow);
+		currentWindow = NULL;
+	}
+	return S_OK;
+}
+
+std::wstring LogParser::GetAttributeValue(MSXML2::ISAXAttributes __RPC_FAR *pAttributes,
+							   std::wstring name, std::wstring defvalue)
+{
+	// get the number of attributes
+	int length = 0;
+	pAttributes->getLength(&length);
+
+	// enumerate over all attributes
+	for ( int i=0; i<length; i++ ) 
+	{
+		wchar_t *attrname = NULL, * attrvalue = NULL;
+		int namelen = 0, valuelen = 0;
+
+		// get the local name of the current attribute
+		pAttributes->getLocalName(i,&attrname,&namelen);
+		// get the value of the current attribute
+		pAttributes->getValue(i,&attrvalue,&valuelen);
+		// if current attribute is the one needed return its value
+		if(name.compare(std::wstring(attrname,namelen)) == 0)
+			return std::wstring(attrvalue, valuelen);
+	}
+
+	// attribute not found; return the default value
+	return defvalue;
+}
+
+void LogParser::sendMessage(HWND hwnd) {
+	std::wcout << L"Sending " << msgType << L" to " << hwnd << "L - LPARAM: " << lParam << L" - WPARAM: " << wParam << std::endl;
+	PostMessage(hwnd, msgType, wParam, lParam);
+	Sleep(defaultMsgDelay);
+	//Sleep(delay);
+}
Index: /trunk/MFCtooling/replay/LogParser.h
===================================================================
--- /trunk/MFCtooling/replay/LogParser.h	(revision 32)
+++ /trunk/MFCtooling/replay/LogParser.h	(revision 32)
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "SAXContentHandlerImpl.h"
+#include <string>
+
+#include "WindowData.h"
+
+class LogParser : public SAXContentHandlerImpl
+{
+private:
+	static const int defaultMsgDelay = 2000;
+	WindowData * currentWindow;
+	WindowData * currentParent;
+
+	int msgType;
+	LPARAM lParam;
+	WPARAM wParam;
+
+	int delay;
+
+	void sendMessage(HWND hwnd);
+
+public:
+	LogParser(void);
+	~LogParser(void);
+
+	virtual HRESULT STDMETHODCALLTYPE startElement( 
+			wchar_t __RPC_FAR *pwchNamespaceUri,
+			int cchNamespaceUri,
+			wchar_t __RPC_FAR *pwchLocalName,
+			int cchLocalName,
+			wchar_t __RPC_FAR *pwchRawName,
+			int cchRawName,
+			MSXML2::ISAXAttributes __RPC_FAR *pAttributes);
+
+	virtual HRESULT STDMETHODCALLTYPE endElement( 
+			wchar_t __RPC_FAR *pwchNamespaceUri,
+			int cchNamespaceUri,
+			wchar_t __RPC_FAR *pwchLocalName,
+			int cchLocalName,
+			wchar_t __RPC_FAR *pwchRawName,
+			int cchRawName);
+
+	std::wstring GetAttributeValue(MSXML2::ISAXAttributes __RPC_FAR *pAttributes,
+							   std::wstring name, std::wstring defvalue);
+
+
+	int getDefaultMsgDelay();
+};
Index: /trunk/MFCtooling/replay/SAXContentHandlerImpl.h
===================================================================
--- /trunk/MFCtooling/replay/SAXContentHandlerImpl.h	(revision 32)
+++ /trunk/MFCtooling/replay/SAXContentHandlerImpl.h	(revision 32)
@@ -0,0 +1,104 @@
+#pragma once
+
+
+class SAXContentHandlerImpl : public MSXML2::ISAXContentHandler  
+{
+	long m_RefCount;
+public:
+	SAXContentHandlerImpl():m_RefCount(0) {}
+	virtual ~SAXContentHandlerImpl() {}
+
+	long __stdcall QueryInterface(const struct _GUID &riid, void ** ppObj)
+		{ 
+			if (riid == IID_IUnknown)
+			{
+				*ppObj = static_cast<IUnknown*>(this);
+			}
+			if (riid == __uuidof(ISAXContentHandler))
+			{
+				*ppObj = static_cast<ISAXContentHandler*>(this);
+			}
+			else
+			{
+				*ppObj = NULL ;
+				return E_NOINTERFACE ;
+			}
+
+			AddRef() ;
+			return S_OK;
+		}
+	unsigned long __stdcall AddRef(void)
+		{
+			return InterlockedIncrement(&m_RefCount);
+		}
+	unsigned long __stdcall Release(void)
+		{
+			long nRefCount=0;
+			nRefCount=InterlockedDecrement(&m_RefCount) ;
+			if (nRefCount == 0) delete this;
+			return nRefCount;
+		}
+
+	virtual HRESULT STDMETHODCALLTYPE putDocumentLocator( 
+		MSXML2::ISAXLocator __RPC_FAR *pLocator)
+		{return S_OK;}
+
+	virtual HRESULT STDMETHODCALLTYPE startDocument( void)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE endDocument( void)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE startPrefixMapping( 
+			wchar_t __RPC_FAR *pwchPrefix,
+			int cchPrefix,
+			wchar_t __RPC_FAR *pwchUri,
+			int cchUri)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE endPrefixMapping( 
+			wchar_t __RPC_FAR *pwchPrefix,
+			int cchPrefix)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE startElement( 
+			wchar_t __RPC_FAR *pwchNamespaceUri,
+			int cchNamespaceUri,
+			wchar_t __RPC_FAR *pwchLocalName,
+			int cchLocalName,
+			wchar_t __RPC_FAR *pwchRawName,
+			int cchRawName,
+			MSXML2::ISAXAttributes __RPC_FAR *pAttributes)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE endElement( 
+			wchar_t __RPC_FAR *pwchNamespaceUri,
+			int cchNamespaceUri,
+			wchar_t __RPC_FAR *pwchLocalName,
+			int cchLocalName,
+			wchar_t __RPC_FAR *pwchRawName,
+			int cchRawName)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE characters( 
+			wchar_t __RPC_FAR *pwchChars,
+			int cchChars)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE ignorableWhitespace( 
+			wchar_t __RPC_FAR *pwchChars,
+			int cchChars)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE processingInstruction( 
+			wchar_t __RPC_FAR *pwchTarget,
+			int cchTarget,
+			wchar_t __RPC_FAR *pwchData,
+			int cchData)
+		{return S_OK;}
+        
+	virtual HRESULT STDMETHODCALLTYPE skippedEntity( 
+			wchar_t __RPC_FAR *pwchName,
+			int cchName)
+		{return S_OK;}
+};
Index: /trunk/MFCtooling/replay/WindowData.cpp
===================================================================
--- /trunk/MFCtooling/replay/WindowData.cpp	(revision 32)
+++ /trunk/MFCtooling/replay/WindowData.cpp	(revision 32)
@@ -0,0 +1,9 @@
+#include "StdAfx.h"
+#include "WindowData.h"
+
+void deleteWindowData(WindowData * winData) {
+	if( winData!=NULL ) {
+		deleteWindowData(winData->child);
+		delete winData;
+	}
+}
Index: /trunk/MFCtooling/replay/WindowData.h
===================================================================
--- /trunk/MFCtooling/replay/WindowData.h	(revision 32)
+++ /trunk/MFCtooling/replay/WindowData.h	(revision 32)
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <string>
+
+typedef struct WindowDataStruct {
+	std::wstring name;
+	std::wstring className;
+	int resourceId;
+	bool isModal;
+	WindowDataStruct * child;
+
+	/*void deleteChildren() {
+		if( child!=NULL ) {
+			child.deleteChilren();
+			delete child;
+		}
+	}*/
+} WindowData;
+
+void deleteWindowData(WindowData * winData);
Index: /trunk/MFCtooling/replay/WindowFinder.cpp
===================================================================
--- /trunk/MFCtooling/replay/WindowFinder.cpp	(revision 32)
+++ /trunk/MFCtooling/replay/WindowFinder.cpp	(revision 32)
@@ -0,0 +1,126 @@
+#include "StdAfx.h"
+#include "WindowFinder.h"
+
+#include <algorithm>
+#include <iostream>
+
+BOOL CALLBACK EnumChildren(HWND hwnd, LPARAM lParam) {
+	int resourceId = 0;
+	int windowTextLen = 128;
+	wchar_t * windowText = new wchar_t[128];
+	int classNameLen = 128;
+	wchar_t * className = new wchar_t[128];
+
+	WindowFinder * finder = (WindowFinder*) lParam;
+
+	resourceId = GetDlgCtrlID(hwnd);
+	windowTextLen = GetWindowText(hwnd, windowText, windowTextLen);
+	classNameLen = GetClassName(hwnd, className, classNameLen);
+
+	finder->setEqualityScore(hwnd,resourceId, windowText, className);
+	
+	return TRUE;
+}
+
+WindowFinder::WindowFinder()
+{
+	evalPopup = false;
+	parentHandles = NULL;
+}
+
+WindowFinder::~WindowFinder(void)
+{
+}
+
+HWND WindowFinder::find(WindowData * winData) {
+	currentWindow = winData;
+	maxScore = 0;
+	scores = new std::vector<std::pair<HWND, int>>();
+
+	if( parentHandles==NULL ) {
+		EnumWindows(EnumChildren, (LPARAM) this);
+	} else {
+		if( winData->isModal ) {
+			evalPopup = true;
+			EnumWindows(EnumChildren, (LPARAM) this);
+			evalPopup = false;
+		} else {
+			for( size_t i=0 ; i<parentHandles->size() ; i++ ) {
+				EnumChildWindows((*parentHandles)[i], EnumChildren, (LPARAM) this);
+			}
+		}
+		delete parentHandles;
+	}
+	parentHandles = new std::vector<HWND>();
+	for( size_t i=0 ; i<scores->size() ; i++ ) {
+		if( (*scores)[i].second==maxScore ) {
+			parentHandles->push_back((*scores)[i].first);
+		}
+	}
+	delete scores;
+	
+	HWND result = NULL;
+
+	if( winData->child!=NULL ) {
+		if( maxScore==0 ) {
+			std::wcerr << L"Warning: Score is zero." << std::endl;
+		}
+		result = find(winData->child);
+	} else {
+		if( parentHandles->size()==0 ) {
+			std::wcerr << L"Error: handle not found." << std::endl;
+			result = NULL;
+		}
+		else {
+			if( parentHandles->size()!=1 ) {
+				std::wcerr << L"Warning: more than one fitting window found." << std::endl;
+			}
+			if( maxScore==0 ) {
+				std::wcerr << L"Warning: Score is zero." << std::endl;
+			}
+			result = (*parentHandles)[0];
+			delete parentHandles;
+		}
+	}
+	return result;
+}
+
+
+void WindowFinder::setEqualityScore(HWND hwnd, int resourceId, wchar_t * windowName, wchar_t * className) {
+	int score = 0;
+
+	if( resourceId!=0 && currentWindow->resourceId==resourceId && currentWindow->name.compare(windowName)==0 && currentWindow->className.compare(className)==0 ) {
+		score = 6;
+	}
+	else if( resourceId!=0 && currentWindow->resourceId==resourceId && currentWindow->name.compare(windowName)==0 ) {
+		score = 5;
+	}
+	else if( resourceId!=0 && currentWindow->resourceId==resourceId ) {
+		score = 4;
+	}
+	else if( currentWindow->name.compare(windowName)==0 && currentWindow->className.compare(className)==0 ) {
+		score = 3;
+	}
+	else if( currentWindow->name.compare(windowName)==0 ) {
+		score = 2;
+	}
+	else if( currentWindow->className.compare(className)==0 ) {
+		score = 1;
+	}
+	if( evalPopup ) {
+		HWND parent = GetParent(hwnd);
+		if( std::find(parentHandles->begin(), parentHandles->end(), parent)==parentHandles->end() ) {
+			score = 0;
+		}
+	}
+
+	scores->push_back(std::make_pair(hwnd, score));
+
+	if( score>maxScore ) {
+		maxScore = score;
+	}
+}
+
+bool WindowFinder::isCurrentPopup() {
+	return evalPopup;
+}
Index: /trunk/MFCtooling/replay/WindowFinder.h
===================================================================
--- /trunk/MFCtooling/replay/WindowFinder.h	(revision 32)
+++ /trunk/MFCtooling/replay/WindowFinder.h	(revision 32)
@@ -0,0 +1,32 @@
+#pragma once
+
+#include "WindowData.h"
+#include <map>
+#include <vector>
+
+BOOL CALLBACK EnumChildren(HWND hwnd, LPARAM lParam);
+
+class WindowFinder
+{
+private:
+	WindowData * currentWindow;
+
+	std::vector<std::pair<HWND,int>> * scores;
+
+	std::vector<HWND> * parentHandles;
+
+	int maxScore;
+
+	bool evalPopup;
+
+public:
+	WindowFinder(void);
+	~WindowFinder(void);
+
+	HWND find(WindowData * winData);
+
+	void setEqualityScore(HWND hwnd, int resourceId, wchar_t * windowName, wchar_t * className);
+
+	bool isCurrentPopup();
+
+};
Index: /trunk/MFCtooling/replay/replay.cpp
===================================================================
--- /trunk/MFCtooling/replay/replay.cpp	(revision 32)
+++ /trunk/MFCtooling/replay/replay.cpp	(revision 32)
@@ -0,0 +1,56 @@
+// replay.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+#include "LogParser.h"
+#include "SAXContentHandlerImpl.h"
+#include <iostream>
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+	if (argc<2) 
+	{
+		wprintf(L"no argument provided\n");
+		return 0;
+	}
+
+	// execute application to be replayed
+	if (argc>2) {
+		std::wcout << "executing " << argv[2] << std::endl;
+		PROCESS_INFORMATION pi;
+		STARTUPINFO si;
+		ZeroMemory(&pi, sizeof(pi));
+		ZeroMemory(&si, sizeof(si));
+		CreateProcess(NULL, argv[2], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+		Sleep(10000);
+	}
+
+
+	// initialize COM library for the current thread
+	CoInitialize(NULL); 
+	MSXML2::ISAXXMLReader* pXMLReader = NULL;
+
+	// create an instance of the XML reader
+	HRESULT hr = CoCreateInstance(
+		__uuidof(MSXML2::SAXXMLReader), 
+		NULL, 
+		CLSCTX_ALL, 
+		__uuidof(MSXML2::ISAXXMLReader), 
+		(void **)&pXMLReader);
+
+	if( !FAILED(hr) ) {
+		LogParser * parser = new LogParser();
+		pXMLReader->putContentHandler(parser);
+		hr = pXMLReader->parseURL(argv[1]);
+
+		pXMLReader->Release();
+	}
+
+	CoUninitialize();
+
+	getchar();
+
+	return 0;
+}
+
Index: /trunk/MFCtooling/replay/replay.vcproj
===================================================================
--- /trunk/MFCtooling/replay/replay.vcproj	(revision 32)
+++ /trunk/MFCtooling/replay/replay.vcproj	(revision 32)
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="replay"
+	ProjectGUID="{6CDC762E-2D22-4B0F-B6CD-7F8AB432ED42}"
+	RootNamespace="replay"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				TreatWChar_tAsBuiltInType="false"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\LogParser.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\replay.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\WindowData.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\WindowFinder.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\LogParser.h"
+				>
+			</File>
+			<File
+				RelativePath=".\SAXContentHandlerImpl.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+			<File
+				RelativePath=".\WindowData.h"
+				>
+			</File>
+			<File
+				RelativePath=".\WindowFinder.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: /trunk/MFCtooling/replay/stdafx.cpp
===================================================================
--- /trunk/MFCtooling/replay/stdafx.cpp	(revision 32)
+++ /trunk/MFCtooling/replay/stdafx.cpp	(revision 32)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// replay2.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
Index: /trunk/MFCtooling/replay/stdafx.h
===================================================================
--- /trunk/MFCtooling/replay/stdafx.h	(revision 32)
+++ /trunk/MFCtooling/replay/stdafx.h	(revision 32)
@@ -0,0 +1,16 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include <stdio.h>
+#include <tchar.h>
+#include <windows.h>
+
+#import <msxml3.dll> raw_interfaces_only
+
+// TODO: reference additional headers your program requires here
Index: /trunk/MFCtooling/replay/targetver.h
===================================================================
--- /trunk/MFCtooling/replay/targetver.h	(revision 32)
+++ /trunk/MFCtooling/replay/targetver.h	(revision 32)
@@ -0,0 +1,13 @@
+#pragma once
+
+// The following macros define the minimum required platform.  The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 
+// your application.  The macros work by enabling all features available on platform versions up to and 
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
+#endif
+
Index: /trunk/MFCtooling/userlog/ClassDiagram1.cd
===================================================================
--- /trunk/MFCtooling/userlog/ClassDiagram1.cd	(revision 32)
+++ /trunk/MFCtooling/userlog/ClassDiagram1.cd	(revision 32)
@@ -0,0 +1,1 @@
+ 
Index: /trunk/MFCtooling/userlog/ReadMe.txt
===================================================================
--- /trunk/MFCtooling/userlog/ReadMe.txt	(revision 32)
+++ /trunk/MFCtooling/userlog/ReadMe.txt	(revision 32)
@@ -0,0 +1,33 @@
+========================================================================
+    DYNAMIC LINK LIBRARY : userlog Project Overview
+========================================================================
+
+AppWizard has created this userlog DLL for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your userlog application.
+
+
+userlog.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard.
+    It contains information about the version of Visual C++ that generated the file, and
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+userlog.cpp
+    This is the main DLL source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named userlog.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
Index: /trunk/MFCtooling/userlog/cencode.cpp
===================================================================
--- /trunk/MFCtooling/userlog/cencode.cpp	(revision 32)
+++ /trunk/MFCtooling/userlog/cencode.cpp	(revision 32)
@@ -0,0 +1,104 @@
+#include "stdafx.h"
+
+#include "encode.h"
+
+const int CHARS_PER_LINE = 950;
+
+void base64_init_encodestate(base64_encodestate* state_in)
+{
+	state_in->step = step_A;
+	state_in->result = 0;
+	state_in->stepcount = 0;
+}
+
+char base64_encode_value(char value_in)
+{
+	static const char* encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+	if (value_in > 63) return '=';
+	return encoding[(int)value_in];
+}
+
+int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in)
+{
+	const char* plainchar = plaintext_in;
+	const char* const plaintextend = plaintext_in + length_in;
+	char* codechar = code_out;
+	char result;
+	char fragment;
+	
+	result = state_in->result;
+	
+	switch (state_in->step)
+	{
+		while (1)
+		{
+	case step_A:
+			if (plainchar == plaintextend)
+			{
+				state_in->result = result;
+				state_in->step = step_A;
+				return codechar - code_out;
+			}
+			fragment = *plainchar++;
+			result = (fragment & 0x0fc) >> 2;
+			*codechar++ = base64_encode_value(result);
+			result = (fragment & 0x003) << 4;
+	case step_B:
+			if (plainchar == plaintextend)
+			{
+				state_in->result = result;
+				state_in->step = step_B;
+				return codechar - code_out;
+			}
+			fragment = *plainchar++;
+			result |= (fragment & 0x0f0) >> 4;
+			*codechar++ = base64_encode_value(result);
+			result = (fragment & 0x00f) << 2;
+	case step_C:
+			if (plainchar == plaintextend)
+			{
+				state_in->result = result;
+				state_in->step = step_C;
+				return codechar - code_out;
+			}
+			fragment = *plainchar++;
+			result |= (fragment & 0x0c0) >> 6;
+			*codechar++ = base64_encode_value(result);
+			result  = (fragment & 0x03f) >> 0;
+			*codechar++ = base64_encode_value(result);
+			
+			++(state_in->stepcount);
+			if (state_in->stepcount == CHARS_PER_LINE/4)
+			{
+				*codechar++ = '\n';
+				state_in->stepcount = 0;
+			}
+		}
+	}
+	/* control should not reach here */
+	return codechar - code_out;
+}
+
+int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
+{
+	char* codechar = code_out;
+	
+	switch (state_in->step)
+	{
+	case step_B:
+		*codechar++ = base64_encode_value(state_in->result);
+		*codechar++ = '=';
+		*codechar++ = '=';
+		break;
+	case step_C:
+		*codechar++ = base64_encode_value(state_in->result);
+		*codechar++ = '=';
+		break;
+	case step_A:
+		break;
+	}
+	*codechar++ = '\n';
+	
+	return codechar - code_out;
+}
+
Index: /trunk/MFCtooling/userlog/cencode.h
===================================================================
--- /trunk/MFCtooling/userlog/cencode.h	(revision 32)
+++ /trunk/MFCtooling/userlog/cencode.h	(revision 32)
@@ -0,0 +1,31 @@
+/*
+cencode.h - c header for a base64 encoding algorithm
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+
+#ifndef BASE64_CENCODE_H
+#define BASE64_CENCODE_H
+
+typedef enum
+{
+	step_A, step_B, step_C
+} base64_encodestep;
+
+typedef struct
+{
+	base64_encodestep step;
+	char result;
+	int stepcount;
+} base64_encodestate;
+
+void base64_init_encodestate(base64_encodestate* state_in);
+
+char base64_encode_value(char value_in);
+
+int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in);
+
+int base64_encode_blockend(char* code_out, base64_encodestate* state_in);
+
+#endif /* BASE64_CENCODE_H */
Index: /trunk/MFCtooling/userlog/dllmain.cpp
===================================================================
--- /trunk/MFCtooling/userlog/dllmain.cpp	(revision 32)
+++ /trunk/MFCtooling/userlog/dllmain.cpp	(revision 32)
@@ -0,0 +1,19 @@
+// dllmain.cpp : Defines the entry point for the DLL application.
+#include "stdafx.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+                       DWORD  ul_reason_for_call,
+                       LPVOID lpReserved
+					 )
+{
+	switch (ul_reason_for_call)
+	{
+	case DLL_PROCESS_ATTACH:
+	case DLL_THREAD_ATTACH:
+	case DLL_THREAD_DETACH:
+	case DLL_PROCESS_DETACH:
+		break;
+	}
+	return TRUE;
+}
+
Index: /trunk/MFCtooling/userlog/encode.h
===================================================================
--- /trunk/MFCtooling/userlog/encode.h	(revision 32)
+++ /trunk/MFCtooling/userlog/encode.h	(revision 32)
@@ -0,0 +1,80 @@
+// :mode=c++:
+/*
+encode.h - c++ wrapper for a base64 encoding algorithm
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+#ifndef BASE64_ENCODE_H
+#define BASE64_ENCODE_H
+
+#include <iostream>
+
+#define BUFFERSIZE 5000
+
+namespace base64
+{
+	extern "C" 
+	{
+		#include "cencode.h"
+	}
+
+	struct encoder
+	{
+		base64_encodestate _state;
+		int _buffersize;
+
+		encoder(int buffersize_in = BUFFERSIZE)
+		: _buffersize(buffersize_in)
+		{}
+
+		int encode(char value_in)
+		{
+			return base64_encode_value(value_in);
+		}
+
+		int encode(const char* code_in, const int length_in, char* plaintext_out)
+		{
+			base64_init_encodestate(&_state);
+			return base64_encode_block(code_in, length_in, plaintext_out, &_state);
+		}
+
+		int encode_end(char* plaintext_out)
+		{
+			return base64_encode_blockend(plaintext_out, &_state);
+		}
+
+		void encode(std::istream& istream_in, std::ostream& ostream_in)
+		{
+			base64_init_encodestate(&_state);
+			//
+			const int N = _buffersize;
+			char* plaintext = new char[N];
+			char* code = new char[2*N];
+			int plainlength;
+			int codelength;
+
+			do
+			{
+				istream_in.read(plaintext, N);
+				plainlength = istream_in.gcount();
+				//
+				codelength = encode(plaintext, plainlength, code);
+				ostream_in.write(code, codelength);
+			}
+			while (istream_in.good() && plainlength > 0);
+
+			codelength = encode_end(code);
+			ostream_in.write(code, codelength);
+			//
+			base64_init_encodestate(&_state);
+
+			delete [] code;
+			delete [] plaintext;
+		}
+	};
+
+} // namespace base64
+
+#endif // BASE64_ENCODE_H
+
Index: /trunk/MFCtooling/userlog/stdafx.cpp
===================================================================
--- /trunk/MFCtooling/userlog/stdafx.cpp	(revision 32)
+++ /trunk/MFCtooling/userlog/stdafx.cpp	(revision 32)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// userlog.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
Index: /trunk/MFCtooling/userlog/stdafx.h
===================================================================
--- /trunk/MFCtooling/userlog/stdafx.h	(revision 32)
+++ /trunk/MFCtooling/userlog/stdafx.h	(revision 32)
@@ -0,0 +1,16 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+
+#include "cencode.h"
+#include "encode.h"
+// TODO: reference additional headers your program requires here
Index: /trunk/MFCtooling/userlog/targetver.h
===================================================================
--- /trunk/MFCtooling/userlog/targetver.h	(revision 32)
+++ /trunk/MFCtooling/userlog/targetver.h	(revision 32)
@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
Index: /trunk/MFCtooling/userlog/userlog.cpp
===================================================================
--- /trunk/MFCtooling/userlog/userlog.cpp	(revision 32)
+++ /trunk/MFCtooling/userlog/userlog.cpp	(revision 32)
@@ -0,0 +1,588 @@
+#include "stdafx.h"
+#include "userlog.h"
+
+#include <map>
+#include <cstdio>
+
+#ifdef __USING_MTRACE__
+#define OS_WIN32
+#include "msl/merror/inc/trace.h"
+
+#ifdef __ENCODE_BASE64__
+#include  "encode.h"
+#endif
+
+const static int traceLevel = 3;
+static int level;
+#endif
+
+#ifdef __USING_COSTUMLOG__
+static std::ofstream logfile;
+#endif
+
+#ifdef __TIMING__
+static unsigned long long timing = 0;
+static unsigned long long msgCounter = 0;
+static unsigned long long totalMsgCounter = 0;
+static bool msgCounterChange = false;
+#endif
+
+static MSG lastmsg;
+
+HANDLE mutex;
+
+
+
+USERLOG_API void __cdecl InitUsagelog() {
+
+	mutex = CreateMutex(NULL, FALSE, TEXT("USAGELOGMUTEX"));
+	if( mutex == NULL ) {
+		MessageBox(0, L"MutexFailure", L"MutexFailure", 0);
+	}
+
+#ifdef __USING_COSTUMLOG__
+	InitLogfile();
+#endif
+	InitHookdata();
+	InitHooks();
+#ifdef __USING_MTRACE__
+	MTrace_AddToLevel(traceLevel,"%s<session>", LOGPREFIX);
+#endif
+#ifdef __USING_COSTUMLOG__
+	logfile << LOGPREFIX << "<session>" << std::endl;
+#endif
+}
+
+USERLOG_API void __cdecl ReleaseUsagelog() {
+	ReleaseHooks();
+#ifdef __USING_MTRACE__
+#ifdef __TIMING__
+	char * mtraceBuffer = new char[128];
+	sprintf(mtraceBuffer, "ul timing: %llu \t\t %llu \t\t %llu", timing, msgCounter, totalMsgCounter);
+	MTrace_AddToLevel(traceLevel,mtraceBuffer);
+	delete mtraceBuffer;
+	msgCounterChange = false;
+#endif
+	MTrace_AddToLevel(traceLevel,"%s</session>", LOGPREFIX);
+#endif
+#ifdef __USING_COSTUMLOG__
+	logfile << LOGPREFIX << "</session>" << std::endl;
+	CloseLogfile();
+#endif
+}
+
+#ifdef __USING_COSTUMLOG__
+void InitLogfile() {
+	logfile.open(LOGFILE, std::ios_base::app);
+	if( logfile.fail() ) {
+		MessageBox(0, L"Logfile could not be opend", L"Error", MB_OK);
+	}
+}
+#endif
+
+#ifdef __USING_COSTUMLOG__
+void CloseLogfile() {
+	logfile.close();
+}
+#endif
+
+void InitHookdata() {
+	myhookdata[CALLWNDHOOKID].nType = WH_CALLWNDPROC;
+	myhookdata[CALLWNDHOOKID].hkproc = CallWndProc;
+	myhookdata[GETMSGHOOKID].nType = WH_GETMESSAGE;
+	myhookdata[GETMSGHOOKID].hkproc = GetMsgProc;
+}
+
+void InitHooks() {
+	for( int i=0 ; i<NUMHOOKS ; i++ ) {
+		myhookdata[i].hookhandle = SetWindowsHookEx(myhookdata[i].nType, myhookdata[i].hkproc, (HINSTANCE) NULL, GetCurrentThreadId());
+		if( myhookdata[i].hookhandle!=NULL ) {
+			myhookdata[i].active = true;
+		} else {
+			myhookdata[i].active = false;
+		}
+	}
+}
+
+void ReleaseHooks() {
+	int counter = 0;
+	for( int i=0 ; i<NUMHOOKS ; i++ ) {
+		if( UnhookWindowsHookEx(myhookdata[i].hookhandle) ) counter++;
+	}
+}
+
+
+LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam) {
+	
+	PCWPSTRUCT cwpMsg = (PCWPSTRUCT) lParam;
+	// Create a MSG struct from the cwpMsg struct
+	// The missing parameters are filled with dummy values
+	MSG msg;
+	msg.hwnd = cwpMsg->hwnd;
+	msg.message = cwpMsg->message;
+	msg.lParam = cwpMsg->lParam;
+	msg.wParam = cwpMsg->wParam;
+	msg.pt.x = -1;
+	msg.pt.y = -1;
+	msg.time = -1;
+	if( !MessageEquals(lastmsg, msg) ) {
+		lastmsg = msg;
+		HookProc(CALLWNDHOOKID, nCode, &msg);
+	}
+
+	return CallNextHookEx(myhookdata[CALLWNDHOOKID].hookhandle, nCode, wParam, lParam);
+}
+
+LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) {
+	PMSG msg = (PMSG) lParam;
+	if( !MessageEquals(*msg, lastmsg)) {
+		lastmsg = *msg;
+		HookProc(GETMSGHOOKID,nCode, msg);
+	}
+	return CallNextHookEx(myhookdata[GETMSGHOOKID].hookhandle, nCode, wParam, lParam);
+}
+
+void HookProc(int nFrom, int nCode, PMSG msg) {
+#ifdef __TIMING__
+	SYSTEMTIME systemTime;
+	GetSystemTime( &systemTime );
+	int startTime = systemTime.wMilliseconds+systemTime.wSecond*1000;
+#endif
+
+	DWORD waitResult;
+
+	// inverse filter: defined messages will be filtered, all else just passes through
+	// may be replaced with a lookup-table to improve perfomance
+	// upon completion of the rules, i.e., when it is clear which messages are required,
+	// this should be changed to a "normal" filter.
+	switch(msg->message) {
+		case WM_NULL:
+		case WM_MOVE:
+		case WM_SIZE:
+		case WM_GETTEXT:
+		case WM_GETTEXTLENGTH:
+		case WM_PAINT:
+		case WM_ERASEBKGND:
+		case WM_SHOWWINDOW:
+		case WM_CANCELMODE:
+		case WM_SETCURSOR:
+		case WM_GETMINMAXINFO:
+		case WM_GETFONT:
+		case WM_WINDOWPOSCHANGING:
+		case WM_WINDOWPOSCHANGED:
+		case WM_NOTIFY:
+		case WM_STYLECHANGING:
+		case WM_STYLECHANGED:
+		case WM_GETICON:
+		case WM_NCCREATE:
+		case WM_NCDESTROY:
+		case WM_NCCALCSIZE:
+		case WM_NCHITTEST:
+		case WM_NCPAINT:
+		case WM_GETDLGCODE:
+		case 0x0090: // WM_UAHDESTROYWINDOW
+		case 0x0091: // WM_UAHDRAWMENU
+		case 0x0092: // WM_UADRAWMENUITEM
+		case 0x0093: // WM_UAHINITMENU
+		case 0x0094: // WM_UAHMEASUREMENUITEM
+		case 0x0095: // WM_UAHNCPAINTMENUPOPUP
+		case WM_NCMOUSEMOVE:
+		case WM_TIMER:
+		case WM_ENTERIDLE:
+		case WM_CTLCOLORMSGBOX:
+		case WM_CTLCOLOREDIT:
+		case WM_CTLCOLORLISTBOX:
+		case WM_CTLCOLORBTN:
+		case WM_CTLCOLORDLG:
+		case WM_CTLCOLORSCROLLBAR:
+		case WM_CTLCOLORSTATIC:
+		case WM_MOUSEMOVE:
+		case WM_PARENTNOTIFY:
+		case WM_MDIGETACTIVE:
+		case WM_IME_NOTIFY:
+		case WM_IME_SETCONTEXT:
+		case WM_AFXFIRST:
+		case WM_AFXFIRST+1:
+		case WM_AFXFIRST+2:
+		case WM_AFXFIRST+3:
+		case WM_AFXFIRST+4:
+		case WM_AFXFIRST+5:
+		case WM_AFXFIRST+6:
+		case WM_AFXFIRST+7:
+		case WM_AFXFIRST+8:
+		case WM_AFXFIRST+9:
+		case WM_AFXFIRST+10:
+		case WM_AFXFIRST+11:
+		case WM_AFXFIRST+12:
+		case WM_AFXFIRST+13:
+		case WM_AFXFIRST+14:
+		case WM_AFXFIRST+15:
+		case WM_AFXFIRST+16:
+		case WM_AFXFIRST+17:
+		case WM_AFXFIRST+18:
+		case WM_AFXFIRST+19:
+		case WM_AFXFIRST+20:
+		case WM_AFXFIRST+21:
+		case WM_AFXFIRST+22:
+		case WM_AFXFIRST+23:
+		case WM_AFXFIRST+24:
+		case WM_AFXFIRST+25:
+		case WM_AFXFIRST+26:
+		case WM_AFXFIRST+27:
+		case WM_AFXFIRST+28:
+		case WM_AFXFIRST+29:
+		case WM_AFXFIRST+30:
+		case WM_AFXLAST:
+		case 1025:
+		case 1031:
+		case 1142:
+		case 2024:
+		case 4100:
+		case 4101:
+		case 4103:
+		case 4352:
+		case 4362:
+		case 4363:
+		case 4364:
+		case 4365:
+		case 4372:
+		case 4613:
+			break;
+		default:
+			// exclude messages 0xC000-0xFFFF
+			if( !(msg->message>=0xC000 && msg->message<=0xFFFF) ) {
+				waitResult = WaitForSingleObject(mutex, 1000);
+				if( waitResult==WAIT_OBJECT_0 ) {
+					WriteLogentryWString(msg, nFrom);
+					ReleaseMutex(mutex);
+				}
+
+#ifdef __TIMING__
+				msgCounter++;
+				msgCounterChange = true;
+#endif // __TIMING__
+			}
+			break;
+	}
+#ifdef __TIMING__
+	GetSystemTime( &systemTime );
+	timing += systemTime.wMilliseconds+systemTime.wSecond*1000-startTime;
+	totalMsgCounter++;
+	if( msgCounterChange && msgCounter%100==0 ) {
+#ifdef __USING_MTRACE__
+		char * mtraceBuffer = new char[128];
+		sprintf(mtraceBuffer, "ul timing: %llu \t\t %llu \t\t %llu", timing, msgCounter, totalMsgCounter);
+		MTrace_AddToLevel(traceLevel,mtraceBuffer);
+		delete mtraceBuffer;
+		msgCounterChange = false;
+#endif // __USING_MTRACE__
+	}
+#endif // __TIMING__
+}
+
+
+///////////////////////////////////////////////////////////
+// 2 Byte character functions
+///////////////////////////////////////////////////////////
+
+bool MessageEquals(const MSG & msg1, const MSG & msg2) {
+	bool retVal = false;
+	if( (msg1.time==-1 && msg1.pt.x==-1 && msg1.pt.y==-1) || (msg2.time==-1 && msg2.pt.x==-1 && msg2.pt.y==-1) ) {
+		retVal = msg1.hwnd==msg2.hwnd && msg1.message==msg2.message && msg1.lParam==msg2.lParam &&
+			msg1.wParam==msg2.wParam;
+	} else {
+		retVal = msg1.hwnd==msg2.hwnd && msg1.message==msg2.message && msg1.lParam==msg2.lParam &&
+			msg1.wParam==msg2.wParam && msg1.time==msg2.time && msg1.pt.x==msg2.pt.x && msg1.pt.y==msg2.pt.y;
+	}
+	return retVal;
+}
+
+int replaceWithXmlEntitiesWString(const wchar_t * source, wchar_t ** target, size_t sourceLength) {
+	size_t j=0;
+	size_t extraLength = 0;
+	size_t bufsize = 300;
+	wchar_t * tmpTarget = new wchar_t[sourceLength+bufsize];
+	size_t i;
+	for( i=0; i<sourceLength && j<sourceLength+bufsize-5; i++ ) {
+		switch (source[i]) {
+			case L'&':
+				tmpTarget[j] = L'&';
+				tmpTarget[j+1]=L'a';
+				tmpTarget[j+2]=L'm';
+				tmpTarget[j+3]=L'p';
+				tmpTarget[j+4]=L';';
+				j += 5;
+				extraLength += 4;
+				break;
+			case L'<':
+				tmpTarget[j] = L'&';
+				tmpTarget[j+1]=L'l';
+				tmpTarget[j+2]=L't';
+				tmpTarget[j+3]=L';';
+				j += 4;
+				extraLength += 3;
+				break;
+			case L'>':
+				tmpTarget[j] = L'&';
+				tmpTarget[j+1]=L'g';
+				tmpTarget[j+2]=L't';
+				tmpTarget[j+3]=L';';
+				j += 4;
+				extraLength += 3;
+				break;
+			case L'\"':
+				tmpTarget[j] = L'&';
+				tmpTarget[j+1]=L'q';
+				tmpTarget[j+2]=L'u';
+				tmpTarget[j+3]=L'o';
+				tmpTarget[j+4]=L't';
+				tmpTarget[j+5]=L';';
+				j += 6;
+				extraLength += 5;
+				break;
+			case L'\'':
+				tmpTarget[j] = L'&';
+				tmpTarget[j+1]=L'a';
+				tmpTarget[j+2]=L'p';
+				tmpTarget[j+3]=L'o';
+				tmpTarget[j+4]=L's';
+				tmpTarget[j+5]=L';';
+				j += 6;
+				extraLength += 5;
+				break;
+			case L'%':
+				tmpTarget[j] = L'\\';
+				tmpTarget[j+1] = L'%';
+				j += 2;
+				extraLength += 1;
+				break;
+			default:
+				tmpTarget[j] = source[i];
+				j++;
+		}
+	}
+	*target = new wchar_t[j+1];
+	memcpy(*target,tmpTarget,j*sizeof(wchar_t));
+	(*target)[j] = '\0';
+	return j;
+}
+
+
+void WriteLogentryWString(PMSG msg, int nFrom) {
+	wchar_t * messageStr = NULL;
+	wchar_t buffer[128];
+	wchar_t * newWindowText = NULL;
+	wchar_t * windowName = NULL;
+	unsigned int command = 0;
+	int sourceType = -1;
+	HWND source = NULL;
+	HWND parentHandle = NULL;
+	wchar_t * windowClass = NULL;
+	bool isPopup = false;
+	bool isModal = false;
+	bool htMenu = false;
+	HWND menuHandle = NULL;
+	int scrollPos = -1;
+	unsigned int scrollType = 0;
+	HWND scrollBarHandle = NULL;
+	int retVal = 0;
+
+	// debug vars
+	
+	retVal = GetWindowText(msg->hwnd, buffer, 128);
+	if( retVal > 0  && retVal<MAXINT ) {
+		/*
+		 * In one case at the start of MarWin, when a resource with DlgId 1049 is created,
+		 * GetWindowText returns MAXINT. This behaviour is undocumented.
+		 */
+		replaceWithXmlEntitiesWString(buffer, &windowName, retVal+1);
+	}
+	int windowResourceId = GetDlgCtrlID(msg->hwnd);
+	if( windowResourceId<0 ) {
+		windowResourceId = 0;
+	}
+
+	//**************************************
+	// Message specific variables
+	//**************************************
+
+	if( msg->message==WM_COMMAND ) {
+		command = LOWORD(msg->wParam);
+		sourceType = HIWORD(msg->wParam);
+		source = (HWND) msg->lParam;
+	}
+	if( msg->message==WM_SYSCOMMAND ) {
+		command = LOWORD(msg->wParam);
+	}
+
+	if( msg->message==WM_CREATE ) {
+		parentHandle = GetParent(msg->hwnd);
+		
+		retVal = GetClassName(msg->hwnd, buffer, 128);
+		if( retVal > 0  && retVal<MAXINT ) {
+			replaceWithXmlEntitiesWString(buffer, &windowClass, retVal+1);
+		}
+
+		// check is dialog is modal
+		// this check is not always accurate, but the best that I could come up with
+		isModal = IsWindowEnabled(parentHandle)==false;
+	}
+
+	if( msg->message==WM_SETTEXT ) {
+		wchar_t * newWindowTextBuffer = (wchar_t*)msg->lParam;
+		if( newWindowTextBuffer!=NULL ) {
+			size_t len = wcslen(newWindowTextBuffer);
+			replaceWithXmlEntitiesWString(newWindowTextBuffer, &newWindowText, len+1);
+		}
+	}
+
+	if( msg->message==WM_NCLBUTTONDOWN ) {
+		if( msg->wParam==HTMENU ) {
+			htMenu = true;
+		}
+	}
+	
+	if( msg->message==WM_INITMENU ) {
+		menuHandle = (HWND) msg->wParam;
+	}
+
+	if( msg->message==WM_HSCROLL || msg->message==WM_VSCROLL ) {
+		scrollType = LOWORD(msg->wParam);
+		scrollPos = HIWORD(msg->wParam);
+		scrollBarHandle = (HWND) msg->lParam;
+	}
+
+	/***************************************/
+	// put debugging variables here
+	/***************************************/
+
+
+	/***************************************
+	 * Printing part
+	 ***************************************/
+	
+	size_t bufsize = 2048;
+	wchar_t * msgBuffer = new wchar_t[bufsize];
+	size_t pos = 0;
+	//pos += swprintf_s(msgBuffer+pos, bufsize-pos,LOGPREFIXWSTRING);
+
+	
+	// print msg information
+	pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<msg type=\"%i\">",msg->message);
+	pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"WPARAM\" value=\"%i\"/>", msg->wParam);
+	pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"LPARAM\" value=\"%i\"/>", msg->lParam);
+
+	pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.hwnd\" value=\"%i\"/>", msg->hwnd);
+	if( msg->message==WM_COMMAND ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"command\" value=\"%i\"/>",command);
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"sourceType\" value=\"%i\"/>",sourceType);
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"source\" value=\"%i\"/>",source);
+	}
+	if( msg->message==WM_SYSCOMMAND ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"command\" value=\"%i\"/>", command);
+	}
+
+	if( msg->message==WM_LBUTTONUP || msg->message==WM_RBUTTONUP || msg->message==WM_MBUTTONUP ||
+		msg->message==WM_LBUTTONDOWN || msg->message==WM_RBUTTONDOWN || msg->message==WM_MBUTTONDOWN ||
+		msg->message==WM_LBUTTONDBLCLK || msg->message==WM_RBUTTONDBLCLK || msg->message==WM_MBUTTONDBLCLK) {
+		if( msg->time>-1 ) {
+			pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"point.x\" value=\"%i\"/>", msg->pt.x);
+			pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"point.x\" value=\"%i\"/>", msg->pt.y);
+		}
+	}
+	if( msg->message==WM_MOUSEACTIVATE ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"toplevelwindow.hwnd\" value=\"%i\"/>", (HWND) msg->wParam);
+	}
+	if( msg->message==WM_KEYUP || msg->message==WM_KEYDOWN || msg->message==WM_SYSKEYUP || msg->message==WM_SYSKEYDOWN ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"key\" value=\"%i\"/>", LOWORD(msg->wParam));
+	}
+	if( msg->message==WM_SETTEXT ) {
+		if( newWindowText!=NULL ) {
+			pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.newText\" value=\"%s\"/>", newWindowText);
+		}
+	}
+	
+	if( msg->message==WM_NCLBUTTONDOWN && htMenu ) {
+		pos += swprintf_s(msgBuffer+pos, bufsize-pos,L"<param name=\"isMenu\" value=\"true\"/>");
+	}
+
+	if( msg->message==WM_INITMENU ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"menu.hwnd\" value=\"%i\"/>", menuHandle);
+	}
+
+	if( msg->message==WM_CREATE ) {
+		// print window information
+		if( windowName!=NULL ) {
+			pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.name\" value=\"%s\"/>", windowName);
+		}
+		if( windowResourceId>0 ) {
+			pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.resourceId\" value=\"%i\"/>", windowResourceId);
+		}
+		if( msg->message==WM_CREATE ) {
+			if( parentHandle!=NULL ) {
+				pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.parent.hwnd\" value=\"%i\"/>", parentHandle);
+			}
+			if( windowClass!=NULL ) {
+				pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.class\" value=\"%s\"/>", windowClass);
+			}
+			if( isModal ) {
+				pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"window.ismodal\" value=\"true\"/>");
+			}
+
+		}
+	}
+	if( msg->message==WM_HSCROLL || msg->message==WM_VSCROLL ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"scrollType\" value=\"%i\"/>", scrollType);
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"scrollPos\" value=\"%i\"/>", scrollPos);
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"scrollBarHandle\" value=\"%i\"/>", scrollBarHandle);
+	}
+
+	if( msg->time!=-1 ) {
+		pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"time\" value=\"%i\"/>", msg->time);
+	}
+	
+	/***************************************/
+	// put debugging and experimental output stuff here
+	/***************************************/
+
+#ifdef __INCLUDEHOOKINFO__
+	pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"<param name=\"hook\" value=\"%i\"/>", nFrom);
+#endif
+	
+
+	pos += swprintf_s(msgBuffer+pos,bufsize-pos,L"</msg>", msg->hwnd);
+#ifdef __USING_MTRACE__
+#ifdef __ENCODE_BASE64__
+	size_t arraySize = (pos+1)*2;
+	size_t encodingSize = arraySize*2;
+	char * base64Buffer = new char[encodingSize];
+
+	base64::encoder enc;
+	retVal = enc.encode((char*)msgBuffer, arraySize, base64Buffer);
+	base64Buffer[retVal] = '\0';
+
+	char * mtraceBuffer = new char[retVal+30];
+	sprintf_s(mtraceBuffer,retVal+29,"%s%s", LOGPREFIX, base64Buffer);
+	delete base64Buffer;
+#else
+	char * mtraceBuffer = new char[pos+1];
+	size_t numConverted;
+	wcstombs_s(&numConverted,mtraceBuffer, pos+1, msgBuffer, pos);
+#endif // __ENCODE_BASE64__
+	MTrace_AddToLevel(traceLevel,mtraceBuffer);
+	delete mtraceBuffer;
+#endif // __USING_MTRACE__
+#ifdef __USING_COSTUMLOG__
+	SYSTEMTIME currentTime;
+	GetSystemTime(&currentTime);
+	logfile << currentTime.wDay << "." << currentTime.wMonth << "." << currentTime.wYear << " ";
+	logfile << currentTime.wHour << ":" << currentTime.wMinute << ":" << currentTime.wSecond << ":";
+	logfile << currentTime.wMilliseconds << "\t";
+	logfile << buffer << std::endl;
+#endif
+	delete messageStr;
+	delete newWindowText;
+	delete windowName;
+	delete windowClass;
+	delete msgBuffer;
+}
Index: /trunk/MFCtooling/userlog/userlog.h
===================================================================
--- /trunk/MFCtooling/userlog/userlog.h	(revision 32)
+++ /trunk/MFCtooling/userlog/userlog.h	(revision 32)
@@ -0,0 +1,89 @@
+#ifdef USERLOG_EXPORTS
+#define USERLOG_API __declspec(dllexport)
+#else
+#define USERLOG_API __declspec(dllimport)
+#endif
+
+#include <iostream>
+#include <fstream>
+
+
+
+//#define __USING_MTRACE__
+#define __USING_COSTUMLOG__
+#define __INCLUDEHOOKINFO__
+//#define __TIMING__
+#define __ENCODE_BASE64__
+
+#define LOGPREFIX " UL: "
+#define LOGPREFIXCONT " ULC: "
+#define LOGPREFIXWSTRING L" UL: "
+
+#define NUMHOOKS 2
+
+#define CALLWNDHOOKID 0
+#define GETMSGHOOKID 1
+
+#ifdef __USING_COSTUMLOG__
+#define LOGFILE "usagelog.txt"
+#endif
+
+typedef struct _HOOKDATA {
+	int nType;
+	HOOKPROC hkproc;
+	HHOOK hookhandle;
+	bool active;
+} HOOKDATA;
+
+HOOKDATA myhookdata[NUMHOOKS];
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * API function that starts the logging of messages. 
+ * All required hooks and logging mechanisms are initialized. 
+ */
+USERLOG_API void __cdecl InitUsagelog();
+
+/**
+ * API function that stopts the logging of messages. 
+ * All existing hooks are released and if required, logging mechnisms are stopped.
+ */
+USERLOG_API void __cdecl ReleaseUsagelog();
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
+void InitHookdata();
+
+void InitHooks();
+
+void ReleaseHooks();
+
+
+LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam);
+
+LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam);
+
+void HookProc(int nFrom, int nCode, PMSG msg);
+
+/**
+ * Compares two messages parameter-wise. 
+ * TODO: Check if this works better, if MSG.time and MSG.pt are ignored in the comparison, as they are missing in CWPSTRUCT.
+ * TODO: In case of CWPSTRICT both values are per default -1. 
+ */
+bool MessageEquals(const MSG & msg1, const MSG & msg2);
+
+void WriteLogentryWString(PMSG msg, int nFrom);
+
+int replaceWithXmlEntitiesWString(const wchar_t * source, wchar_t ** target, size_t sourceLength);
+
+#ifdef __USING_COSTUMLOG__
+void InitLogfile();
+
+void CloseLogfile();
+#endif
Index: /trunk/MFCtooling/userlog/userlog.vcproj
===================================================================
--- /trunk/MFCtooling/userlog/userlog.vcproj	(revision 32)
+++ /trunk/MFCtooling/userlog/userlog.vcproj	(revision 32)
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="userlog"
+	ProjectGUID="{A881CC90-25D4-4D76-A30D-C8CA09A3434D}"
+	RootNamespace="userlog"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;USERLOG_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="C:\Projects\msl\mfcutil\marbase_cl\build\win32\Debug;C:\Projects\msl\lib\win32\debug;C:\Projects\merror\merror\build\win32\Debug"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="C:\Projects"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;USERLOG_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="trace.lib"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="C:\Projects\msl\build\win32\Release;C:\Projects\merror\merror\build\win32\Release"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy C:\repos\software\trunk\userlog_vc08\Release\userlog.dll C:\&quot;Program Files&quot;\Mahr\MarWin\userlog.dll /y"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\cencode.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\dllmain.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\userlog.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\cencode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\encode.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+			<File
+				RelativePath=".\userlog.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
