summaryrefslogtreecommitdiffstats
path: root/private/oleutest/simpdnd
diff options
context:
space:
mode:
Diffstat (limited to 'private/oleutest/simpdnd')
-rw-r--r--private/oleutest/simpdnd/app.cpp852
-rw-r--r--private/oleutest/simpdnd/app.h67
-rw-r--r--private/oleutest/simpdnd/bang.icobin0 -> 1846 bytes
-rw-r--r--private/oleutest/simpdnd/daytona/makefile6
-rw-r--r--private/oleutest/simpdnd/daytona/sources41
-rw-r--r--private/oleutest/simpdnd/default.icobin0 -> 766 bytes
-rw-r--r--private/oleutest/simpdnd/depend.mk227
-rw-r--r--private/oleutest/simpdnd/dirs3
-rw-r--r--private/oleutest/simpdnd/doc.cpp825
-rw-r--r--private/oleutest/simpdnd/doc.h75
-rw-r--r--private/oleutest/simpdnd/dxferobj.cpp739
-rw-r--r--private/oleutest/simpdnd/dxferobj.h57
-rw-r--r--private/oleutest/simpdnd/enumfetc.h13
-rw-r--r--private/oleutest/simpdnd/filelist.mk83
-rw-r--r--private/oleutest/simpdnd/ias.cpp302
-rw-r--r--private/oleutest/simpdnd/ias.h43
-rw-r--r--private/oleutest/simpdnd/ids.cpp384
-rw-r--r--private/oleutest/simpdnd/ids.h43
-rw-r--r--private/oleutest/simpdnd/idt.cpp851
-rw-r--r--private/oleutest/simpdnd/idt.h76
-rw-r--r--private/oleutest/simpdnd/iocs.cpp365
-rw-r--r--private/oleutest/simpdnd/iocs.h44
-rw-r--r--private/oleutest/simpdnd/pre.cpp9
-rw-r--r--private/oleutest/simpdnd/pre.h30
-rw-r--r--private/oleutest/simpdnd/readme.txt47
-rw-r--r--private/oleutest/simpdnd/resource.h39
-rw-r--r--private/oleutest/simpdnd/simpdnd.cpp502
-rw-r--r--private/oleutest/simpdnd/simpdnd.h45
-rw-r--r--private/oleutest/simpdnd/simpdnd.icobin0 -> 766 bytes
-rw-r--r--private/oleutest/simpdnd/simpdnd.rc114
-rw-r--r--private/oleutest/simpdnd/site.cpp632
-rw-r--r--private/oleutest/simpdnd/site.h47
-rw-r--r--private/oleutest/simpdnd/strings.rc124
-rw-r--r--private/oleutest/simpdnd/tests.cpp198
-rw-r--r--private/oleutest/simpdnd/tests.h27
35 files changed, 6910 insertions, 0 deletions
diff --git a/private/oleutest/simpdnd/app.cpp b/private/oleutest/simpdnd/app.cpp
new file mode 100644
index 000000000..63c093945
--- /dev/null
+++ b/private/oleutest/simpdnd/app.cpp
@@ -0,0 +1,852 @@
+//**********************************************************************
+// File name: app.cpp
+//
+// Implementation file for the CSimpleApp Class
+//
+// Functions:
+//
+// See app.h for a list of member functions.
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+#include <testmess.h>
+
+
+#ifdef WIN32
+extern BOOL CALLBACK About(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
+#endif
+
+//**********************************************************************
+//
+// CSimpleApp::CSimpleApp()
+//
+// Purpose:
+//
+// Constructor for CSimpleApp
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//********************************************************************
+CSimpleApp::CSimpleApp()
+{
+ TestDebugOut("In CSimpleApp's Constructor \r\n");
+
+ // Set Ref Count
+ m_nCount = 0;
+
+ // clear members
+ m_hAppWnd = NULL;
+ m_hInst = NULL;
+ m_lpDoc = NULL;
+
+ // clear flags
+ m_fInitialized = FALSE;
+
+ // Initialize effects we allow.
+ m_dwSourceEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
+ m_dwTargetEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::~CSimpleApp()
+//
+// Purpose:
+//
+// Destructor for CSimpleApp Class.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// OutdebugString Windows API
+// OleUninitialize OLE API
+//
+//
+//********************************************************************
+
+CSimpleApp::~CSimpleApp()
+{
+ TestDebugOut("In CSimpleApp's Destructor\r\n");
+
+ // need to uninit the library...
+ if (m_fInitialized)
+ OleUninitialize();
+}
+
+//**********************************************************************
+//
+// CSimpleApp::DestroyDocs()
+//
+// Purpose:
+//
+// Destroys all of the open documents in the application (Only one
+// since this is an SDI app, but could easily be modified to
+// support MDI).
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::Close DOC.CPP
+//
+//********************************************************************
+
+void CSimpleApp::DestroyDocs()
+{
+ m_lpDoc->Close(); // we have only 1 document
+}
+
+//**********************************************************************
+//
+// CSimpleApp::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation at the Application level.
+//
+// Parameters:
+//
+// REFIID riid - A reference to the interface that is
+// being queried.
+//
+// LPVOID FAR* ppvObj - An out parameter to return a pointer to
+// the interface.
+//
+// Return Value:
+//
+// S_OK - The interface is supported.
+// S_FALSE - The interface is not supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+//
+//********************************************************************
+
+STDMETHODIMP CSimpleApp::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpleApp::QueryInterface\r\n");
+
+ *ppvObj = NULL; // must set out pointer parameters to NULL
+
+ // Not a supported interface
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+//**********************************************************************
+//
+// CSimpleApp::AddRef
+//
+// Purpose:
+//
+// Adds to the reference count at the Application level.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the application.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Due to the reference counting model that is used in this
+// implementation, this reference count is the sum of the
+// reference counts on all interfaces of all objects open
+// in the application.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpleApp::AddRef()
+{
+ TestDebugOut("In CSimpleApp::AddRef\r\n");
+ return ++m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::Release
+//
+// Purpose:
+//
+// Decrements the reference count at the application level
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the application.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpleApp::Release()
+{
+ TestDebugOut("In CSimpleApp::Release\r\n");
+
+ if (--m_nCount == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::fInitApplication
+//
+// Purpose:
+//
+// Initializes the application
+//
+// Parameters:
+//
+// HANDLE hInstance - Instance handle of the application.
+//
+// Return Value:
+//
+// TRUE - Application was successfully initialized.
+// FALSE - Application could not be initialized
+//
+// Function Calls:
+// Function Location
+//
+// LoadIcon Windows API
+// LoadCursor Windows API
+// GetStockObject Windows API
+// RegisterClass Windows API
+//
+//
+//********************************************************************
+
+BOOL CSimpleApp::fInitApplication(HANDLE hInstance)
+{
+ WNDCLASS wc;
+
+ // Fill in window class structure with parameters that describe the
+ // main window.
+
+ wc.style = NULL; // Class style(s).
+ wc.lpfnWndProc = MainWndProc; // Function to retrieve messages for
+ // windows of this class.
+ wc.cbClsExtra = 0; // No per-class extra data.
+ wc.cbWndExtra = 0; // No per-window extra data.
+ wc.hInstance =(HINSTANCE) hInstance; // Application that owns
+ // the class.
+ wc.hIcon = LoadIcon((HINSTANCE)hInstance,TEXT("SimpDnd"));
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = TEXT("SIMPLEMENU"); // Name of menu resource in
+ // .RC file.
+ wc.lpszClassName = TEXT("SimpDndAppWClass"); // Name used in
+ // CreateWindow call.
+
+ if (!RegisterClass(&wc))
+ return FALSE;
+
+ wc.style = CS_DBLCLKS; // Class style(s). allow DBLCLK's
+ wc.lpfnWndProc = DocWndProc; // Function to retrieve messages for
+ // windows of this class.
+ wc.cbClsExtra = 0; // No per-class extra data.
+ wc.cbWndExtra = 0; // No per-window extra data.
+ wc.hInstance = (HINSTANCE) hInstance; // Application that owns
+ // the class.
+ wc.hIcon = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = TEXT("SimpDndDocWClass"); // Name used in
+ //CreateWindow call.
+
+ // Register the window class and return success/failure code.
+
+ return (RegisterClass(&wc));
+}
+
+//**********************************************************************
+//
+// CSimpleApp::fInitInstance
+//
+// Purpose:
+//
+// Instance initialization.
+//
+// Parameters:
+//
+// HANDLE hInstance - App. Instance Handle.
+//
+// int nCmdShow - Show parameter from WinMain
+//
+// Return Value:
+//
+// TRUE - Initialization Successful
+// FALSE - Initialization Failed.
+//
+//
+// Function Calls:
+// Function Location
+//
+// CreateWindow Windows API
+// ShowWindow Windows API
+// UpdateWindow Windows API
+// GetProfileInt Windows API
+// OleBuildVersion OLE API
+// OleInitialize OLE API
+// OleStdCreateDbAlloc OLE2UI
+//
+// Comments:
+//
+// Note that successful Initalization of the OLE libraries
+// is remembered so the UnInit is only called if needed.
+//
+//********************************************************************
+
+BOOL CSimpleApp::fInitInstance (HANDLE hInstance, int nCmdShow)
+{
+ LPMALLOC lpMalloc = NULL;
+
+#ifndef WIN32
+ /* Since OLE is part of the operating system in Win32, we don't need to
+ * check the version number in Win32.
+ */
+ DWORD dwVer = OleBuildVersion();
+
+ // check to see if we are compatible with this version of the libraries
+ if (HIWORD(dwVer) != rmm || LOWORD(dwVer) < rup)
+ {
+#ifdef _DEBUG
+ TestDebugOut("WARNING: Incompatible OLE library version\r\n");
+#else
+ return FALSE;
+#endif
+ }
+#endif // WIN32
+
+#if defined( _DEBUG )
+ /* OLE2NOTE: Use a special debug allocator to help track down
+ ** memory leaks.
+ */
+ OleStdCreateDbAlloc(0, &lpMalloc);
+#endif
+
+ // We try passing in our own allocator first - if that fails we
+ // try without overriding the allocator.
+
+ if (SUCCEEDED(OleInitialize(lpMalloc)) ||
+ SUCCEEDED(OleInitialize(NULL)))
+ {
+ m_fInitialized = TRUE;
+ }
+
+#if defined( _DEBUG )
+ /* OLE2NOTE: release the special debug allocator so that only OLE is
+ ** holding on to it. later when OleUninitialize is called, then
+ ** the debug allocator object will be destroyed. when the debug
+ ** allocator object is destoyed, it will report (to the Output
+ ** Debug Terminal) whether there are any memory leaks.
+ */
+ if (lpMalloc) lpMalloc->Release();
+#endif
+
+ m_hInst = (HINSTANCE) hInstance;
+
+ // Create the "application" windows
+ m_hAppWnd = CreateWindow (TEXT("SimpDndAppWClass"),
+ TEXT("Simple OLE 2.0 Drag/Drop Container"),
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ NULL,
+ NULL,
+ (HINSTANCE) hInstance,
+ NULL);
+
+ if (!m_hAppWnd)
+ return FALSE;
+
+ // if we have been launched by the test driver, tell it our window handle
+
+ if( m_hDriverWnd )
+ {
+ PostMessage(m_hDriverWnd, WM_TESTREG, (WPARAM)m_hAppWnd, 0);
+ }
+
+ // delay before dragging should start, in milliseconds
+ m_nDragDelay = GetProfileInt(
+ TEXT("windows"),
+ TEXT("DragDelay"),
+ DD_DEFDRAGDELAY
+ );
+
+ // minimum distance (radius) before drag should start, in pixels
+ m_nDragMinDist = GetProfileInt(
+ TEXT("windows"),
+ TEXT("DragMinDist"),
+ DD_DEFDRAGMINDIST
+ );
+
+ // delay before scrolling, in milliseconds
+ m_nScrollDelay = GetProfileInt(
+ TEXT("windows"),
+ TEXT("DragScrollDelay"),
+ DD_DEFSCROLLDELAY
+ );
+
+ // inset-width of the hot zone, in pixels
+ m_nScrollInset = GetProfileInt(
+ TEXT("windows"),
+ TEXT("DragScrollInset"),
+ DD_DEFSCROLLINSET
+ );
+
+ // scroll interval, in milliseconds
+ m_nScrollInterval = GetProfileInt(
+ TEXT("windows"),
+ TEXT("DragScrollInterval"),
+ DD_DEFSCROLLINTERVAL
+ );
+
+ ShowWindow (m_hAppWnd, nCmdShow);
+ UpdateWindow (m_hAppWnd);
+
+ return m_fInitialized;
+}
+
+
+
+
+
+//+-------------------------------------------------------------------------
+//
+// Member: CSimpleApp::UpdateDragDropEffects
+//
+// Synopsis: Update drag/drop effects
+//
+// Arguments: [iMenuPos] - menu position either source or target
+// [iMenuCommand] - what command the menu selection maps to
+// [dwEffect] - new effects
+// [pdwEffectToUpdate] - where to store the effects
+//
+// Algorithm: Get the menu for either source or target. Then clear any
+// outstanding check marks. Check the appropriate item. Finally
+// update the effects that we allow.
+//
+// History: dd-mmm-yy Author Comment
+// 06-May-94 Ricksa author
+//
+//--------------------------------------------------------------------------
+void CSimpleApp::UpdateDragDropEffects(
+ int iMenuPos,
+ int iMenuCommand,
+ DWORD dwEffect,
+ DWORD *pdwEffectToUpdate)
+{
+ // Get the menu that we want to process
+ HMENU hMenuItem = GetSubMenu(m_hHelpMenu, iMenuPos);
+
+ // Clear any current check marks
+ for (int i = 0; i < 3; i++)
+ {
+ CheckMenuItem(hMenuItem, i, MF_BYPOSITION | MF_UNCHECKED);
+ }
+
+ // Check the appropriate item.
+ CheckMenuItem(hMenuItem, iMenuCommand, MF_BYCOMMAND | MF_CHECKED);
+ *pdwEffectToUpdate = dwEffect;
+}
+
+
+//**********************************************************************
+//
+// CSimpleApp::lCommandHandler
+//
+// Purpose:
+//
+// Handles the processing of WM_COMMAND.
+//
+// Parameters:
+//
+// HWND hWnd - Handle to the application Window
+//
+// UINT message - message (always WM_COMMAND)
+//
+// WPARAM wParam - Same as passed to the WndProc
+//
+// LPARAM lParam - Same as passed to the WndProc
+//
+// Return Value:
+//
+// NULL
+//
+// Function Calls:
+// Function Location
+//
+// IOleObject::DoVerb Object
+// GetClientRect Windows API
+// MessageBox Windows API
+// DialogBox Windows API
+// MakeProcInstance Windows API
+// FreeProcInstance Windows API
+// SendMessage Windows API
+// DefWindowProc Windows API
+// CSimpleDoc::InsertObject DOC.CPP
+// CSimpleDoc::CopyObjectToClip DOC.CPP
+// CSimpleDoc::Close DOC.CPP
+//
+//********************************************************************
+
+long CSimpleApp::lCommandHandler (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+
+ // see if the command is a verb selections
+ if (wParam >= IDM_VERB0)
+ {
+ // get the rectangle of the object
+ m_lpDoc->m_lpSite->GetObjRect(&rect);
+
+ if (m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
+ wParam - IDM_VERB0, NULL,
+ &m_lpDoc->m_lpSite->m_OleClientSite, -1,
+ m_lpDoc->m_hDocWnd, &rect)
+ != ResultFromScode(S_OK))
+ {
+ TestDebugOut("Fail in IOleObject::DoVerb\n");
+ }
+ }
+ else
+ {
+ switch (wParam)
+ {
+ // bring up the About box
+ case IDM_ABOUT:
+ {
+#ifdef WIN32
+ DialogBox(m_hInst, // current instance
+ TEXT("AboutBox"), // resource to use
+ m_hAppWnd, // parent handle
+ About); // About() instance address
+#else
+ FARPROC lpProcAbout = MakeProcInstance((FARPROC)About,
+ m_hInst);
+
+ DialogBox(m_hInst, // current instance
+ TEXT("AboutBox"), // resource to use
+ m_hAppWnd, // parent handle
+ lpProcAbout); // About() instance address
+
+ FreeProcInstance(lpProcAbout);
+#endif
+ break;
+ }
+
+ // bring up the InsertObject Dialog
+ case IDM_INSERTOBJECT:
+ m_lpDoc->InsertObject();
+ break;
+
+ // Copy the object to the Clipboard
+ case IDM_COPY:
+ m_lpDoc->CopyObjectToClip();
+ break;
+
+ // exit the application
+ case IDM_EXIT:
+ SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
+ break;
+
+ case IDM_NEW:
+ lCreateDoc(hWnd, 0, 0, 0);
+ break;
+
+ // Only allow copy from the source
+ case IDM_SOURCE_COPY:
+ UpdateDragDropEffects(SOURCE_EFFECTS_MENU_POS,
+ IDM_SOURCE_COPY, DROPEFFECT_COPY, &m_dwSourceEffect);
+ break;
+
+ // Only allow move from the source
+ case IDM_SOURCE_MOVE:
+ UpdateDragDropEffects(SOURCE_EFFECTS_MENU_POS,
+ IDM_SOURCE_MOVE, DROPEFFECT_MOVE, &m_dwSourceEffect);
+ break;
+
+ // Allow both copy and move from the source
+ case IDM_SOURCE_COPYMOVE:
+ UpdateDragDropEffects(SOURCE_EFFECTS_MENU_POS,
+ IDM_SOURCE_COPYMOVE, DROPEFFECT_COPY | DROPEFFECT_MOVE,
+ &m_dwSourceEffect);
+ break;
+
+ // Only accept copy in target
+ case IDM_TARGET_COPY:
+ UpdateDragDropEffects(TARGET_EFFECTS_MENU_POS,
+ IDM_TARGET_COPY, DROPEFFECT_COPY, &m_dwTargetEffect);
+ break;
+
+ // Only accept move in target
+ case IDM_TARGET_MOVE:
+ UpdateDragDropEffects(TARGET_EFFECTS_MENU_POS,
+ IDM_TARGET_MOVE, DROPEFFECT_MOVE, &m_dwTargetEffect);
+ break;
+
+ // Accept both move and copy in the target
+ case IDM_TARGET_COPYMOVE:
+ UpdateDragDropEffects(TARGET_EFFECTS_MENU_POS,
+ IDM_TARGET_COPYMOVE, DROPEFFECT_COPY | DROPEFFECT_MOVE,
+ &m_dwTargetEffect);
+ break;
+
+ default:
+ return (DefWindowProc(hWnd, message, wParam, lParam));
+ } // end of switch
+
+ } // end of else
+
+ return NULL;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::lSizeHandler
+//
+// Purpose:
+//
+// Handles the WM_SIZE message
+//
+// Parameters:
+//
+// HWND hWnd - Handle to the application Window
+//
+// UINT message - message (always WM_SIZE)
+//
+// WPARAM wParam - Same as passed to the WndProc
+//
+// LPARAM lParam - Same as passed to the WndProc
+//
+// Return Value:
+//
+// LONG - returned from the "document" resizing
+//
+// Function Calls:
+// Function Location
+//
+// GetClientRect Windows API
+// CSimpleDoc::lResizeDoc DOC.CPP
+//
+//
+//********************************************************************
+
+long CSimpleApp::lSizeHandler (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+
+ GetClientRect(m_hAppWnd, &rect);
+ return m_lpDoc->lResizeDoc(&rect);
+}
+
+//**********************************************************************
+//
+// CSimpleApp::lCreateDoc
+//
+// Purpose:
+//
+// Handles the creation of a document object.
+//
+// Parameters:
+//
+// HWND hWnd - Handle to the application Window
+//
+// UINT message - message (always WM_CREATE)
+//
+// WPARAM wParam - Same as passed to the WndProc
+//
+// LPARAM lParam - Same as passed to the WndProc
+//
+// Return Value:
+//
+// NULL
+//
+// Function Calls:
+// Function Location
+//
+// GetClientRect Windows API
+// CSimpleDoc::CSimpleDoc DOC.CPP
+//
+//
+//********************************************************************
+
+long CSimpleApp::lCreateDoc (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+ static BOOL fFirstTime = TRUE;
+
+ if (m_lpDoc != NULL)
+ {
+ // There is a document defined already so we close it without
+ // saving which is equivalent to deleting the object.
+ m_lpDoc->Close();
+ m_lpDoc = NULL;
+ }
+
+ GetClientRect(hWnd, &rect);
+
+ m_lpDoc = CSimpleDoc::Create(this, &rect, hWnd);
+
+ // First time initialization - for some reason the doc sets the
+ // the application's m_hHelpMenu which we need. So we do the
+ // initialization here.
+ if (fFirstTime)
+ {
+ fFirstTime = FALSE;
+
+ // Check default allowed effects for the source
+ UpdateDragDropEffects(SOURCE_EFFECTS_MENU_POS, IDM_SOURCE_COPYMOVE,
+ m_dwSourceEffect, &m_dwSourceEffect);
+
+ // Check default allowed effects for the target
+ UpdateDragDropEffects(TARGET_EFFECTS_MENU_POS, IDM_TARGET_COPYMOVE,
+ m_dwTargetEffect, &m_dwTargetEffect);
+ }
+
+ return NULL;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::HandleAccelerators
+//
+// Purpose:
+//
+// To properly handle accelerators in the Message Loop
+//
+// Parameters:
+//
+// LPMSG lpMsg - A pointer to the message structure.
+//
+// Return Value:
+//
+// TRUE - The accelerator was handled
+// FALSE - The accelerator was not handled
+//
+// Function Calls:
+// Function Location
+//
+//
+//********************************************************************
+
+BOOL CSimpleApp::HandleAccelerators(LPMSG lpMsg)
+{
+ BOOL retval = FALSE;
+
+ // we do not have any accelerators
+
+ return retval;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::PaintApp
+//
+// Purpose:
+//
+// Handles the painting of the doc window.
+//
+//
+// Parameters:
+//
+// HDC hDC - hDC to the Doc Window.
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::PaintDoc DOC.CPP
+//
+// Comments:
+//
+// This is an app level function in case we want to do palette
+// management.
+//
+//********************************************************************
+
+void CSimpleApp::PaintApp (HDC hDC)
+{
+ // at this level, we could enumerate through all of the
+ // visible objects in the application, so that a palette
+ // that best fits all of the objects can be built.
+
+ // This app is designed to take on the same palette
+ // functionality that was provided in OLE 1.0, the palette
+ // of the last object drawn is realized. Since we only
+ // support one object at a time, it shouldn't be a big
+ // deal.
+
+ // if we supported multiple documents, we would enumerate
+ // through each of the open documents and call paint.
+
+ if (m_lpDoc)
+ {
+ m_lpDoc->PaintDoc(hDC);
+ }
+
+}
+
+
diff --git a/private/oleutest/simpdnd/app.h b/private/oleutest/simpdnd/app.h
new file mode 100644
index 000000000..37f827897
--- /dev/null
+++ b/private/oleutest/simpdnd/app.h
@@ -0,0 +1,67 @@
+//**********************************************************************
+// File name: app.h
+//
+// Definition of CSimpleApp
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _APP_H_)
+#define _APP_H_
+
+#include <ole2.h>
+
+class CSimpleDoc;
+
+class CSimpleApp : public IUnknown
+{
+public:
+
+ int m_nCount; // reference count
+ HWND m_hAppWnd; // main window handle
+ HWND m_hDriverWnd; // window handle for the driver app.
+ HINSTANCE m_hInst; // application instance
+ CSimpleDoc FAR * m_lpDoc; // pointer to document object
+ BOOL m_fInitialized; // OLE initialization flag
+ HMENU m_hMainMenu;
+ HMENU m_hFileMenu;
+ HMENU m_hEditMenu;
+ HMENU m_hHelpMenu;
+ HMENU m_hCascadeMenu; // OLE object's verb
+
+ // Drag/Drop related fields
+ int m_nDragDelay; // time delay (in msec) before drag should start
+ int m_nDragMinDist; // min. distance (radius) before drag should start
+ int m_nScrollDelay; // time delay (in msec) before scroll should start
+ int m_nScrollInset; // Border inset distance to start drag scroll
+ int m_nScrollInterval; // scroll interval time (in msec)
+
+ DWORD m_dwSourceEffect; // Allowed effects to source
+ DWORD m_dwTargetEffect; // Allowed target effects
+
+ CSimpleApp(); // Constructor
+ ~CSimpleApp(); // Destructor
+
+ // IUnknown Interfaces
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // Initialization methods
+
+ BOOL fInitApplication (HANDLE hInstance);
+ BOOL fInitInstance (HANDLE hInstance, int nCmdShow);
+
+ // Message handling methods
+
+ long lCommandHandler (HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
+ long lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+ long lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+ BOOL HandleAccelerators (LPMSG lpMsg);
+ void PaintApp(HDC hDC);
+ void DestroyDocs();
+ void UpdateDragDropEffects(int iMenuPos, int iMenuCommand, DWORD dwEffect,
+ DWORD *pdwEffectToUpdate);
+};
+
+#endif // _APP_H_
diff --git a/private/oleutest/simpdnd/bang.ico b/private/oleutest/simpdnd/bang.ico
new file mode 100644
index 000000000..90fe0f220
--- /dev/null
+++ b/private/oleutest/simpdnd/bang.ico
Binary files differ
diff --git a/private/oleutest/simpdnd/daytona/makefile b/private/oleutest/simpdnd/daytona/makefile
new file mode 100644
index 000000000..6ee4f43fa
--- /dev/null
+++ b/private/oleutest/simpdnd/daytona/makefile
@@ -0,0 +1,6 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
+# file to this component. This file merely indirects to the real make file
+# that is shared by all the components of NT OS/2
+#
+!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/private/oleutest/simpdnd/daytona/sources b/private/oleutest/simpdnd/daytona/sources
new file mode 100644
index 000000000..170bbe1c1
--- /dev/null
+++ b/private/oleutest/simpdnd/daytona/sources
@@ -0,0 +1,41 @@
+TARGETNAME=SIMPDND
+TARGETTYPE=PROGRAM
+TARGETPATH=OBJ
+TARGETLIBS= \
+ $(GUI32_LIBS) \
+ $(WIN32_LIBS) \
+ $(CRT_LIBS) \
+ $(NT_CRT) \
+ $(LIBRARY_PATH)\ole32.lib \
+ $(LIBRARY_PATH)\shell32.lib \
+ $(LIBRARY_PATH)\comdlg32.lib \
+ ..\..\letest\ole2ui\daytona\obj\*\ole2u32a.lib \
+ $(LIBRARY_PATH)\uuid.lib
+
+BLDCRT=1
+UMTYPE=windows
+UMENTRY=winmain
+#UMLIBS= \
+# ..\..\libs\daytona\*\common.lib
+
+INCLUDES=..;..\oletest;..\..\letest\ole2ui;..\..\inc
+
+C_DEFINES=-DWIN32-DDEBUG -DINC_OLE2 -DCLIENT -DWINDOWS
+
+NTDEBUG=ntsd
+NTDEBUGTYPE=both
+MSC_OPTIMIZATION=/Od
+
+SOURCES= \
+..\APP.CPP \
+..\DOC.CPP \
+..\DXFEROBJ.CPP \
+..\IAS.CPP \
+..\IDS.CPP \
+..\IDT.CPP \
+..\IOCS.CPP \
+..\PRE.CPP \
+..\SIMPDND.CPP \
+..\SITE.CPP \
+..\TESTS.CPP \
+..\SIMPDND.RC
diff --git a/private/oleutest/simpdnd/default.ico b/private/oleutest/simpdnd/default.ico
new file mode 100644
index 000000000..4542c57d3
--- /dev/null
+++ b/private/oleutest/simpdnd/default.ico
Binary files differ
diff --git a/private/oleutest/simpdnd/depend.mk b/private/oleutest/simpdnd/depend.mk
new file mode 100644
index 000000000..42246732a
--- /dev/null
+++ b/private/oleutest/simpdnd/depend.mk
@@ -0,0 +1,227 @@
+#
+# Built automatically
+#
+
+#
+# Source files
+#
+
+$(OBJDIR)\app.obj $(OBJDIR)\app.lst: .\app.cpp $(CAIROLE)\h\export\coguid.h \
+ $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \
+ $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \
+ $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \
+ $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \
+ $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \
+ $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \
+ $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \
+ $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \
+ $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \
+ $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \
+ $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \
+ $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \
+ $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \
+ $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \
+ $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \
+ $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \
+ $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \
+ $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \
+ .\doc.h .\ias.h .\ids.h .\idt.h .\iocs.h .\pre.h .\resource.h \
+ .\simpdnd.h .\site.h
+
+$(OBJDIR)\doc.obj $(OBJDIR)\doc.lst: .\doc.cpp $(CAIROLE)\h\export\coguid.h \
+ $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \
+ $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \
+ $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \
+ $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \
+ $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \
+ $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \
+ $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \
+ $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \
+ $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \
+ $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \
+ $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \
+ $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \
+ $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \
+ $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \
+ $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \
+ $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \
+ $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \
+ $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\dxferobj.h \
+ .\app.h .\doc.h .\ias.h .\ids.h .\idt.h .\iocs.h .\pre.h \
+ .\resource.h .\simpdnd.h .\site.h
+
+$(OBJDIR)\dxferobj.obj $(OBJDIR)\dxferobj.lst: .\dxferobj.cpp \
+ $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \
+ $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \
+ $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \
+ $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \
+ $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \
+ $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \
+ $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \
+ $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\string.h \
+ $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h \
+ $(OSINC)\dlgs.h $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h \
+ $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h \
+ $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h \
+ $(OSINC)\shellapi.h $(OSINC)\winbase.h $(OSINC)\wincon.h \
+ $(OSINC)\windef.h $(OSINC)\windows.h $(OSINC)\winerror.h \
+ $(OSINC)\wingdi.h $(OSINC)\winnetwk.h $(OSINC)\winnls.h \
+ $(OSINC)\winnt.h $(OSINC)\winperf.h $(OSINC)\winreg.h \
+ $(OSINC)\winsock.h $(OSINC)\winspool.h $(OSINC)\winsvc.h \
+ $(OSINC)\winuser.h $(OSINC)\winver.h ..\ole2ui\enumfetc.h \
+ ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\dxferobj.h .\ias.h .\iocs.h \
+ .\pre.h .\resource.h .\simpdnd.h .\site.h
+
+$(OBJDIR)\ias.obj $(OBJDIR)\ias.lst: .\ias.cpp $(CAIROLE)\h\export\coguid.h \
+ $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \
+ $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \
+ $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \
+ $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \
+ $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \
+ $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \
+ $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \
+ $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \
+ $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \
+ $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \
+ $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \
+ $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \
+ $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \
+ $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \
+ $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \
+ $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \
+ $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \
+ $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \
+ .\doc.h .\ias.h .\ids.h .\idt.h .\iocs.h .\pre.h .\resource.h \
+ .\simpdnd.h .\site.h
+
+$(OBJDIR)\ids.obj $(OBJDIR)\ids.lst: .\ids.cpp $(CAIROLE)\h\export\coguid.h \
+ $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \
+ $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \
+ $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \
+ $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \
+ $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \
+ $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \
+ $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \
+ $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \
+ $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \
+ $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \
+ $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \
+ $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \
+ $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \
+ $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \
+ $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \
+ $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \
+ $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \
+ $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\doc.h \
+ .\dxferobj.h .\ias.h .\ids.h .\idt.h .\iocs.h .\pre.h .\resource.h \
+ .\simpdnd.h .\site.h
+
+$(OBJDIR)\idt.obj $(OBJDIR)\idt.lst: .\idt.cpp $(CAIROLE)\h\export\coguid.h \
+ $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \
+ $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \
+ $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \
+ $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \
+ $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \
+ $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \
+ $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \
+ $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \
+ $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \
+ $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \
+ $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \
+ $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \
+ $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \
+ $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \
+ $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \
+ $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \
+ $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \
+ $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \
+ .\doc.h .\ias.h .\ids.h .\idt.h .\iocs.h .\pre.h .\resource.h \
+ .\simpdnd.h .\site.h
+
+$(OBJDIR)\iocs.obj $(OBJDIR)\iocs.lst: .\iocs.cpp \
+ $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \
+ $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \
+ $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \
+ $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \
+ $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \
+ $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \
+ $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \
+ $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\string.h \
+ $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h \
+ $(OSINC)\dlgs.h $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h \
+ $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h \
+ $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h \
+ $(OSINC)\shellapi.h $(OSINC)\winbase.h $(OSINC)\wincon.h \
+ $(OSINC)\windef.h $(OSINC)\windows.h $(OSINC)\winerror.h \
+ $(OSINC)\wingdi.h $(OSINC)\winnetwk.h $(OSINC)\winnls.h \
+ $(OSINC)\winnt.h $(OSINC)\winperf.h $(OSINC)\winreg.h \
+ $(OSINC)\winsock.h $(OSINC)\winspool.h $(OSINC)\winsvc.h \
+ $(OSINC)\winuser.h $(OSINC)\winver.h ..\ole2ui\ole2ui.h \
+ ..\ole2ui\olestd.h .\app.h .\doc.h .\ias.h .\ids.h .\idt.h \
+ .\iocs.h .\pre.h .\resource.h .\simpdnd.h .\site.h
+
+$(OBJDIR)\pre.obj $(OBJDIR)\pre.lst: .\pre.cpp $(CAIROLE)\h\export\coguid.h \
+ $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \
+ $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \
+ $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \
+ $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \
+ $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \
+ $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \
+ $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \
+ $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \
+ $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \
+ $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \
+ $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \
+ $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \
+ $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \
+ $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \
+ $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \
+ $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \
+ $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \
+ $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\pre.h \
+ .\resource.h .\simpdnd.h
+
+$(OBJDIR)\simpdnd.obj $(OBJDIR)\simpdnd.lst: .\simpdnd.cpp \
+ $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \
+ $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \
+ $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \
+ $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \
+ $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \
+ $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \
+ $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \
+ $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\string.h \
+ $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h \
+ $(OSINC)\dlgs.h $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h \
+ $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h \
+ $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h \
+ $(OSINC)\shellapi.h $(OSINC)\winbase.h $(OSINC)\wincon.h \
+ $(OSINC)\windef.h $(OSINC)\windows.h $(OSINC)\winerror.h \
+ $(OSINC)\wingdi.h $(OSINC)\winnetwk.h $(OSINC)\winnls.h \
+ $(OSINC)\winnt.h $(OSINC)\winperf.h $(OSINC)\winreg.h \
+ $(OSINC)\winsock.h $(OSINC)\winspool.h $(OSINC)\winsvc.h \
+ $(OSINC)\winuser.h $(OSINC)\winver.h ..\ole2ui\ole2ui.h \
+ ..\ole2ui\olestd.h .\app.h .\doc.h .\ias.h .\ids.h .\idt.h \
+ .\iocs.h .\pre.h .\resource.h .\simpdnd.h .\site.h
+
+$(OBJDIR)\site.obj $(OBJDIR)\site.lst: .\site.cpp \
+ $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \
+ $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \
+ $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \
+ $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \
+ $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \
+ $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \
+ $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \
+ $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\string.h \
+ $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h \
+ $(OSINC)\dlgs.h $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h \
+ $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h \
+ $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h \
+ $(OSINC)\shellapi.h $(OSINC)\winbase.h $(OSINC)\wincon.h \
+ $(OSINC)\windef.h $(OSINC)\windows.h $(OSINC)\winerror.h \
+ $(OSINC)\wingdi.h $(OSINC)\winnetwk.h $(OSINC)\winnls.h \
+ $(OSINC)\winnt.h $(OSINC)\winperf.h $(OSINC)\winreg.h \
+ $(OSINC)\winsock.h $(OSINC)\winspool.h $(OSINC)\winsvc.h \
+ $(OSINC)\winuser.h $(OSINC)\winver.h ..\ole2ui\ole2ui.h \
+ ..\ole2ui\olestd.h .\app.h .\doc.h .\ias.h .\ids.h .\idt.h \
+ .\iocs.h .\pre.h .\resource.h .\simpdnd.h .\site.h
+
diff --git a/private/oleutest/simpdnd/dirs b/private/oleutest/simpdnd/dirs
new file mode 100644
index 000000000..e0e16d167
--- /dev/null
+++ b/private/oleutest/simpdnd/dirs
@@ -0,0 +1,3 @@
+DIRS=
+OPTIONAL_DIRS= \
+ daytona
diff --git a/private/oleutest/simpdnd/doc.cpp b/private/oleutest/simpdnd/doc.cpp
new file mode 100644
index 000000000..f6eb42add
--- /dev/null
+++ b/private/oleutest/simpdnd/doc.cpp
@@ -0,0 +1,825 @@
+//**********************************************************************
+// File name: DOC.CPP
+//
+// Implementation file for CSimpleDoc.
+//
+// Functions:
+//
+// See DOC.H for Class Definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+#include "idt.h"
+#include "dxferobj.h"
+
+//**********************************************************************
+//
+// CSimpleDoc::Create
+//
+// Purpose:
+//
+// Creation for the CSimpleDoc Class
+//
+// Parameters:
+//
+// CSimpleApp FAR * lpApp - Pointer to the CSimpleApp Class
+//
+// LPRECT lpRect - Client area rect of "frame" window
+//
+// HWND hWnd - Window Handle of "frame" window
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// StgCreateDocfile OLE API
+// RegisterDragDrop OLE API
+// CoLockObjectExternal OLE API
+// CreateWindow Windows API
+// ShowWindow Windows API
+// UpdateWindow Windows API
+// EnableMenuItem Windows API
+//
+// Comments:
+//
+// This routine was added so that failure could be returned
+// from object creation.
+//
+//********************************************************************
+
+CSimpleDoc FAR * CSimpleDoc::Create(CSimpleApp FAR *lpApp, LPRECT lpRect,
+ HWND hWnd)
+{
+ CSimpleDoc FAR * lpTemp = new CSimpleDoc(lpApp, hWnd);
+
+ if (!lpTemp)
+ {
+ TestDebugOut("Memory allocation error\n");
+ return NULL;
+ }
+
+ // create storage for the doc.
+ HRESULT hErr = StgCreateDocfile (
+ NULL, // generate temp name
+ STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
+ 0, &lpTemp->m_lpStorage);
+
+ if (hErr != NOERROR)
+ goto error;
+
+ // create the document Window
+ lpTemp->m_hDocWnd = CreateWindow(
+ TEXT("SimpDndDocWClass"),
+ NULL,
+ WS_CHILD | WS_CLIPCHILDREN,
+ lpRect->left,
+ lpRect->top,
+ lpRect->right,
+ lpRect->bottom,
+ hWnd,
+ NULL,
+ lpApp->m_hInst,
+ NULL);
+
+ if (!lpTemp->m_hDocWnd)
+ goto error;
+
+ ShowWindow(lpTemp->m_hDocWnd, SW_SHOWNORMAL); // Show the window
+ UpdateWindow(lpTemp->m_hDocWnd); // Sends WM_PAINT message
+
+#ifdef NOTREADY
+ // Ensable InsertObject menu choice
+ EnableMenuItem( lpApp->m_hEditMenu, 0, MF_BYPOSITION | MF_ENABLED);
+#else
+ // Ensable InsertObject menu choice
+ EnableMenuItem( lpApp->m_hEditMenu, 1, MF_BYPOSITION | MF_ENABLED);
+ // Disable Copy menu choice
+ EnableMenuItem( lpApp->m_hEditMenu, 0, MF_BYPOSITION | MF_DISABLED |
+ MF_GRAYED);
+#endif // NOTREADY
+
+ HRESULT hRes;
+
+ // It is *REQUIRED* to hold a strong LOCK on the object that is
+ // registered as drop target. this call will result in at least one
+ // ref count held on our document. later in CSimpleDoc::Close we will
+ // unlock this lock which will make our document's ref count go to 0.
+ // when the document's ref count goes to 0, it will be deleted.
+ if ( (hRes=CoLockObjectExternal (&lpTemp->m_DropTarget, TRUE, 0))
+ != ResultFromScode(S_OK) )
+ {
+ /* CoLockObjectExternal should never fail. If it fails, we don't want
+ * to carry on since we don't have a guaranteed object lock.
+ */
+ goto error;
+ }
+
+ // Register our window as a DropTarget
+ if (((hRes=RegisterDragDrop(lpTemp->m_hDocWnd, &lpTemp->m_DropTarget))
+ !=ResultFromScode(S_OK))
+ && (hRes != ResultFromScode(DRAGDROP_E_ALREADYREGISTERED)))
+ {
+ lpTemp->m_fRegDragDrop = FALSE;
+ }
+ else
+ {
+ lpTemp->m_fRegDragDrop = TRUE;
+ }
+
+ return (lpTemp);
+
+error:
+ TestDebugOut("Fail in CSimpleDoc::Create\n");
+ delete (lpTemp);
+ return NULL;
+
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::Close
+//
+// Purpose:
+//
+// Close CSimpleDoc object.
+// when the document's reference count goes to 0, the document
+// will be destroyed.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// RevokeDragDrop OLE API
+// CoLockObjectExternal OLE API
+// OleFlushClipboard OLE API
+// ShowWindow Windows API
+// CSimpleSite::CloseOleObject SITE.CPP
+//
+//
+//********************************************************************
+
+void CSimpleDoc::Close(void)
+{
+ TestDebugOut("In CSimpleDoc::Close\r\n");
+
+ HRESULT hRes;
+
+ ShowWindow(m_hDocWnd, SW_HIDE); // Hide the window
+
+ // Remove our data transfer object from clipboard if it is there.
+ // this will leave HGLOBAL based data behind on the clipboard
+ // including OLE 1.0 compatibility formats.
+
+ if (OleFlushClipboard() != ResultFromScode(S_OK))
+ {
+ TestDebugOut("Fail in OleFlushClipBoard\n");
+ }
+
+ // Revoke our window as a DropTarget
+ if (m_fRegDragDrop)
+ {
+ if (((hRes=RevokeDragDrop(m_hDocWnd)) != ResultFromScode(S_OK)) &&
+ (hRes!=ResultFromScode(DRAGDROP_E_NOTREGISTERED)))
+ {
+ /* if we fail in revoking the drag-drop, we will probably be
+ * having memory leakage.
+ */
+ TestDebugOut("Fail in RevokeDragDrop\n");
+ }
+ else
+ {
+ m_fRegDragDrop = FALSE;
+ }
+ }
+
+ // Close the OLE object in our document
+ if (m_lpSite)
+ m_lpSite->CloseOleObject();
+
+ // Unlock the lock added in CSimpleDoc::Create. this will make
+ // the document's ref count go to 0, and the document will be deleted.
+ if ((hRes=CoLockObjectExternal (&m_DropTarget, FALSE, TRUE))
+ !=ResultFromScode(S_OK))
+ {
+ /* if CoLockObjectExternal fails, this means that we cannot release
+ * the reference count to our destinated object. This will cause
+ * memory leakage.
+ */
+ TestDebugOut("Fail in CoLockObjectExternal\n");
+ }
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::CSimpleDoc
+//
+// Purpose:
+//
+// Constructor for the CSimpleDoc Class
+//
+// Parameters:
+//
+// CSimpleApp FAR * lpApp - Pointer to the CSimpleApp Class
+//
+// HWND hWnd - Window Handle of "frame" window
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// GetMenu Windows API
+// GetSubMenu Windows API
+//
+//
+//********************************************************************
+#pragma warning(disable : 4355) // turn off this warning. This warning
+ // tells us that we are passing this in
+ // an initializer, before "this" is through
+ // initializing. This is ok, because
+ // we just store the ptr in the other
+ // constructor
+
+CSimpleDoc::CSimpleDoc(CSimpleApp FAR * lpApp,HWND hWnd)
+ : m_DropTarget(this), m_DropSource(this)
+#pragma warning (default : 4355) // Turn the warning back on
+{
+ TestDebugOut("In CSimpleDoc's Constructor\r\n");
+ m_lpApp = lpApp;
+ m_lpSite = NULL;
+ m_nCount = 0;
+ // set up menu handles
+ lpApp->m_hMainMenu = GetMenu(hWnd);
+ lpApp->m_hFileMenu = GetSubMenu(lpApp->m_hMainMenu, 0);
+ lpApp->m_hEditMenu = GetSubMenu(lpApp->m_hMainMenu, 1);
+ lpApp->m_hHelpMenu = GetSubMenu(lpApp->m_hMainMenu, 2);
+ lpApp->m_hCascadeMenu = NULL;
+ m_fModifiedMenu = FALSE;
+
+ // drag/drop related stuff
+ m_fRegDragDrop = FALSE; // is doc registered as drop target?
+ m_fLocalDrag = FALSE; // is doc source of the drag
+ m_fLocalDrop = FALSE; // was doc target of the drop
+ m_fCanDropCopy = FALSE; // is Drag/Drop copy/move possible?
+ m_fCanDropLink = FALSE; // is Drag/Drop link possible?
+ m_fDragLeave = FALSE; // has drag left
+ m_fPendingDrag = FALSE; // LButtonDown--possible drag pending
+ m_ptButDown.x = m_ptButDown.y = 0; // LButtonDown coordinates
+
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::~CSimpleDoc
+//
+// Purpose:
+//
+// Destructor for CSimpleDoc
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// GetMenuItemCount Windows API
+// RemoveMenu Windows API
+// DestroyMenu Windows API
+// DestroyWindow Windows API
+// CSimpleSite::Release SITE.CPP
+// CSimpleSite::UnloadOleObject SITE.CPP
+// IStorage::Release OLE API
+//
+//
+//********************************************************************
+
+CSimpleDoc::~CSimpleDoc()
+{
+ TestDebugOut("In CSimpleDoc's Destructor\r\n");
+
+ // Release all pointers we hold to the OLE object, also release
+ // the ref count added in CSimpleSite::Create. this will make
+ // the Site's ref count go to 0, and the Site will be deleted.
+ if (m_lpSite)
+ {
+ m_lpSite->UnloadOleObject();
+ m_lpSite->Release();
+ m_lpSite = NULL;
+ }
+
+ // Release the Storage
+ if (m_lpStorage)
+ {
+ m_lpStorage->Release();
+ m_lpStorage = NULL;
+ }
+
+ // if the edit menu was modified, remove the menu item and
+ // destroy the popup if it exists
+ if (m_fModifiedMenu)
+ {
+ int nCount = GetMenuItemCount(m_lpApp->m_hEditMenu);
+ RemoveMenu(m_lpApp->m_hEditMenu, nCount-1, MF_BYPOSITION);
+ if (m_lpApp->m_hCascadeMenu)
+ DestroyMenu(m_lpApp->m_hCascadeMenu);
+ }
+
+ DestroyWindow(m_hDocWnd);
+}
+
+
+//**********************************************************************
+//
+// CSimpleDoc::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation at the Document level.
+//
+// Parameters:
+//
+// REFIID riid - ID of interface to be returned
+// LPVOID FAR* ppvObj - Location to return the interface
+//
+// Return Value:
+//
+// S_OK - Interface supported
+// E_NOINTERFACE - Interface NOT supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+//
+//
+//********************************************************************
+
+STDMETHODIMP CSimpleDoc::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpleDoc::QueryInterface\r\n");
+
+ *ppvObj = NULL; // must set out pointer parameters to NULL
+
+ // looking for IUnknown
+ if (IsEqualIID( riid, IID_IUnknown))
+ {
+ AddRef();
+ *ppvObj = this;
+ return ResultFromScode(S_OK);
+ }
+
+ // looking for IDropTarget
+ if (IsEqualIID( riid, IID_IDropTarget))
+ {
+ m_DropTarget.AddRef();
+ *ppvObj=&m_DropTarget;
+ return ResultFromScode(S_OK);
+ }
+
+ // looking for IDropSource
+ if (IsEqualIID( riid, IID_IDropSource))
+ {
+ m_DropSource.AddRef();
+ *ppvObj=&m_DropSource;
+ return ResultFromScode(S_OK);
+ }
+
+ // Not a supported interface
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::AddRef
+//
+// Purpose:
+//
+// Increments the document reference count
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// UINT - The new reference count on the document object
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleApp::AddRef APP.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpleDoc::AddRef()
+{
+ TestDebugOut("In CSimpleDoc::AddRef\r\n");
+ return ++m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::Release
+//
+// Purpose:
+//
+// Decrements the document reference count
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// UINT - The new reference count on the document
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpleDoc::Release()
+{
+ TestDebugOut("In CSimpleDoc::Release\r\n");
+
+ if (--m_nCount == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::InsertObject
+//
+// Purpose:
+//
+// Inserts a new object to this document
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::Create SITE.CPP
+// CSimpleSite::InitObject SITE.CPP
+// CSimpleSite::Release SITE.CPP
+// CSimpleSite::Revert SITE.CPP
+// memset C Runtime
+// OleUIInsertObject OLE2UI function
+// CSimpleDoc::DisableInsertObject DOC.CPP
+//
+// Comments:
+//
+// This implementation only allows one object to be inserted
+// into a document. Once the object has been inserted, then
+// the Insert Object menu choice is greyed out, to prevent
+// the user from inserting another.
+//
+//********************************************************************
+
+void CSimpleDoc::InsertObject()
+{
+ OLEUIINSERTOBJECT io;
+ UINT iret;
+ TCHAR szFile[OLEUI_CCHPATHMAX];
+
+ HRESULT hRes;
+
+ m_lpSite = CSimpleSite::Create(this);
+
+ if (!m_lpSite)
+ {
+ /* memory allocation problem. cannot continue.
+ */
+ TestDebugOut("Memory allocation error\n");
+ return;
+ }
+
+ // clear the structure
+ _fmemset(&io, 0, sizeof(OLEUIINSERTOBJECT));
+
+ // fill the structure
+ io.cbStruct = sizeof(OLEUIINSERTOBJECT);
+ io.dwFlags = IOF_SELECTCREATENEW | IOF_DISABLELINK |
+ IOF_DISABLEDISPLAYASICON | IOF_CREATENEWOBJECT |
+ IOF_CREATEFILEOBJECT;
+ io.hWndOwner = m_hDocWnd;
+ io.lpszCaption = (LPTSTR)TEXT("Insert Object");
+ io.iid = IID_IOleObject;
+ io.oleRender = OLERENDER_DRAW;
+ io.lpIOleClientSite = &m_lpSite->m_OleClientSite;
+ io.lpIStorage = m_lpSite->m_lpObjStorage;
+ io.ppvObj = (LPVOID FAR *)&m_lpSite->m_lpOleObject;
+ io.lpszFile = szFile;
+ io.cchFile = sizeof(szFile)/sizeof(TCHAR);
+ // cchFile is the number of characters
+ _fmemset((LPTSTR)szFile, 0, sizeof(szFile));
+
+ // call OUTLUI to do all the hard work
+ iret = OleUIInsertObject(&io);
+
+ if (iret == OLEUI_OK)
+ {
+ m_lpSite->InitObject((BOOL)(io.dwFlags & IOF_SELECTCREATENEW));
+ // disable Insert Object menu item
+ DisableInsertObject();
+ }
+ else
+ {
+ m_lpSite->Release();
+ m_lpSite = NULL;
+ if (((hRes=m_lpStorage->Revert()) != ResultFromScode(S_OK)) &&
+ (hRes!=ResultFromScode(STG_E_REVERTED)))
+ {
+ TestDebugOut("Fail in IStorage::Revert\n");
+ }
+ }
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::lResizeDoc
+//
+// Purpose:
+//
+// Resizes the document
+//
+// Parameters:
+//
+// LPRECT lpRect - The size of the client are of the "frame"
+// Window.
+//
+// Return Value:
+//
+// NULL
+//
+// Function Calls:
+// Function Location
+//
+// MoveWindow Windows API
+//
+//
+//********************************************************************
+
+long CSimpleDoc::lResizeDoc(LPRECT lpRect)
+{
+ MoveWindow(
+ m_hDocWnd,
+ lpRect->left, lpRect->top,
+ lpRect->right, lpRect->bottom, TRUE);
+
+ return NULL;
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::lAddVerbs
+//
+// Purpose:
+//
+// Adds the objects verbs to the edit menu.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// NULL
+//
+// Function Calls:
+// Function Location
+//
+// GetMenuItemCount Windows API
+// OleUIAddVerbMenu OLE2UI function
+//
+//
+//********************************************************************
+
+long CSimpleDoc::lAddVerbs(void)
+{
+ // m_fModifiedMenu is TRUE if the menu has already been modified
+ // once. Since we only support one obect every time the application
+ // is run, then once the menu is modified, it doesn't have
+ // to be done again.
+ if (m_lpSite && !m_fModifiedMenu)
+ {
+ int nCount = GetMenuItemCount(m_lpApp->m_hEditMenu);
+
+ if (!OleUIAddVerbMenu ( m_lpSite->m_lpOleObject,
+ NULL,
+ m_lpApp->m_hEditMenu,
+ nCount + 1,
+ IDM_VERB0,
+ 0, // no maximum verb IDM enforced
+ FALSE,
+ 1,
+ &m_lpApp->m_hCascadeMenu) )
+ {
+ TestDebugOut("Fail in OleUIAddVerbMenu\n");
+ }
+
+ m_fModifiedMenu = TRUE;
+ }
+ return (NULL);
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::PaintDoc
+//
+// Purpose:
+//
+// Paints the Document
+//
+// Parameters:
+//
+// HDC hDC - hDC of the document Window
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::PaintObj SITE.CPP
+//
+//
+//********************************************************************
+
+void CSimpleDoc::PaintDoc (HDC hDC)
+{
+ // if we supported multiple objects, then we would enumerate
+ // the objects and call paint on each of them from here.
+
+ if (m_lpSite)
+ m_lpSite->PaintObj(hDC);
+
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::DisableInsertObject
+//
+// Purpose:
+//
+// Disable the ability to insert a new object in this document.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// RevokeDragDrop OLE API
+// EnableMenuItem Windows API
+//
+// Comments:
+//
+// This implementation only allows one object to be inserted
+// into a document. Once the object has been inserted, then
+// the Insert Object menu choice is greyed out, to prevent
+// the user from inserting another. Also we revoke ourself as
+// a potential drop target.
+//
+//********************************************************************
+
+void CSimpleDoc::DisableInsertObject(void)
+{
+#ifdef NOTREADY
+ // Disable InsertObject menu choice
+ EnableMenuItem( m_lpApp->m_hEditMenu, 0, MF_BYPOSITION | MF_DISABLED |
+ MF_GRAYED);
+#else
+ // Disable InsertObject menu choice
+ EnableMenuItem( m_lpApp->m_hEditMenu, 1, MF_BYPOSITION | MF_DISABLED |
+ MF_GRAYED);
+ // Enable Copy menu choice
+ EnableMenuItem( m_lpApp->m_hEditMenu, 0, MF_BYPOSITION | MF_ENABLED);
+#endif // NOTREADY
+
+ // We no longer accept dropping of objects
+ if (m_fRegDragDrop)
+ {
+ HRESULT hRes;
+ if (((hRes=RevokeDragDrop(m_hDocWnd))!=ResultFromScode(S_OK)) &&
+ (hRes!=ResultFromScode(DRAGDROP_E_NOTREGISTERED)))
+ {
+ /* if we fail in revoking the drag-drop, we will probably be
+ * having memory leakage.
+ */
+ TestDebugOut("Fail in RevokeDragDrop\n");
+ }
+ else
+ {
+ m_fRegDragDrop = FALSE;
+ }
+ }
+}
+
+//**********************************************************************
+//
+// CSimpleDoc::CopyObjectToClip
+//
+// Purpose:
+//
+// Copy the embedded OLE object to the clipboard
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CDataXferObj::Create DXFEROBJ.CPP
+// CDataXferObj::Release DXFEROBJ.CPP
+// CDataXferObj::QueryInterface DXFEROBJ.CPP
+// OleSetClipboard OLE API
+//
+// Comments:
+//
+// This implementation only allows one object to be inserted
+// into a document. Once the object has been inserted, then
+// the Copy menu choice is enabled.
+//
+//********************************************************************
+
+void CSimpleDoc::CopyObjectToClip(void)
+{
+ LPDATAOBJECT lpDataObj;
+
+ // Create a data transfer object by cloning the existing OLE object
+ CDataXferObj FAR* pDataXferObj = CDataXferObj::Create(m_lpSite,NULL);
+ if (! pDataXferObj)
+ {
+ /* memory allocation error !
+ */
+ MessageBox(NULL, TEXT("Out-of-memory"), TEXT("SimpDnD"),
+ MB_SYSTEMMODAL | MB_ICONHAND);
+ return;
+ }
+ // initially obj is created with 0 refcnt. this QI will make it go to 1.
+ pDataXferObj->QueryInterface(IID_IDataObject, (LPVOID FAR*)&lpDataObj);
+
+ // put out data transfer object on the clipboard. this API will AddRef.
+ if (OleSetClipboard(lpDataObj) != ResultFromScode(S_OK))
+ {
+ TestDebugOut("Fail in OleSetClipboard\n");
+ lpDataObj->Release();
+ }
+
+ // Give ownership of data transfer object to clipboard
+ pDataXferObj->Release();
+}
diff --git a/private/oleutest/simpdnd/doc.h b/private/oleutest/simpdnd/doc.h
new file mode 100644
index 000000000..7af852750
--- /dev/null
+++ b/private/oleutest/simpdnd/doc.h
@@ -0,0 +1,75 @@
+//**********************************************************************
+// File name: doc.h
+//
+// Definition of CSimpleDoc
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _DOC_H_ )
+#define _DOC_H_
+
+#include "idt.h"
+#include "ids.h"
+
+class CSimpleSite;
+class CSimpleApp;
+
+class CSimpleDoc : public IUnknown
+{
+public:
+ int m_nCount; // reference count
+ LPSTORAGE m_lpStorage; // IStorage* pointer for Doc
+ BOOL m_fModifiedMenu; // is object's verb menu on menu
+
+ // Drag/Drop related fields
+ BOOL m_fRegDragDrop; // is doc registered as drop target?
+ BOOL m_fLocalDrag; // is doc source of the drag
+ BOOL m_fLocalDrop; // was doc target of the drop
+ BOOL m_fCanDropCopy; // is Drag/Drop copy/move possible?
+ BOOL m_fCanDropLink; // is Drag/Drop link possible?
+ BOOL m_fDragLeave; // has drag left
+ BOOL m_fPendingDrag; // LButtonDown--possible drag pending
+ POINT m_ptButDown; // LButtonDown coordinates
+
+ CSimpleSite FAR * m_lpSite;
+ CSimpleApp FAR * m_lpApp;
+
+ HWND m_hDocWnd;
+
+ CDropTarget m_DropTarget;
+ CDropSource m_DropSource;
+
+ static CSimpleDoc FAR* Create(CSimpleApp FAR *lpApp, LPRECT lpRect,
+ HWND hWnd);
+
+ void Close(void);
+
+ CSimpleDoc();
+ CSimpleDoc(CSimpleApp FAR *lpApp, HWND hWnd);
+ ~CSimpleDoc();
+
+ // IUnknown Interface
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ void InsertObject(void);
+ void DisableInsertObject(void);
+ long lResizeDoc(LPRECT lpRect);
+ long lAddVerbs(void);
+ void PaintDoc(HDC hDC);
+
+ // Drag/Drop and clipboard support methods
+ void CopyObjectToClip(void);
+ BOOL QueryDrag(POINT pt);
+ DWORD DoDragDrop(void);
+ void Scroll(DWORD dwScrollDir) { /*...scroll Doc here...*/ }
+
+private:
+
+ void FailureNotifyHelper(TCHAR *pszMsg, DWORD dwData);
+
+};
+
+#endif // _DOC_H_
diff --git a/private/oleutest/simpdnd/dxferobj.cpp b/private/oleutest/simpdnd/dxferobj.cpp
new file mode 100644
index 000000000..c95dbe8bf
--- /dev/null
+++ b/private/oleutest/simpdnd/dxferobj.cpp
@@ -0,0 +1,739 @@
+//**********************************************************************
+// File name: DXFEROBJ.CPP
+//
+// Implementation file for CDataXferObj, data transfer object
+// implementation of IDataObject interface.
+//
+// Functions:
+//
+// See DXFEROBJ.H for class definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include <enumfetc.h>
+#include <assert.h>
+#include "dxferobj.h"
+#include "site.h"
+
+//BUGBUG: These should be fetched from real header files
+#define CF_HDROP 15
+typedef struct _dropfilestruct {
+ DWORD pFiles;
+ POINT pt;
+ BOOL fNC;
+ BOOL fWide;
+} DROPFILESTRUCT;
+
+
+CLIPFORMAT g_cfEmbeddedObject=RegisterClipboardFormat(CF_EMBEDDEDOBJECT);
+CLIPFORMAT g_cfObjectDescriptor=RegisterClipboardFormat(CF_OBJECTDESCRIPTOR);
+
+// List of formats offered by our data transfer object via EnumFormatEtc
+static FORMATETC s_arrGetFmtEtcs[] =
+{
+ { g_cfEmbeddedObject, NULL, DVASPECT_CONTENT, -1, TYMED_ISTORAGE},
+ { g_cfObjectDescriptor, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL},
+ { CF_METAFILEPICT, NULL, DVASPECT_CONTENT, -1, TYMED_MFPICT}
+};
+
+
+//**********************************************************************
+//
+// CDataXferObj::Create
+//
+// Purpose:
+//
+// Creation routine for CDataXferObj
+//
+// Parameters:
+//
+// CSimpleSite FAR *lpSite - Pointer to source CSimpleSite
+// this is the container site of the
+// source OLE object to be transfered
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// StgCreateDocfile OLE API
+// assert C Runtime
+//
+// Comments:
+// reference count of CDataXferObj will be 0 on return.
+//
+//********************************************************************
+
+CDataXferObj FAR * CDataXferObj::Create(
+ CSimpleSite FAR *lpSite,
+ POINTL FAR* pPointl
+)
+{
+ CDataXferObj FAR * lpTemp = new CDataXferObj();
+
+ if (!lpTemp)
+ return NULL;
+
+ // create a sub-storage for the object
+ HRESULT hErr = StgCreateDocfile(
+ NULL,
+ STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE |
+ STGM_DELETEONRELEASE,
+ 0,
+ &lpTemp->m_lpObjStorage);
+
+ assert(hErr == NOERROR);
+
+ if (hErr != NOERROR)
+ {
+ delete lpTemp;
+ return NULL;
+ }
+
+ // Clone the source object
+ if (lpSite->m_lpOleObject)
+ {
+ // Object is loaded; ask the object to save into the new storage
+ LPPERSISTSTORAGE pPersistStorage;
+
+ if (lpSite->m_lpOleObject->QueryInterface(IID_IPersistStorage,
+ (LPVOID FAR*)&pPersistStorage) != ResultFromScode(S_OK))
+ {
+ /* cannot find interface
+ */
+ return(NULL);
+ }
+ assert(pPersistStorage);
+ if (OleSave(pPersistStorage, lpTemp->m_lpObjStorage, FALSE)
+ != ResultFromScode(S_OK))
+ {
+ TestDebugOut("Fail in OleSave\n");
+ }
+
+ // pass NULL so that object application won't forget the real stg
+ if (pPersistStorage->SaveCompleted(NULL) != ResultFromScode(S_OK))
+ {
+ TestDebugOut("Fail in IPersistStorage::SaveCompleted\n");
+ }
+ pPersistStorage->Release();
+ }
+ else
+ {
+ // Object not loaded so use cheaper IStorage CopyTo operation
+ lpSite->m_lpObjStorage->CopyTo(0, NULL, NULL, lpTemp->m_lpObjStorage);
+ }
+
+ if (OleLoad(lpTemp->m_lpObjStorage, IID_IOleObject, NULL,
+ (LPVOID FAR*)&lpTemp->m_lpOleObject)
+ != ResultFromScode(S_OK))
+ {
+ /* we cannot load the embedded/linked object into the memory
+ */
+ return(NULL);
+ }
+ assert(lpTemp->m_lpOleObject);
+
+ lpTemp->m_sizel = lpSite->m_sizel;
+ if (pPointl)
+ lpTemp->m_pointl = *pPointl;
+ else
+ lpTemp->m_pointl.x = lpTemp->m_pointl.y = 0;
+ return lpTemp;
+}
+
+//**********************************************************************
+//
+// CDataXferObj::CDataXferObj
+//
+// Purpose:
+//
+// Constructor for CDataXferObj
+//
+// Parameters:
+//
+// CSimpleDoc FAR *lpDoc - Pointer to CSimpleDoc
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+//
+//********************************************************************
+
+CDataXferObj::CDataXferObj (void)
+{
+ // clear the reference count
+ m_nCount = 0;
+
+ m_lpObjStorage = NULL;
+ m_lpOleObject = NULL;
+ m_sizel.cx = m_sizel.cy = 0;
+ m_pointl.x = m_pointl.y = 0;
+}
+
+//**********************************************************************
+//
+// CDataXferObj::~CDataXferObj
+//
+// Purpose:
+//
+// Destructor for CDataXferObj
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleObject::Release Object
+// IStorage::Release OLE API
+//
+//
+//********************************************************************
+
+CDataXferObj::~CDataXferObj ()
+{
+ TestDebugOut ("In CDataXferObj's Destructor \r\n");
+
+ if (m_lpOleObject)
+ {
+ m_lpOleObject->Release();
+ m_lpOleObject = NULL;
+
+ // Release the storage for this object
+ m_lpObjStorage->Release();
+ m_lpObjStorage = NULL;
+ }
+}
+
+
+
+//**********************************************************************
+//
+// CDataXferObj::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation of the CDataXferObj instance
+//
+// Parameters:
+//
+// REFIID riid - A reference to the interface that is
+// being queried.
+//
+// LPVOID FAR* ppvObj - An out parameter to return a pointer to
+// the interface.
+//
+// Return Value:
+//
+// S_OK - The interface is supported.
+// E_NOINTERFACE - The interface is not supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IsEqualIID OLE API
+// ResultFromScode OLE API
+// CDataXferObj::AddRef DXFEROBJ.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDataXferObj::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CDataXferObj::QueryInterface\r\n");
+
+ if (IsEqualIID( riid, IID_IUnknown) || IsEqualIID(riid, IID_IDataObject))
+ {
+ AddRef();
+ *ppvObj = this;
+ return NOERROR;
+ }
+
+ // unknown interface requested
+ *ppvObj = NULL; // must set out pointer parameters to NULL
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+//**********************************************************************
+//
+// CDataXferObj::AddRef
+//
+// Purpose:
+//
+// Increments the reference count of the CDataXferObj instance
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the object
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDataXferObj::AddRef()
+{
+ TestDebugOut("In CDataXferObj::AddRef\r\n");
+
+ return ++m_nCount;
+}
+
+//**********************************************************************
+//
+// CDataXferObj::Release
+//
+// Purpose:
+//
+// Decrements the reference count of the CDataXferObj object
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the object.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDataXferObj::Release()
+{
+ TestDebugOut("In CDataXferObj::Release\r\n");
+
+ if (--m_nCount == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return m_nCount;
+}
+
+
+/********************************************************************
+** This IDataObject implementation is used for data transfer.
+**
+** The following methods are NOT supported for data transfer:
+** IDataObject::SetData -- return E_NOTIMPL
+** IDataObject::DAdvise -- return OLE_E_ADVISENOTSUPPORTED
+** ::DUnadvise
+** ::EnumDAdvise
+** IDataObject::GetCanonicalFormatEtc -- return E_NOTIMPL
+** (NOTE: must set pformatetcOut->ptd = NULL)
+*********************************************************************/
+
+
+//**********************************************************************
+//
+// CDataXferObj::QueryGetData
+//
+// Purpose:
+//
+// Called to determine if our object supports a particular
+// FORMATETC.
+//
+// Parameters:
+//
+// LPFORMATETC pformatetc - Pointer to the FORMATETC being queried for.
+//
+// Return Value:
+//
+// DV_E_FORMATETC - The FORMATETC is not supported
+// S_OK - The FORMATETC is supported.
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+//
+// Comments:
+// we support the following formats:
+// "Embedded Object"
+// "Object Descriptor"
+// CF_METAFILEPICT
+//
+//********************************************************************
+STDMETHODIMP CDataXferObj::QueryGetData (LPFORMATETC pformatetc)
+{
+ SCODE sc = DV_E_FORMATETC;
+
+ TestDebugOut("In CDataXferObj::QueryGetData\r\n");
+
+ // check the validity of the formatetc.
+
+ if ( (pformatetc->cfFormat == g_cfEmbeddedObject) &&
+ (pformatetc->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetc->tymed == TYMED_ISTORAGE) )
+ {
+ sc = S_OK;
+ }
+
+ else if ( (pformatetc->cfFormat == g_cfObjectDescriptor) &&
+ (pformatetc->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetc->tymed == TYMED_HGLOBAL) )
+ {
+ sc = S_OK;
+ }
+
+ else if ( (pformatetc->cfFormat == CF_METAFILEPICT) &&
+ (pformatetc->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetc->tymed == TYMED_MFPICT) )
+ {
+ sc = S_OK;
+ }
+ else if ( (pformatetc->cfFormat == CF_HDROP) &&
+ (pformatetc->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetc->tymed == TYMED_HGLOBAL) )
+ {
+ sc = S_OK;
+ }
+
+ return ResultFromScode(sc);
+}
+
+extern BOOL gfUseEmptyEnumerator;
+
+//**********************************************************************
+//
+// CDataXferObj::EnumFormatEtc
+//
+// Purpose:
+//
+// Enumerates the formats that can be used to store data
+//
+// Parameters:
+//
+// DWORD dwDirection - format to be enumerated
+//
+// LPENUMFORMATETC ppenumFormatEtc - where to return the
+// instantiated enumerator
+//
+// Return Value:
+//
+// S_OK - if the operation is successful
+// E_OUTOFMEMORY - if ran out of memory
+// E_NOTIMPL - if dwDirection is not supported
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+// OleStdEnumFmtEtc_Create OLE2UI
+//
+//**********************************************************************
+
+STDMETHODIMP CDataXferObj::EnumFormatEtc(
+ DWORD dwDirection,
+ LPENUMFORMATETC FAR* ppenumFormatEtc
+)
+{
+ SCODE sc = E_NOTIMPL;
+
+ TestDebugOut("In CDataXferObj::EnumFormatEtc\r\n");
+ *ppenumFormatEtc = NULL;
+
+ if( gfUseEmptyEnumerator == TRUE )
+ {
+ return E_FAIL;
+ }
+
+ if (dwDirection == DATADIR_GET)
+ {
+ *ppenumFormatEtc = OleStdEnumFmtEtc_Create(
+ sizeof(s_arrGetFmtEtcs)/sizeof(s_arrGetFmtEtcs[0]),
+ s_arrGetFmtEtcs);
+ if (*ppenumFormatEtc == NULL)
+ sc = E_OUTOFMEMORY;
+ else
+ sc = S_OK;
+ }
+ return ResultFromScode(sc);
+}
+
+
+//**********************************************************************
+//
+// CDataXferObj::GetData
+//
+// Purpose:
+//
+// Returns the data in the format specified in pformatetcIn.
+//
+// Parameters:
+//
+// LPFORMATETC pformatetcIn - The format requested by the caller
+//
+// LPSTGMEDIUM pmedium - The medium requested by the caller
+//
+// Return Value:
+//
+// DV_E_FORMATETC - Format not supported
+// S_OK - Success
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleStdGetOleObjectData OLE2UI API
+// OleStdGetMetafilePictFromOleObject OLE2UI API
+// OleStdGetObjectDescriptorDataFromOleObject OLE2UI API
+// ResultFromScode OLE API
+// IOleObject::QueryInterface Object
+//
+// Comments:
+// we support GetData for the following formats:
+// "Embedded Object"
+// "Object Descriptor"
+// CF_METAFILEPICT
+//
+//********************************************************************
+
+STDMETHODIMP CDataXferObj::GetData (
+ LPFORMATETC pformatetcIn,
+ LPSTGMEDIUM pmedium
+)
+{
+ SCODE sc = DV_E_FORMATETC;
+
+ TestDebugOut("In CDataXferObj::GetData\r\n");
+
+ // we must set all out pointer parameters to NULL. */
+ pmedium->tymed = TYMED_NULL;
+ pmedium->pUnkForRelease = NULL; // we transfer ownership to caller
+ pmedium->hGlobal = NULL;
+
+ // Check the FORMATETC and fill pmedium if valid.
+ if ( (pformatetcIn->cfFormat == g_cfEmbeddedObject) &&
+ (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetcIn->tymed == TYMED_ISTORAGE) )
+ {
+ LPPERSISTSTORAGE pPersistStorage;
+
+ /* render CF_EMBEDDEDOBJECT by asking the object to save
+ ** into a temporary, DELETEONRELEASE IStorage allocated by us.
+ */
+ HRESULT hRes;
+ if ((hRes=m_lpOleObject->QueryInterface(
+ IID_IPersistStorage, (LPVOID FAR*)&pPersistStorage))
+ != ResultFromScode(S_OK))
+ {
+ return(hRes);
+ }
+
+ assert(pPersistStorage);
+ HRESULT hrErr = OleStdGetOleObjectData(
+ pPersistStorage,
+ pformatetcIn,
+ pmedium,
+ FALSE /* fUseMemory -- (use file-base stg) */
+ );
+ pPersistStorage->Release();
+ sc = GetScode( hrErr );
+
+ }
+ else if ( (pformatetcIn->cfFormat == g_cfObjectDescriptor) &&
+ (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetcIn->tymed == TYMED_HGLOBAL) )
+ {
+
+ // render CF_OBJECTDESCRIPTOR data
+ pmedium->hGlobal = OleStdGetObjectDescriptorDataFromOleObject(
+ m_lpOleObject,
+ TEXT("Simple OLE 2.0 Container"), //string to identify source
+ DVASPECT_CONTENT,
+ m_pointl,
+ (LPSIZEL)&m_sizel
+ );
+ if (! pmedium->hGlobal)
+ sc = E_OUTOFMEMORY;
+ else
+ {
+ pmedium->tymed = TYMED_HGLOBAL;
+ sc = S_OK;
+ }
+
+ }
+ else if ( (pformatetcIn->cfFormat == CF_METAFILEPICT) &&
+ (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetcIn->tymed == TYMED_MFPICT) )
+ {
+
+ // render CF_METAFILEPICT by drawing the object into a metafile DC
+ pmedium->hGlobal = OleStdGetMetafilePictFromOleObject(
+ m_lpOleObject, DVASPECT_CONTENT, NULL, pformatetcIn->ptd);
+ if (! pmedium->hGlobal)
+ sc = E_OUTOFMEMORY;
+ else
+ {
+ pmedium->tymed = TYMED_MFPICT;
+ sc = S_OK;
+ }
+ }
+ else if ( (pformatetcIn->cfFormat == CF_HDROP) &&
+ (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetcIn->tymed == TYMED_HGLOBAL) )
+ {
+ // testing for Win3.1 style drag drop. If we offer
+ // CF_HDROP ( basically, a list of filenames) in a data object
+ // given to OLE DoDragDrop, then DoDragDrop will translate
+ // OLE drag drop into Win3.1 drag drop for Win3.1 drop targets
+
+ ULONG cbFile;
+ char szFile[256];
+ DROPFILESTRUCT *pdfs;
+ char *pfile;
+
+
+ cbFile = GetEnvironmentVariable("SystemRoot", szFile, sizeof(szFile));
+
+ if( cbFile == 0 )
+ {
+ sc = E_FAIL;
+ goto errRtn;
+ }
+
+
+ cbFile += sizeof("\\setup.txt");
+
+ strcat(szFile, "\\setup.txt");
+
+ pmedium->tymed = TYMED_HGLOBAL;
+
+ pmedium->hGlobal = GlobalAlloc( GMEM_DDESHARE,
+ sizeof(DROPFILESTRUCT) +
+ cbFile + 3);
+
+ if( pmedium->hGlobal )
+ {
+ pdfs = (DROPFILESTRUCT *)GlobalLock(pmedium->hGlobal);
+
+ if( pdfs )
+ {
+ pdfs->pFiles = sizeof(DROPFILESTRUCT);
+ pfile = (char *)((BYTE *)pdfs) + sizeof(DROPFILESTRUCT);
+ pdfs->fNC = FALSE;
+ pdfs->fWide = FALSE;
+ pdfs->pt.x = 0;
+ pdfs->pt.y = 0;
+ strcpy(pfile, szFile);
+ // double-NULL terminate it
+ pfile[strlen(pfile)+2] = '\0';
+
+ GlobalUnlock(pmedium->hGlobal);
+
+ sc = S_OK;
+ }
+ else
+ {
+ sc = E_OUTOFMEMORY;
+ }
+ }
+ else
+ {
+ sc = E_OUTOFMEMORY;
+ }
+ }
+
+errRtn:
+
+ return ResultFromScode( sc );
+}
+
+//**********************************************************************
+//
+// CDataXferObj::GetDataHere
+//
+// Purpose:
+//
+// Called to get a data format in a caller supplied location
+//
+// Parameters:
+//
+// LPFORMATETC pformatetc - FORMATETC requested
+//
+// LPSTGMEDIUM pmedium - Medium to return the data
+//
+// Return Value:
+//
+// NOERROR - if OleStdGetOleObjectData success
+// DATA_E_FORMATETC - We don't support the requested format
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleStdGetOleObjectData OLE2UI API
+// IOleObject::QueryInterface Object
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDataXferObj::GetDataHere (
+ LPFORMATETC pformatetc,
+ LPSTGMEDIUM pmedium
+)
+{
+ SCODE sc = DV_E_FORMATETC;
+
+ TestDebugOut("In CDataXferObj::GetDataHere\r\n");
+
+ // NOTE: pmedium is an IN parameter. we should NOT set
+ // pmedium->pUnkForRelease to NULL
+
+ // Check the FORMATETC and fill pmedium if valid.
+ if ( (pformatetc->cfFormat == g_cfEmbeddedObject) &&
+ (pformatetc->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetc->tymed == TYMED_ISTORAGE) )
+ {
+ LPPERSISTSTORAGE pPersistStorage;
+
+ /* render CF_EMBEDDEDOBJECT by asking the object to save
+ ** into the IStorage allocated by the caller.
+ */
+ HRESULT hRes;
+
+ if ((hRes=m_lpOleObject->QueryInterface(
+ IID_IPersistStorage, (LPVOID FAR*)&pPersistStorage))
+ != ResultFromScode(S_OK))
+ {
+ return(hRes);
+ }
+ assert(pPersistStorage);
+ HRESULT hrErr = OleStdGetOleObjectData(
+ pPersistStorage, pformatetc, pmedium,0 /*fUseMemory--N/A*/ );
+ pPersistStorage->Release();
+ sc = GetScode( hrErr );
+ }
+ return ResultFromScode( sc );
+}
diff --git a/private/oleutest/simpdnd/dxferobj.h b/private/oleutest/simpdnd/dxferobj.h
new file mode 100644
index 000000000..5e92f20de
--- /dev/null
+++ b/private/oleutest/simpdnd/dxferobj.h
@@ -0,0 +1,57 @@
+//**********************************************************************
+// File name: dxferobj.h
+//
+// Definition of CDataXferObj
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _DATAXFEROBJ_H_)
+#define _DATAXFEROBJ_H_
+
+class CSimpleSite;
+
+interface CDataObject;
+
+class CDataXferObj : public IDataObject
+{
+private:
+ int m_nCount; // reference count
+ SIZEL m_sizel;
+ POINTL m_pointl;
+ LPSTORAGE m_lpObjStorage;
+ LPOLEOBJECT m_lpOleObject;
+
+ // construction/destruction
+ CDataXferObj();
+ ~CDataXferObj();
+
+public:
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ STDMETHODIMP DAdvise ( FORMATETC FAR* pFormatetc, DWORD advf,
+ LPADVISESINK pAdvSink, DWORD FAR* pdwConnection)
+ { return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); }
+ STDMETHODIMP DUnadvise ( DWORD dwConnection)
+ { return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); }
+ STDMETHODIMP EnumDAdvise ( LPENUMSTATDATA FAR* ppenumAdvise)
+ { return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); }
+ STDMETHODIMP EnumFormatEtc ( DWORD dwDirection,
+ LPENUMFORMATETC FAR* ppenumFormatEtc);
+ STDMETHODIMP GetCanonicalFormatEtc ( LPFORMATETC pformatetc,
+ LPFORMATETC pformatetcOut)
+ { pformatetcOut->ptd = NULL; return ResultFromScode(E_NOTIMPL); }
+ STDMETHODIMP GetData (LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium );
+ STDMETHODIMP GetDataHere (LPFORMATETC pformatetc, LPSTGMEDIUM pmedium);
+ STDMETHODIMP QueryGetData (LPFORMATETC pformatetc );
+ STDMETHODIMP SetData (LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
+ BOOL fRelease)
+ { return ResultFromScode(E_NOTIMPL); }
+
+ static CDataXferObj FAR* Create(CSimpleSite FAR* lpSite,
+ POINTL FAR* pPointl);
+
+};
+#endif // _DATAXFEROBJ_H_
diff --git a/private/oleutest/simpdnd/enumfetc.h b/private/oleutest/simpdnd/enumfetc.h
new file mode 100644
index 000000000..60b82d151
--- /dev/null
+++ b/private/oleutest/simpdnd/enumfetc.h
@@ -0,0 +1,13 @@
+// This file is now OBSOLETE (include olestd.h instead)
+
+/*************************************************************************
+**
+** OLE 2 Utility Code
+**
+** enumfetc.c
+**
+** (c) Copyright Microsoft Corp. 1990 - 1992 All Rights Reserved
+**
+*************************************************************************/
+
+// Function prototypes moved to olestd.h
diff --git a/private/oleutest/simpdnd/filelist.mk b/private/oleutest/simpdnd/filelist.mk
new file mode 100644
index 000000000..748afa91f
--- /dev/null
+++ b/private/oleutest/simpdnd/filelist.mk
@@ -0,0 +1,83 @@
+############################################################################
+#
+# Microsoft Windows
+# Copyright (C) Microsoft Corporation, 1992 - 1992.
+# All rights reserved.
+#
+############################################################################
+
+
+#
+# Name of target. Include an extension (.dll, .lib, .exe)
+# If the target is part of the release, set RELEASE to 1.
+#
+
+TARGET = simpdnd.exe
+RELEASE = 0
+TARGET_DESCRIPTION = "$(PLATFORM) $(BUILDTYPE) Simple DragAndDrop"
+
+
+#
+# Source files. Remember to prefix each name with .\
+#
+
+CFILES =
+CPPFILES = .\app.cpp \
+ .\doc.cpp \
+ .\dxferobj.cpp \
+ .\ias.cpp \
+ .\ids.cpp \
+ .\idt.cpp \
+ .\iocs.cpp \
+ .\pre.cpp \
+ .\simpdnd.cpp \
+ .\site.cpp
+RCFILES = .\simpdnd.rc
+
+#
+# Libraries and other object files to link.
+#
+OBJFILES =
+LIBS = $(CAIROLE)\ilib\$(OBJDIR)\ole232.lib \
+ $(CAIROLE)\ilib\$(OBJDIR)\storag32.lib \
+ $(CAIROLE)\ilib\$(OBJDIR)\compob32.lib \
+ ..\ole2ui\$(OBJDIR)\ole2uixd.lib
+
+!if "$(OPSYS)"=="DOS"
+LIBS = $(LIBS) \
+ $(IMPORT)\CHICAGO\lib\comdlg32.lib \
+ $(IMPORT)\CHICAGO\lib\shell32.lib
+!else
+LIBS = $(LIBS) \
+ $(IMPORT)\$(OPSYS)\lib\$(OBJDIR)\comdlg32.lib \
+ $(IMPORT)\$(OPSYS)\lib\$(OBJDIR)\shell32.lib
+!endif
+
+DEFFILE = .\simpdnd.def
+
+#
+# Precompiled headers.
+#
+
+PXXFILE =
+PFILE =
+CINC = -I..\ole2ui -I..\ole2ui\resource\usa \
+ -I..\ole2ui\resource\static
+!if "$(EXPORT)"=="0"
+CINC = $(CINC) -I$(CAIROLE)\h -I$(CAIROLE)\common
+!else
+CINC = $(CINC) -I$(CAIROLE)\h\export
+!endif
+
+CFLAGS=/D_DEBUG
+
+!if "$(INTERNAL)"=="0"
+CFLAGS = $(CFLAGS) /DNOTREADY
+RCFLAGS = /DNOTREADY
+!endif
+
+# For Chicago Build
+!if "$(OPSYS)"=="DOS"
+CFLAGS=$(CFLAGS) /D_INC_OLE
+!endif
+
diff --git a/private/oleutest/simpdnd/ias.cpp b/private/oleutest/simpdnd/ias.cpp
new file mode 100644
index 000000000..d8ab992b8
--- /dev/null
+++ b/private/oleutest/simpdnd/ias.cpp
@@ -0,0 +1,302 @@
+//**********************************************************************
+// File name: IAS.CPP
+//
+// Implementation file of CAdviseSink
+//
+//
+// Functions:
+//
+// See IAS.H for Class Definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+
+//**********************************************************************
+//
+// CAdviseSink::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation
+//
+// Parameters:
+//
+// REFIID riid - The requested interface
+//
+// LPVOID FAR* ppvObj - Place to return the interface
+//
+// Return Value:
+//
+// HRESULT from CSimpleSite::QueryInterface
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::QueryInterface SITE.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function simply delegates to the Object class, which is
+// aware of the supported interfaces.
+//
+//********************************************************************
+
+STDMETHODIMP CAdviseSink::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In IAS::QueryInterface\r\n");
+
+ // delegate to the document Object
+ return m_pSite->QueryInterface(riid, ppvObj);
+}
+
+//**********************************************************************
+//
+// CAdviseSink::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on the CSimpleSite. Since CAdviseSink
+// is a nested class of CSimpleSite, we don't need a separate reference
+// count for CAdviseSink. We can just use the reference count of
+// CSimpleSite.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count of CSimpleSite
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::AddRef SITE.CPP
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CAdviseSink::AddRef()
+{
+ TestDebugOut("In IAS::AddRef\r\n");
+
+ // delegate to the container Site
+ return m_pSite->AddRef();
+}
+
+//**********************************************************************
+//
+// CAdviseSink::Release
+//
+// Purpose:
+//
+// Decrements the reference count on the CSimpleSite. Since CAdviseSink
+// is a nested class of CSimpleSite, we don't need a separate reference
+// count for CAdviseSink. We can just use the reference count of
+// CSimpleSite.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count of CSimpleSite
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::Release SITE.CPP
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CAdviseSink::Release()
+{
+ TestDebugOut("In IAS::Release\r\n");
+
+ // delegate to the container Site
+ return m_pSite->Release();
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnDataChange
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// FORMATETC pFormatetc - data format infomation
+// STGMEDIUM pStgmed - storage medium on which data is passed
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnDataChange (FORMATETC FAR* pFormatetc,
+ STGMEDIUM FAR* pStgmed)
+{
+ TestDebugOut("In IAS::OnDataChange\r\n");
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnViewChange
+//
+// Purpose:
+//
+// Notifies us that the view has changed and needs to be updated.
+//
+// Parameters:
+//
+// DWORD dwAspect - Aspect that has changed
+//
+// LONG lindex - Index that has changed
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// InvalidateRect Windows API
+// IViewObject2::GetExtent Object
+// IViewObject2::Release Object
+// IOleObject::QueryInterface Object
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnViewChange (DWORD dwAspect, LONG lindex)
+{
+ LPVIEWOBJECT2 lpViewObject2;
+ TestDebugOut("In IAS::OnViewChange\r\n");
+
+ // get a pointer to IViewObject2
+ HRESULT hErr = m_pSite->m_lpOleObject->QueryInterface(
+ IID_IViewObject2,
+ (LPVOID FAR *)&lpViewObject2);
+
+ if (hErr == NOERROR)
+ {
+ // get extent of the object
+ // NOTE: this method will never be remoted; it can be called w/i
+ // this async method
+ lpViewObject2->GetExtent(DVASPECT_CONTENT, -1 , NULL,
+ &m_pSite->m_sizel);
+ lpViewObject2->Release();
+ }
+
+ // need to clean up the region
+ InvalidateRect(m_pSite->m_lpDoc->m_hDocWnd, NULL, TRUE);
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnRename
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// LPMONIKER pmk - pointer to moniker
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnRename (LPMONIKER pmk)
+{
+ TestDebugOut("In IAS::OnRename\r\n");
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnSave
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnSave ()
+{
+ TestDebugOut("In IAS::OnSave\r\n");
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnClose
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnClose()
+{
+ TestDebugOut("In IAS::OnClose\r\n");
+}
diff --git a/private/oleutest/simpdnd/ias.h b/private/oleutest/simpdnd/ias.h
new file mode 100644
index 000000000..aa71ea70d
--- /dev/null
+++ b/private/oleutest/simpdnd/ias.h
@@ -0,0 +1,43 @@
+//**********************************************************************
+// File name: IAS.H
+//
+// Definition of CAdviseSink
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IAS_H_ )
+#define _IAS_H_
+
+#include <assert.h>
+
+class CSimpleSite;
+
+interface CAdviseSink : public IAdviseSink
+{
+ CSimpleSite FAR * m_pSite;
+
+ CAdviseSink(CSimpleSite FAR * pSite)
+ {
+ TestDebugOut("In IAS's constructor\r\n");
+ m_pSite = pSite;
+ };
+
+ ~CAdviseSink()
+ {
+ TestDebugOut("In IAS's destructor\r\n");
+ };
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppv);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ // *** IAdviseSink methods ***
+ STDMETHODIMP_(void) OnDataChange (FORMATETC FAR* pFormatetc, STGMEDIUM FAR* pStgmed);
+ STDMETHODIMP_(void) OnViewChange (DWORD dwAspect, LONG lindex);
+ STDMETHODIMP_(void) OnRename (LPMONIKER pmk);
+ STDMETHODIMP_(void) OnSave ();
+ STDMETHODIMP_(void) OnClose ();
+};
+
+
+#endif
diff --git a/private/oleutest/simpdnd/ids.cpp b/private/oleutest/simpdnd/ids.cpp
new file mode 100644
index 000000000..5c7bdf8ad
--- /dev/null
+++ b/private/oleutest/simpdnd/ids.cpp
@@ -0,0 +1,384 @@
+//**********************************************************************
+// File name: IDS.CPP
+//
+// Implementation file for CDropSource
+//
+// Functions:
+//
+// See IDS.H for class definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "app.h"
+#include "doc.h"
+#include "site.h"
+#include "dxferobj.h"
+
+
+
+
+//+-------------------------------------------------------------------------
+//
+// Member: CSimpleDoc::FailureNotifyHelper(
+//
+// Synopsis: Report a drag drop error
+//
+// Arguments: [pszMsg] - Message
+// [dwData] - Data to print out
+//
+// Algorithm: Print a message box for fatal errors during drag drop
+// operation.
+//
+// History: dd-mmm-yy Author Comment
+// 06-May-94 Ricksa author
+//
+//--------------------------------------------------------------------------
+void CSimpleDoc::FailureNotifyHelper(TCHAR *pszMsg, DWORD dwData)
+{
+ TCHAR pszBuf[256];
+
+ wsprintf(pszBuf, TEXT("%s %lx"), pszMsg, dwData);
+
+ MessageBox(m_hDocWnd, pszBuf, TEXT("Drag/Drop Error"), MB_OK);
+}
+
+
+
+//**********************************************************************
+//
+// CSimpleDoc::QueryDrag
+//
+// Purpose:
+//
+// Check to see if Drag operation should be initiated based on the
+// current position of the mouse.
+//
+// Parameters:
+//
+// POINT pt - position of mouse
+//
+// Return Value:
+//
+// BOOL - TRUE if drag should take place,
+// else FALSE
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::GetObjRect SITE.CPP
+// PtInRect Windows API
+//
+//
+//********************************************************************
+
+BOOL CSimpleDoc::QueryDrag(POINT pt)
+{
+ // if pt is within rect of object, then start drag
+ if (m_lpSite)
+ {
+ RECT rect;
+ m_lpSite->GetObjRect(&rect);
+ return ( PtInRect(&rect, pt) ? TRUE : FALSE );
+ }
+ else
+ return FALSE;
+}
+
+
+//**********************************************************************
+//
+// CSimpleDoc::DoDragDrop
+//
+// Purpose:
+//
+// Actually perform a drag/drop operation with the current
+// selection in the source document.
+//
+// Parameters:
+//
+// none.
+//
+// Return Value:
+//
+// DWORD - returns the result effect of the
+// drag/drop operation:
+// DROPEFFECT_NONE,
+// DROPEFFECT_COPY,
+// DROPEFFECT_MOVE, or
+// DROPEFFECT_LINK
+//
+// Function Calls:
+// Function Location
+//
+// CDataXferObj::Create DXFEROBJ.CPP
+// CDataXferObj::QueryInterface DXFEROBJ.CPP
+// CDataXferObj::Release DXFEROBJ.CPP
+// DoDragDrop OLE API
+// TestDebugOut Windows API
+// MessageBox Windows API
+//
+//
+//********************************************************************
+
+DWORD CSimpleDoc::DoDragDrop (void)
+{
+ DWORD dwEffect = 0;
+ LPDATAOBJECT lpDataObj;
+
+ TestDebugOut("In CSimpleDoc::DoDragDrop\r\n");
+
+ // Create a data transfer object by cloning the existing OLE object
+ CDataXferObj FAR* pDataXferObj = CDataXferObj::Create(m_lpSite,NULL);
+
+ if (! pDataXferObj)
+ {
+ MessageBox(NULL, TEXT("Out-of-memory"), TEXT("SimpDnD"),
+ MB_SYSTEMMODAL | MB_ICONHAND);
+ return DROPEFFECT_NONE;
+ }
+
+ // initially obj is created with 0 refcnt. this QI will make it go to 1.
+ pDataXferObj->QueryInterface(IID_IDataObject, (LPVOID FAR*)&lpDataObj);
+ assert(lpDataObj);
+
+ m_fLocalDrop = FALSE;
+ m_fLocalDrag = TRUE;
+
+ HRESULT hRes;
+ hRes=::DoDragDrop(lpDataObj,
+ &m_DropSource,
+ m_lpApp->m_dwSourceEffect, // we only allow copy
+ &dwEffect);
+
+ if (hRes!=ResultFromScode(S_OK)
+ && hRes!=ResultFromScode(DRAGDROP_S_DROP)
+ && hRes!=ResultFromScode(DRAGDROP_S_CANCEL))
+ {
+ FailureNotifyHelper(
+ TEXT("Unexpected error from DoDragDrop"), hRes);
+ }
+
+ // Validate the responses
+ if (hRes == ResultFromScode(DRAGDROP_S_DROP))
+ {
+ // Drop was successful so make sure the effects make sense
+ if (((dwEffect & m_lpApp->m_dwSourceEffect) == 0)
+ && (dwEffect != DROPEFFECT_NONE))
+ {
+ FailureNotifyHelper(
+ TEXT("Unexpected Effect on DRAGDROP_S_DROP from DoDragDrop"),
+ dwEffect);
+ }
+ }
+ else if ((hRes == ResultFromScode(DRAGDROP_S_CANCEL))
+ || (hRes == ResultFromScode(S_OK)))
+ {
+ // Drop was cancelled/or never happened so the effect s/b none
+ if (dwEffect != DROPEFFECT_NONE)
+ {
+ FailureNotifyHelper(
+ TEXT("Unexpected Effect on S_OK or Cancel from DoDragDrop"),
+ dwEffect);
+ }
+ }
+
+ m_fLocalDrag = FALSE;
+
+ /* if after the Drag/Drop modal (mouse capture) loop is finished
+ ** and a drag MOVE operation was performed, then we must delete
+ ** the selection that was dragged.
+ */
+ if ( (dwEffect & DROPEFFECT_MOVE) != 0 )
+ {
+ // Dump our object - we never save it.
+ m_lpApp->lCreateDoc(m_lpApp->m_hAppWnd, 0, 0, 0);
+ }
+
+ pDataXferObj->Release(); // this should destroy the DataXferObj
+ return dwEffect;
+}
+
+
+
+//**********************************************************************
+//
+// CDropSource::QueryInterface
+//
+// Purpose:
+//
+// Return a pointer to a requested interface
+//
+// Parameters:
+//
+// REFIID riid - ID of interface to be returned
+// LPVOID FAR* ppvObj - Location to return the interface
+//
+// Return Value:
+//
+// S_OK - Interface supported
+// E_NOINTERFACE - Interface NOT supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleDoc::QueryInterface DOC.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDropSource::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In IDS::QueryInterface\r\n");
+
+ // delegate to the document
+ return m_pDoc->QueryInterface(riid, ppvObj);
+}
+
+
+//**********************************************************************
+//
+// CDropSource::AddRef
+//
+// Purpose:
+//
+// Increments the reference count of CSimpleDoc. Since CDropSource is
+// a nested class of CSimpleDoc, we don't need a separate reference
+// count for the CDropSource. We can safely use the reference count
+// of CSimpleDoc here.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count of CSimpleDoc
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::AddRef DOC.CPP
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropSource::AddRef()
+{
+ TestDebugOut("In IDS::AddRef\r\n");
+
+ // delegate to the document Object
+ return m_pDoc->AddRef();
+}
+
+//**********************************************************************
+//
+// CDropSource::Release
+//
+// Purpose:
+//
+// Decrements the reference count of CSimpleDoc. Since CDropSource is
+// a nested class of CSimpleDoc, we don't need a separate reference
+// count for the CDropSource. We can safely use the reference count
+// of CSimpleDoc here.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count of CSimpleDoc
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::Release DOC.CPP
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropSource::Release()
+{
+ TestDebugOut("In IDS::Release\r\n");
+
+ // delegate to the document object
+ return m_pDoc->Release();
+}
+
+//**********************************************************************
+//
+// CDropSource::QueryContinueDrag
+//
+// Purpose:
+//
+// Called to determine if a drop should take place or be canceled.
+//
+// Parameters:
+//
+// BOOL fEscapePressed - TRUE if ESCAPE key has been pressed
+// DWORD grfKeyState - key state
+//
+// Return Value:
+//
+// DRAGDROP_S_CANCEL - drag operation should be canceled
+// DRAGDROP_S_DROP - drop operation should be performed
+// S_OK - dragging should continue
+//
+//
+// Function Calls:
+// Function Location
+//
+// ResultFromScode OLE API
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDropSource::QueryContinueDrag (
+ BOOL fEscapePressed,
+ DWORD grfKeyState
+)
+{
+ if (fEscapePressed)
+ return ResultFromScode(DRAGDROP_S_CANCEL);
+ else
+ if (!(grfKeyState & MK_LBUTTON))
+ return ResultFromScode(DRAGDROP_S_DROP);
+ else
+ return NOERROR;
+}
+
+
+//**********************************************************************
+//
+// CDropSource::GiveFeedback
+//
+// Purpose:
+//
+// Called to set cursor feedback
+//
+// Parameters:
+//
+// DWORD dwEffect - drop operation to give feedback for
+//
+// Return Value:
+//
+// DRAGDROP_S_USEDEFAULTCURSORS - tells OLE to use standard cursors
+//
+// Function Calls:
+// Function Location
+//
+// ResultFromScode OLE API
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDropSource::GiveFeedback (DWORD dwEffect)
+{
+ return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS);
+}
+
diff --git a/private/oleutest/simpdnd/ids.h b/private/oleutest/simpdnd/ids.h
new file mode 100644
index 000000000..470d05ee2
--- /dev/null
+++ b/private/oleutest/simpdnd/ids.h
@@ -0,0 +1,43 @@
+//**********************************************************************
+// File name: ids.h
+//
+// Definition of CDropSource
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IDS_H_ )
+#define _IDS_H_
+
+#include <assert.h>
+
+class CSimpleDoc;
+
+interface CDropSource : public IDropSource
+{
+ CSimpleDoc FAR * m_pDoc;
+
+ CDropSource(CSimpleDoc FAR * pDoc)
+ {
+ TestDebugOut("In IDS's constructor\r\n");
+ m_pDoc = pDoc;
+ };
+
+ ~CDropSource()
+ {
+ TestDebugOut("In IDS's destructor\r\n");
+ };
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppv);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ // *** IDropSource methods ***
+ STDMETHODIMP QueryContinueDrag (BOOL fEscapePressed, DWORD grfKeyState);
+ STDMETHODIMP GiveFeedback (DWORD dwEffect);
+
+private:
+
+};
+
+
+#endif
diff --git a/private/oleutest/simpdnd/idt.cpp b/private/oleutest/simpdnd/idt.cpp
new file mode 100644
index 000000000..db83df09a
--- /dev/null
+++ b/private/oleutest/simpdnd/idt.cpp
@@ -0,0 +1,851 @@
+//**********************************************************************
+// File name: IDT.CPP
+//
+// Implementation file for CDropTarget
+//
+// Functions:
+//
+// See IDT.H for class definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+#include "idt.h"
+
+extern CLIPFORMAT g_cfObjectDescriptor;
+
+
+//**********************************************************************
+//
+// CDropTarget::QueryDrop
+//
+// Purpose:
+//
+// Check if the desired drop operation (identified by the given key
+// state) is possible at the current mouse position (pointl).
+//
+// Parameters:
+//
+// DWORD grfKeyState - current key state
+// POINTL pointl - position of mouse
+// BOOL fDragScroll - TRUE if drag scrolling cursor should
+// be shown.
+// LPDWORD pdwEffect - (OUT) drag effect that should occur
+//
+// Return Value:
+//
+// BOOL - TRUE if drop could take place,
+// else FALSE
+//
+// Function Calls:
+// Function Location
+//
+// OleStdGetDropEffect OLE2UI API
+//
+//
+//********************************************************************
+
+BOOL CDropTarget::QueryDrop (
+ DWORD grfKeyState,
+ POINTL pointl,
+ BOOL fDragScroll,
+ LPDWORD pdwEffect
+)
+{
+ DWORD dwScrollEffect = 0L;
+ DWORD dwOKEffects = m_pDoc->m_lpApp->m_dwTargetEffect & *pdwEffect;
+
+ /* check if the cursor is in the active scroll area, if so need the
+ ** special scroll cursor.
+ */
+ if (fDragScroll)
+ dwScrollEffect = DROPEFFECT_SCROLL;
+
+ /* if we have already determined that the source does NOT have any
+ ** acceptable data for us, the return NO-DROP
+ */
+ if (! m_fCanDropCopy && ! m_fCanDropLink)
+ goto dropeffect_none;
+
+ /* OLE2NOTE: determine what type of drop should be performed given
+ ** the current modifier key state. we rely on the standard
+ ** interpretation of the modifier keys:
+ ** no modifier -- DROPEFFECT_MOVE or whatever is allowed by src
+ ** SHIFT -- DROPEFFECT_MOVE
+ ** CTRL -- DROPEFFECT_COPY
+ ** CTRL-SHIFT -- DROPEFFECT_LINK
+ */
+
+ *pdwEffect = OleStdGetDropEffect(grfKeyState);
+ if (*pdwEffect == 0)
+ {
+ // No modifier keys given. Try in order MOVE, COPY, LINK.
+ if ((DROPEFFECT_MOVE & dwOKEffects) && m_fCanDropCopy)
+ *pdwEffect = DROPEFFECT_MOVE;
+ else if ((DROPEFFECT_COPY & dwOKEffects) && m_fCanDropCopy)
+ *pdwEffect = DROPEFFECT_COPY;
+ else if ((DROPEFFECT_LINK & dwOKEffects) && m_fCanDropLink)
+ *pdwEffect = DROPEFFECT_LINK;
+ else
+ goto dropeffect_none;
+ }
+ else
+ {
+ /* OLE2NOTE: we should check if the drag source application allows
+ ** the desired drop effect.
+ */
+ if (!(*pdwEffect & dwOKEffects))
+ goto dropeffect_none;
+
+ if ((*pdwEffect == DROPEFFECT_COPY || *pdwEffect == DROPEFFECT_MOVE)
+ && ! m_fCanDropCopy)
+ goto dropeffect_none;
+
+ if (*pdwEffect == DROPEFFECT_LINK && ! m_fCanDropLink)
+ goto dropeffect_none;
+ }
+
+ *pdwEffect |= dwScrollEffect;
+ return TRUE;
+
+dropeffect_none:
+
+ *pdwEffect = DROPEFFECT_NONE;
+ return FALSE;
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::QueryDrop
+//
+// Purpose:
+//
+// Check to see if Drag scroll operation should be initiated.
+//
+// Parameters:
+//
+// POINTL pointl - position of mouse
+//
+// Return Value:
+//
+// BOOL - TRUE if scroll cursor should be given
+// else FALSE
+//
+// Function Calls:
+// Function Location
+//
+// ScreenToClient WINDOWS API
+// GetClientRect WINDOWS API
+//
+// Comments:
+// A Drag scroll operation should be initiated when the mouse has
+// remained in the active scroll area (11 pixels frame around border
+// of window) for a specified amount of time (50ms).
+//
+//********************************************************************
+
+BOOL CDropTarget::DoDragScroll (POINTL pointl)
+{
+ DWORD dwScrollDir = SCROLLDIR_NULL;
+ DWORD dwTime = GetCurrentTime();
+ int nScrollInset = m_pDoc->m_lpApp->m_nScrollInset;
+ int nScrollDelay = m_pDoc->m_lpApp->m_nScrollDelay;
+ int nScrollInterval = m_pDoc->m_lpApp->m_nScrollInterval;
+ POINT point;
+ RECT rect;
+
+ point.x = (int)pointl.x;
+ point.y = (int)pointl.y;
+
+ ScreenToClient( m_pDoc->m_hDocWnd, &point);
+ GetClientRect ( m_pDoc->m_hDocWnd, (LPRECT) &rect );
+
+ if (rect.top <= point.y && point.y<=(rect.top+nScrollInset))
+ dwScrollDir = SCROLLDIR_UP;
+ else if ((rect.bottom-nScrollInset) <= point.y && point.y <= rect.bottom)
+ dwScrollDir = SCROLLDIR_DOWN;
+ else if (rect.left <= point.x && point.x <= (rect.left+nScrollInset))
+ dwScrollDir = SCROLLDIR_LEFT;
+ else if ((rect.right-nScrollInset) <= point.x && point.x <= rect.right)
+ dwScrollDir = SCROLLDIR_RIGHT;
+
+ if (m_dwTimeEnterScrollArea)
+ {
+ /* cursor was already in Scroll Area */
+
+ if (! dwScrollDir)
+ {
+ /* cusor moved OUT of scroll area.
+ ** clear "EnterScrollArea" time.
+ */
+ m_dwTimeEnterScrollArea = 0L;
+ m_dwNextScrollTime = 0L;
+ m_dwLastScrollDir = SCROLLDIR_NULL;
+
+ }
+ else
+ if (dwScrollDir != m_dwLastScrollDir)
+ {
+ /* cusor moved into a different direction scroll area.
+ ** reset "EnterScrollArea" time to start a new 50ms delay.
+ */
+ m_dwTimeEnterScrollArea = dwTime;
+ m_dwNextScrollTime = dwTime + (DWORD)nScrollDelay;
+ m_dwLastScrollDir = dwScrollDir;
+
+ }
+ else
+ if (dwTime && dwTime >= m_dwNextScrollTime)
+ {
+ m_pDoc->Scroll ( dwScrollDir ); // Scroll document now
+ m_dwNextScrollTime = dwTime + (DWORD)nScrollInterval;
+ }
+ }
+ else
+ {
+ if (dwScrollDir)
+ {
+ /* cusor moved INTO a scroll area.
+ ** reset "EnterScrollArea" time to start a new 50ms delay.
+ */
+ m_dwTimeEnterScrollArea = dwTime;
+ m_dwNextScrollTime = dwTime + (DWORD)nScrollDelay;
+ m_dwLastScrollDir = dwScrollDir;
+ }
+ }
+
+ return (dwScrollDir ? TRUE : FALSE);
+}
+
+
+// Support functions/macros
+#define SetTopLeft(rc, pt) \
+ ((rc)->top = (pt)->y,(rc)->left = (pt)->x)
+#define SetBottomRight(rc, pt) \
+ ((rc)->bottom = (pt)->y,(rc)->right = (pt)->x)
+#define OffsetPoint(pt, dx, dy) \
+ ((pt)->x += dx, (pt)->y += dy)
+
+
+/* HighlightRect
+** -------------
+** Invert rectangle on screen. used for drop target feedback.
+*/
+
+static int HighlightRect(HWND hwnd, HDC hdc, LPRECT rc)
+{
+ POINT pt1, pt2;
+ int old = SetROP2(hdc, R2_NOT);
+ HPEN hpen;
+ HGDIOBJ hold;
+
+ pt1.x = rc->left;
+ pt1.y = rc->top;
+ pt2.x = rc->right;
+ pt2.y = rc->bottom;
+
+ ScreenToClient(hwnd, &pt1);
+ ScreenToClient(hwnd, &pt2);
+
+ hold = SelectObject(hdc, GetStockObject(HOLLOW_BRUSH));
+ hpen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 2,
+ GetSysColor(COLOR_ACTIVEBORDER)));
+
+ Rectangle(hdc, pt1.x, pt1.y, pt2.x, pt2.y);
+
+ SetROP2(hdc, old);
+
+ hold = SelectObject(hdc, hold);
+ hpen = (HPEN) SelectObject(hdc, hpen);
+
+ DeleteObject(hpen);
+
+ return 0;
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::InitDragFeedback
+//
+// Purpose:
+//
+// Initialize data used to draw drop target feedback.
+// As feedback we draw a rectangle the size of the object.
+//
+// Parameters:
+//
+// LPDATAOBJECT pDataObj - IDataObject from Drop source
+// POINTL pointl - position of mouse
+//
+// Return Value:
+//
+// none.
+//
+// Function Calls:
+// Function Location
+//
+// IDataObject::GetData Object
+// XformSizeInHimetricToPixels OLE2UI Library
+// GlobalLock WINDOWS API
+// GlobalUnlock WINDOWS API
+// ReleaseStgMedium OLE2 API
+// OffsetPoint IDT.CPP
+// SetTopLeft IDT.CPP
+// SetBottomRight IDT.CPP
+//
+// Comments:
+// In order to know the size of the object before the object
+// is actually dropped, we render CF_OBJECTDESCRIPTOR format.
+// this data format tells us both the size of the object as
+// well as which aspect is the object is displayed as in the
+// source. If the object is currently displayed as DVASPECT_ICON
+// then we want to create the object also as DVASPECT_ICON.
+//
+//********************************************************************
+
+void CDropTarget::InitDragFeedback(LPDATAOBJECT pDataObj, POINTL pointl)
+{
+ FORMATETC fmtetc;
+ STGMEDIUM stgmed;
+ POINT pt;
+ int height, width;
+ HRESULT hrErr;
+
+ height = width = 100; // some default values
+ pt.x = (int)pointl.x;
+ pt.y = (int)pointl.y;
+
+ // do a GetData for CF_OBJECTDESCRIPTOR format to get the size of the
+ // object as displayed in the source. using this size, initialize the
+ // size for the drag feedback rectangle.
+ fmtetc.cfFormat = g_cfObjectDescriptor;
+ fmtetc.ptd = NULL;
+ fmtetc.lindex = -1;
+ fmtetc.dwAspect = DVASPECT_CONTENT;
+ fmtetc.tymed = TYMED_HGLOBAL;
+
+ hrErr = pDataObj->GetData(&fmtetc, &stgmed);
+ if (hrErr == NOERROR)
+ {
+ LPOBJECTDESCRIPTOR pOD=(LPOBJECTDESCRIPTOR)GlobalLock(stgmed.hGlobal);
+ if (pOD != NULL)
+ {
+ XformSizeInHimetricToPixels(NULL, &pOD->sizel, &pOD->sizel);
+
+ width = (int)pOD->sizel.cx;
+ height = (int)pOD->sizel.cy;
+ m_dwSrcAspect = pOD->dwDrawAspect;
+ }
+
+ GlobalUnlock(stgmed.hGlobal);
+ ReleaseStgMedium(&stgmed);
+ }
+
+ m_ptLast = pt;
+ m_fDragFeedbackDrawn = FALSE;
+
+ OffsetPoint(&pt, -(width/2), -(height/2));
+ SetTopLeft(&m_rcDragRect, &pt);
+
+ OffsetPoint(&pt, width, height);
+ SetBottomRight(&m_rcDragRect, &pt);
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::UndrawDragFeedback
+//
+// Purpose:
+//
+// Erase any drop target feedback.
+// As feedback we draw a rectangle the size of the object.
+//
+// Parameters:
+//
+// none.
+//
+// Return Value:
+//
+// none.
+//
+// Function Calls:
+// Function Location
+//
+// GetDC WINDOWS API
+// ReleaseDC WINDOWS API
+// HighlightRect IDT.CPP
+//
+// Comments:
+// In order to know the size of the object before the object
+// is actually dropped, we render CF_OBJECTDESCRIPTOR format.
+// this data format tells us both the size of the object as
+// well as which aspect is the object is displayed as in the
+// source. if the object is currently displayed as DVASPECT_ICON
+// then we want to create the object also as DVASPECT_ICON.
+//
+//********************************************************************
+
+void CDropTarget::UndrawDragFeedback( void )
+{
+ if (m_fDragFeedbackDrawn)
+ {
+ m_fDragFeedbackDrawn = FALSE;
+ HDC hDC = GetDC(m_pDoc->m_hDocWnd);
+ HighlightRect(m_pDoc->m_hDocWnd, hDC, &m_rcDragRect);
+ ReleaseDC(m_pDoc->m_hDocWnd, hDC);
+ }
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::DrawDragFeedback
+//
+// Purpose:
+//
+// Compute new position of drop target feedback rectangle and
+// erase old rectangle and draw new rectangle.
+// As feedback we draw a rectangle the size of the object.
+//
+// Parameters:
+//
+// POINTL pointl - position of mouse
+//
+// Return Value:
+//
+// none.
+//
+// Function Calls:
+// Function Location
+//
+// OffsetPoint IDT.CPP
+// OffsetRect IDT.CPP
+// HighlightRect IDT.CPP
+// GetDC WINDOWS API
+// ReleaseDC WINDOWS API
+//
+//
+//********************************************************************
+
+void CDropTarget::DrawDragFeedback( POINTL pointl )
+{
+ POINT ptDiff;
+
+ ptDiff.x = (int)pointl.x - m_ptLast.x;
+ ptDiff.y = (int)pointl.y - m_ptLast.y;
+
+ if (m_fDragFeedbackDrawn && (ptDiff.x == 0 && ptDiff.y == 0))
+ return; // mouse did not move; leave rectangle as drawn
+
+ HDC hDC = GetDC(m_pDoc->m_hDocWnd);
+ if (m_fDragFeedbackDrawn)
+ {
+ m_fDragFeedbackDrawn = FALSE;
+ HighlightRect(m_pDoc->m_hDocWnd, hDC, &m_rcDragRect);
+ }
+
+ OffsetRect(&m_rcDragRect, ptDiff.x, ptDiff.y);
+ HighlightRect(m_pDoc->m_hDocWnd, hDC, &m_rcDragRect);
+ m_fDragFeedbackDrawn = TRUE;
+ m_ptLast.x = (int)pointl.x;
+ m_ptLast.y = (int)pointl.y;
+ ReleaseDC(m_pDoc->m_hDocWnd, hDC);
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation
+//
+// Parameters:
+//
+// REFIID riid - ID of interface to be returned
+// LPVOID FAR* ppvObj - Location to return the interface
+//
+// Return Value:
+//
+// S_OK - Interface supported
+// E_NOINTERFACE - Interface NOT supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleDoc::QueryInterface DOC.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDropTarget::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In IDT::QueryInterface\r\n");
+
+ // delegate to the document
+ return m_pDoc->QueryInterface(riid, ppvObj);
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::AddRef
+//
+// Purpose:
+//
+// Increments the reference count of CSimpleDoc. Since CDropTarget is
+// a nested class of CSimpleDoc, we don't need a separate reference
+// count for CDropTarget. We can safely use the reference count of
+// CSimpleDoc.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count of CSimpleDoc
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::AddReff DOC.CPP
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropTarget::AddRef()
+{
+ TestDebugOut("In IDT::AddRef\r\n");
+
+ // delegate to the document Object
+ return m_pDoc->AddRef();
+}
+
+//**********************************************************************
+//
+// CDropTarget::Release
+//
+// Purpose:
+//
+// Decrements the reference count of CSimpleDoc. Since CDropTarget is
+// a nested class of CSimpleDoc, we don't need a separate reference
+// count for CDropTarget. We can safely use the reference count of
+// CSimpleDoc.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count of CSimpleDoc
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::Release DOC.CPP
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropTarget::Release()
+{
+ TestDebugOut("In IDT::Release\r\n");
+
+ // delegate to the document object
+ return m_pDoc->Release();
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::DragEnter
+//
+// Purpose:
+//
+// Called when the mouse first enters our DropTarget window
+//
+// Parameters:
+//
+// LPDATAOBJECT pDataObj - IDataObject from Drop source
+// DWORD grfKeyState - current key state
+// POINTL pointl - position of mouse
+// LPDWORD pdwEffect - (IN-OUT) drag effect that should occur
+// ON INPUT, this is dwOKEffects that source
+// passed to DoDragDrop API.
+// ON OUTPUT, this is the effect that we
+// want to take effect (used to determine
+// cursor feedback).
+//
+// Return Value:
+//
+// NOERROR
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleQueryCreateFromData OLE2 API
+// DoDragScroll IDT.CPP
+// QueryDrop IDT.CPP
+// InitDragFeedback IDT.CPP
+// DrawDragFeedback IDT.CPP
+//
+// Comments:
+// Callee should honor the dwEffects as passed in to determine
+// if the caller allows DROPEFFECT_MOVE.
+//
+//********************************************************************
+
+STDMETHODIMP CDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState,
+ POINTL pointl, LPDWORD pdwEffect)
+{
+ TestDebugOut("In IDT::DragEnter\r\n");
+
+ /* Determine if the drag source data object offers a data format
+ ** that we understand. we accept only creating embedded objects.
+ */
+ m_fCanDropCopy = ((OleQueryCreateFromData(pDataObj) == NOERROR) ?
+ TRUE : FALSE);
+ m_fCanDropLink = FALSE; // linking NOT supported in this simple sample
+
+ if (m_fCanDropCopy || m_fCanDropLink)
+ InitDragFeedback(pDataObj, pointl);
+
+ BOOL fDragScroll = DoDragScroll ( pointl );
+
+ if (QueryDrop(grfKeyState,pointl,fDragScroll,pdwEffect))
+ {
+ DrawDragFeedback( pointl );
+ }
+
+ // with our drag drop optimization, pDataObj will actually be a
+ // wrapper data object. QueryGetData calls (currently) will be
+ // propogated to the drag source (whereas EnumFormatetc is handled
+ // locally). Make sure we can do a QueryGetData.
+
+ FORMATETC formatetc;
+ formatetc.cfFormat = CF_METAFILEPICT;
+ formatetc.tymed = TYMED_MFPICT;
+ formatetc.ptd = NULL;
+ formatetc.lindex = -1;
+ formatetc.dwAspect = DVASPECT_CONTENT;
+
+ // E_FAIL is usually returned if we could not get the drag source
+ // data object.
+ if( pDataObj->QueryGetData(&formatetc) == E_FAIL )
+ {
+ TestDebugOut("WARNING! QueryGetData failed!");
+ }
+
+ return NOERROR;
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::DragOver
+//
+// Purpose:
+//
+// Called when the mouse moves, key state changes, or a time
+// interval passes while the mouse is still within our DropTarget
+// window.
+//
+// Parameters:
+//
+// DWORD grfKeyState - current key state
+// POINTL pointl - position of mouse
+// LPDWORD pdwEffect - (IN-OUT) drag effect that should occur
+// ON INPUT, this is dwOKEffects that source
+// passed to DoDragDrop API.
+// ON OUTPUT, this is the effect that we
+// want to take effect (used to determine
+// cursor feedback).
+//
+// Return Value:
+//
+// NOERROR
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// DoDragScroll IDT.CPP
+// QueryDrop IDT.CPP
+// DrawDragFeedback IDT.CPP
+// UndrawDragFeedback IDT.CPP
+//
+// Comments:
+// Callee should honor the dwEffects as passed in to determine
+// if the caller allows DROPEFFECT_MOVE. OLE pulses the DragOver
+// calls in order that the DropTarget can implement drag scrolling
+//
+//********************************************************************
+
+STDMETHODIMP CDropTarget::DragOver (DWORD grfKeyState, POINTL pointl,
+ LPDWORD pdwEffect)
+{
+ TestDebugOut("In IDT::DragOver\r\n");
+
+ BOOL fDragScroll = DoDragScroll ( pointl );
+
+ if (QueryDrop(grfKeyState,pointl,fDragScroll,pdwEffect))
+ {
+ DrawDragFeedback( pointl );
+ }
+ else
+ {
+ UndrawDragFeedback();
+ }
+
+ return NOERROR;
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::DragLeave
+//
+// Purpose:
+//
+// Called when the mouse leaves our DropTarget window
+//
+// Parameters:
+//
+// none.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// UndrawDragFeedback IDT.CPP
+// ResultFromScode OLE2 API
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDropTarget::DragLeave ()
+{
+ TestDebugOut("In IDT::DragLeave\r\n");
+
+ UndrawDragFeedback();
+
+ return ResultFromScode(S_OK);
+}
+
+
+//**********************************************************************
+//
+// CDropTarget::Drop
+//
+// Purpose:
+//
+// Called when a Drop operation should take place.
+//
+// Parameters:
+//
+// LPDATAOBJECT pDataObj - IDataObject from Drop source
+// DWORD grfKeyState - current key state
+// POINTL pointl - position of mouse
+// LPDWORD pdwEffect - (IN-OUT) drag effect that should occur
+// ON INPUT, this is dwOKEffects that source
+// passed to DoDragDrop API.
+// ON OUTPUT, this is the effect that we
+// want to take effect (used to determine
+// cursor feedback).
+//
+// Return Value:
+//
+// S_OK if sucess or HRESULT of the error code if fails
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleSite::Create SITE.CPP
+// CSimpleSite::InitObject SITE.CPP
+// OleCreateFromData OLE2 API
+// DoDragScroll IDT.CPP
+// QueryDrop IDT.CPP
+// InitDragFeedback IDT.CPP
+// DrawDragFeedback IDT.CPP
+// UndrawDragFeedback IDT.CPP
+// GetScode OLE2 API
+// ResultFromScode OLE2 API
+//
+// Comments:
+// Callee should honor the dwEffects as passed in to determine
+// if the caller allows DROPEFFECT_MOVE.
+//
+//********************************************************************
+
+STDMETHODIMP CDropTarget::Drop (LPDATAOBJECT pDataObj, DWORD grfKeyState,
+ POINTL pointl, LPDWORD pdwEffect)
+{
+ FORMATETC fmtetc;
+ SCODE sc = S_OK;
+
+ TestDebugOut("In IDT::Drop\r\n");
+
+ UndrawDragFeedback();
+
+ if (pDataObj && QueryDrop(grfKeyState,pointl,FALSE,pdwEffect))
+ {
+ m_pDoc->m_lpSite = CSimpleSite::Create(m_pDoc);
+ if (!m_pDoc->m_lpSite)
+ {
+ /* memory allocation problem. cannot continue.
+ */
+ return(ResultFromScode(E_OUTOFMEMORY));
+ }
+
+ // keep same aspect as drop source
+ m_pDoc->m_lpSite->m_dwDrawAspect = m_dwSrcAspect;
+
+ // in order to specify a particular drawing Aspect we must
+ // pass a FORMATETC* to OleCreateFromData
+ fmtetc.cfFormat = NULL; // use whatever for drawing
+ fmtetc.ptd = NULL;
+ fmtetc.lindex = -1;
+ fmtetc.dwAspect = m_dwSrcAspect; // desired drawing aspect
+ fmtetc.tymed = TYMED_NULL;
+
+ HRESULT hrErr = OleCreateFromData (
+ pDataObj,
+ IID_IOleObject,
+ OLERENDER_DRAW,
+ &fmtetc,
+ &m_pDoc->m_lpSite->m_OleClientSite,
+ m_pDoc->m_lpSite->m_lpObjStorage,
+ (LPVOID FAR *)&m_pDoc->m_lpSite->m_lpOleObject);
+
+ if (hrErr == NOERROR)
+ {
+ m_pDoc->m_lpSite->InitObject(FALSE /* fCreateNew */);
+ m_pDoc->DisableInsertObject();
+ }
+ else
+ sc = GetScode(hrErr);
+ }
+
+ return ResultFromScode(sc);
+}
diff --git a/private/oleutest/simpdnd/idt.h b/private/oleutest/simpdnd/idt.h
new file mode 100644
index 000000000..16b82071d
--- /dev/null
+++ b/private/oleutest/simpdnd/idt.h
@@ -0,0 +1,76 @@
+//**********************************************************************
+// File name: idt.h
+//
+// Definition of CDropTarget
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IDT_H_ )
+#define _IDT_H_
+
+#include <assert.h>
+
+class CSimpleDoc;
+
+/* Flags to control direction for drag scrolling */
+typedef enum tagSCROLLDIR {
+ SCROLLDIR_NULL = 0,
+ SCROLLDIR_UP = 1,
+ SCROLLDIR_DOWN = 2,
+ SCROLLDIR_RIGHT = 3,
+ SCROLLDIR_LEFT = 4
+} SCROLLDIR;
+
+interface CDropTarget : public IDropTarget
+{
+ CSimpleDoc FAR * m_pDoc;
+ BOOL m_fCanDropCopy;
+ BOOL m_fCanDropLink;
+ DWORD m_dwSrcAspect;
+ RECT m_rcDragRect;
+ POINT m_ptLast;
+ BOOL m_fDragFeedbackDrawn;
+ DWORD m_dwTimeEnterScrollArea; // time of entering scroll border region
+ DWORD m_dwLastScrollDir; // current dir for drag scroll
+ DWORD m_dwNextScrollTime; // time for next scroll
+
+ CDropTarget(CSimpleDoc FAR * pDoc)
+ {
+ TestDebugOut("In IDT's constructor\r\n");
+ m_pDoc = pDoc;
+ m_fCanDropCopy = FALSE;
+ m_fCanDropLink = FALSE;
+ m_fDragFeedbackDrawn = FALSE;
+ m_dwTimeEnterScrollArea = 0L;
+ m_dwNextScrollTime = 0L;
+ m_dwLastScrollDir = SCROLLDIR_NULL;
+ };
+
+ ~CDropTarget()
+ {
+ TestDebugOut("In IDT's destructor\r\n");
+ } ;
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppv);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ // *** IDropTarget methods ***
+ STDMETHODIMP DragEnter (LPDATAOBJECT pDataObj, DWORD grfKeyState,
+ POINTL pt, LPDWORD pdwEffect);
+ STDMETHODIMP DragOver (DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect);
+ STDMETHODIMP DragLeave ();
+ STDMETHODIMP Drop (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt,
+ LPDWORD pdwEffect);
+
+private:
+ // Drag/Drop support methods
+ BOOL QueryDrop (DWORD grfKeyState, POINTL pointl, BOOL fDragScroll,
+ LPDWORD lpdwEffect);
+ BOOL DoDragScroll( POINTL pointl );
+ void InitDragFeedback(LPDATAOBJECT pDataObj, POINTL pointl);
+ void DrawDragFeedback( POINTL pointl );
+ void UndrawDragFeedback( void );
+};
+
+#endif // _IDT_H_
diff --git a/private/oleutest/simpdnd/iocs.cpp b/private/oleutest/simpdnd/iocs.cpp
new file mode 100644
index 000000000..c17b08b5f
--- /dev/null
+++ b/private/oleutest/simpdnd/iocs.cpp
@@ -0,0 +1,365 @@
+//**********************************************************************
+// File name: IOCS.CPP
+//
+// Implementation file for COleClientSite
+//
+// Functions:
+//
+// See IOCS.H for class definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+
+
+//**********************************************************************
+//
+// COleClientSite::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation
+//
+// Parameters:
+//
+// REFIID riid - A reference to the interface that is
+// being queried.
+//
+// LPVOID FAR* ppvObj - An out parameter to return a pointer to
+// the interface.
+//
+// Return Value:
+//
+// S_OK - The interface is supported.
+// E_NOINTERFACE - The interface is not supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleSite::QueryInterface SITE.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In IOCS::QueryInterface\r\n");
+
+ // delegate to the container Site
+ return m_pSite->QueryInterface(riid, ppvObj);
+}
+
+//**********************************************************************
+//
+// COleClientSite::AddRef
+//
+// Purpose:
+//
+// Increments the reference count to CSimpleSite. Since COleClientSite
+// is a nested class of CSimpleSite, we don't need an extra reference
+// count for COleClientSite. We can safely use the reference count of
+// CSimpleSite.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of CSimpleSite
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleSite::AddRef SITE.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleClientSite::AddRef()
+{
+ TestDebugOut("In IOCS::AddRef\r\n");
+
+ // delegate to the container Site
+ return m_pSite->AddRef();
+}
+
+
+//**********************************************************************
+//
+// COleClientSite::Release
+//
+// Purpose:
+//
+// Decrements the reference count to CSimpleSite. Since COleClientSite
+// is a nested class of CSimpleSite, we don't need an extra reference
+// count for COleClientSite. We can safely use the reference count of
+// CSimpleSite.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the CSimpleSite
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleSite::Release SITE.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleClientSite::Release()
+{
+ TestDebugOut("In IOCS::Release\r\n");
+
+ // delegate to the container Site
+ return m_pSite->Release();
+}
+
+//**********************************************************************
+//
+// COleClientSite::SaveObject
+//
+// Purpose:
+//
+// Called by the object when it wants to be saved to persistant
+// storage
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleObject::QueryInterface Object
+// IPersistStorage::SaveCompleted Object
+// IPersistStorage::Release Object
+// ResultFromScode OLE API
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::SaveObject()
+{
+ LPPERSISTSTORAGE lpPS;
+ SCODE sc = E_FAIL;
+
+ TestDebugOut("In IOCS::SaveObject\r\n");
+
+ // get a pointer to IPersistStorage
+ HRESULT hErr = m_pSite->m_lpOleObject->QueryInterface(
+ IID_IPersistStorage,(LPVOID FAR *)&lpPS);
+
+ // save the object
+ if (hErr == NOERROR)
+ {
+ sc = GetScode( OleSave(lpPS, m_pSite->m_lpObjStorage, TRUE) );
+ lpPS->SaveCompleted(NULL);
+ lpPS->Release();
+ }
+
+ return ResultFromScode(sc);
+}
+
+//**********************************************************************
+//
+// COleClientSite::GetMoniker
+//
+// Purpose:
+//
+// Not Implemented
+//
+// Parameters:
+//
+// DWORD dwAssign - the type of Moniker to be returned
+// DWORD dwWhichMoniker - which Moniker to be returned in ppmk
+// LPMONIKER ppmk - point to where to return the Moniker
+//
+// Return Value:
+//
+// E_NOTIMPL
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function is not implemented because we don't support
+// linking.
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
+ LPMONIKER FAR* ppmk)
+{
+ TestDebugOut("In IOCS::GetMoniker\r\n");
+
+ // need to null the out pointer
+ *ppmk = NULL;
+
+ return ResultFromScode(E_NOTIMPL);
+}
+
+//**********************************************************************
+//
+// COleClientSite::GetContainer
+//
+// Purpose:
+//
+// Not Implemented
+//
+// Parameters:
+//
+// LPOLECONTAINER ppContainer - point to where the interface to be
+// returned
+//
+// Return Value:
+//
+// E_NOTIMPL
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::GetContainer(LPOLECONTAINER FAR* ppContainer)
+{
+ TestDebugOut("In IOCS::GetContainer\r\n");
+
+ // NULL the out pointer
+ *ppContainer = NULL;
+
+ return ResultFromScode(E_NOTIMPL);
+}
+
+//**********************************************************************
+//
+// COleClientSite::ShowObject
+//
+// Purpose:
+//
+// Not Implemented
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// NOERROR
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function is not implemented because we don't support
+// linking.
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::ShowObject()
+{
+ TestDebugOut("In IOCS::ShowObject\r\n");
+ return NOERROR;
+}
+
+//**********************************************************************
+//
+// COleClientSite::OnShowWindow
+//
+// Purpose:
+//
+// Object calls this method when it is opening/closing non-InPlace
+// Window
+//
+// Parameters:
+//
+// BOOL fShow - TRUE if Window is opening, FALSE if closing
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// InvalidateRect Windows API
+// BringWindowToTop Windows API
+// SetFocus Windows API
+// ResultFromScode OLE API
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::OnShowWindow(BOOL fShow)
+{
+ TestDebugOut("In IOCS::OnShowWindow\r\n");
+ m_pSite->m_fObjectOpen = fShow;
+ InvalidateRect(m_pSite->m_lpDoc->m_hDocWnd, NULL, TRUE);
+
+ // if object window is closing, then bring container window to top
+ if (! fShow)
+ {
+ BringWindowToTop(m_pSite->m_lpDoc->m_hDocWnd);
+ SetFocus(m_pSite->m_lpDoc->m_hDocWnd);
+ }
+ return ResultFromScode(S_OK);
+}
+
+//**********************************************************************
+//
+// COleClientSite::RequestNewObjectLayout
+//
+// Purpose:
+//
+// Not Implemented
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// E_NOTIMPL
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::RequestNewObjectLayout()
+{
+ TestDebugOut("In IOCS::RequestNewObjectLayout\r\n");
+ return ResultFromScode(E_NOTIMPL);
+}
diff --git a/private/oleutest/simpdnd/iocs.h b/private/oleutest/simpdnd/iocs.h
new file mode 100644
index 000000000..54b90ec32
--- /dev/null
+++ b/private/oleutest/simpdnd/iocs.h
@@ -0,0 +1,44 @@
+//**********************************************************************
+// File name: IOCS.H
+//
+// Definition of COleClientSite
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IOCS_H_ )
+#define _IOCS_H_
+
+#include <assert.h>
+
+class CSimpleSite;
+
+interface COleClientSite : public IOleClientSite
+{
+ CSimpleSite FAR * m_pSite;
+
+ COleClientSite(CSimpleSite FAR * pSite)
+ {
+ TestDebugOut("In IOCS's constructor\r\n");
+ m_pSite = pSite;
+ }
+
+ ~COleClientSite()
+ {
+ TestDebugOut("In IOCS's destructor\r\n");
+ }
+
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // *** IOleClientSite methods ***
+ STDMETHODIMP SaveObject();
+ STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
+ LPMONIKER FAR* ppmk);
+ STDMETHODIMP GetContainer(LPOLECONTAINER FAR* ppContainer);
+ STDMETHODIMP ShowObject();
+ STDMETHODIMP OnShowWindow(BOOL fShow);
+ STDMETHODIMP RequestNewObjectLayout();
+};
+
+#endif
diff --git a/private/oleutest/simpdnd/pre.cpp b/private/oleutest/simpdnd/pre.cpp
new file mode 100644
index 000000000..9603f4089
--- /dev/null
+++ b/private/oleutest/simpdnd/pre.cpp
@@ -0,0 +1,9 @@
+//**********************************************************************
+// File name: pre.cpp
+//
+// Used for precompiled headers
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
diff --git a/private/oleutest/simpdnd/pre.h b/private/oleutest/simpdnd/pre.h
new file mode 100644
index 000000000..141d528d5
--- /dev/null
+++ b/private/oleutest/simpdnd/pre.h
@@ -0,0 +1,30 @@
+//**********************************************************************
+// File name: pre.h
+//
+// Used for precompiled headers
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _PRE_H_)
+#define _PRE_H_
+
+#include <windows.h>
+#include <ole2.h>
+#include <ole2ui.h>
+#include <assert.h>
+#include <string.h>
+#include "simpdnd.h"
+#include "resource.h"
+
+
+extern "C" void TestDebugOut(LPSTR psz);
+
+#ifndef WIN32
+/* Since OLE is part of the operating system in Win32, we don't need to
+ * check the version number in Win32.
+ */
+#include <ole2ver.h>
+#endif // WIN32
+
+#endif
diff --git a/private/oleutest/simpdnd/readme.txt b/private/oleutest/simpdnd/readme.txt
new file mode 100644
index 000000000..afcca0b6c
--- /dev/null
+++ b/private/oleutest/simpdnd/readme.txt
@@ -0,0 +1,47 @@
+Simple Drag and Drop Sample
+---------------------------
+
+This sample demonstrates an implementation of OLE 2 drag and drop. It allows
+drag and drop operations between two instances of the sample application.
+For information on compiling and building the sample, see the makefile in
+this directory.
+
+
+Simple Drag and Drop Objects Overview :
+---------------------------------------
+Simple Drag and Drop consists of three main objects. The top level is
+CSimpleApp, under which is CSimpleDoc, and the innermost level is CSimpleSite.
+CSimpleApp is used to hold all the main window information. (eg. handle to
+the main window, handles to the main, edit, and help menus and the application
+instance) CSimpleApp always exists as long as the simple drag and drop
+application is alive.
+
+The next level object is CSimpleDoc object. It is instantiated when a new
+document is created. It enables and disables the menu items in the main menu.
+Since simple drag and drop is a single document interface application, the
+user is only allowed to insert one object into the document. It is
+necessary to disable certain items from the main menu to avoid incorrect
+selection. It also registers the window for drag and drop and manipulates
+the clipboard operations, such as copy to the clipboard, flush the clipboard.
+It demonstrates the implementates of two OLE interfaces in its nested classes,
+IDropSource and IDropTarget. These two interfaces are implemented as
+CDropSource and CDropTarget respectively.
+
+The CSimpleDoc object instantiates two different objects based on the user
+selection from the main menu. The CSimpleSite object is instantiated if the
+user chooses to insert a new object into the document. CSimpleSite
+demonstrates the implementation of IAdviseSink and IOleClientSite through its
+nested classes. These two interfaces are implemented as CAdviseSink and
+COleClientSite accordingly. CSimpleSite manipulates the storage handling and
+acts as a client site to communicate to a remote server. Such server can be
+an executable server or a dll server. The CDataXferObj object is instantiated
+when the user chooses to copy the existing object from the current document.
+it is required to copy an object to the clipboard. CDataXferObj demonstrates
+the IDataObject interface implementation and performs data transfer
+operations.
+
+
+
+
+
+ \ No newline at end of file
diff --git a/private/oleutest/simpdnd/resource.h b/private/oleutest/simpdnd/resource.h
new file mode 100644
index 000000000..2817b0642
--- /dev/null
+++ b/private/oleutest/simpdnd/resource.h
@@ -0,0 +1,39 @@
+//{{NO_DEPENDENCIES}}
+// App Studio generated include file.
+// Used by SIMPDND.RC
+//
+#define IDM_OPEN 102
+#define IDC_DRAGPENDING 102
+#define IDM_SAVE 103
+#define IDM_SAVEAS 104
+#define IDM_PRINT 105
+#define IDM_EXIT 106
+#define IDM_UNDO 107
+#define IDM_CUT 108
+#define IDM_COPY 109
+#define IDM_PASTE 110
+#define ID_EDIT_INSERTOBJECT 111
+#define IDM_INSERTOBJECT 111
+#define IDM_NEW 112
+#define IDM_SOURCE_COPY 113
+#define IDM_SOURCE_MOVE 114
+#define IDM_SOURCE_COPYMOVE 115
+#define IDM_TARGET_COPY 116
+#define IDM_TARGET_MOVE 117
+#define IDM_TARGET_COPYMOVE 118
+
+// Menu positions of source/target effects menus
+#define SOURCE_EFFECTS_MENU_POS 0
+#define TARGET_EFFECTS_MENU_POS 1
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_COMMAND_VALUE 113
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/private/oleutest/simpdnd/simpdnd.cpp b/private/oleutest/simpdnd/simpdnd.cpp
new file mode 100644
index 000000000..b70a99e30
--- /dev/null
+++ b/private/oleutest/simpdnd/simpdnd.cpp
@@ -0,0 +1,502 @@
+//**********************************************************************
+// File name: Simple.cpp
+//
+// Main source file for the Simple OLE 2.0 object container
+//
+// Functions:
+//
+// WinMain - Program entry point
+// MainWndProc - Processes messages for the frame window
+// About - Processes messages for the about dialog
+// DocWndProc - Processes messages for the doc window
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+#include <stdlib.h>
+#include <testmess.h>
+#include "tests.h"
+
+
+// This line is needed for the debug utilities in OLE2UI
+extern "C" {
+ OLEDBGDATA_MAIN(TEXT("SIMPDND"))
+}
+
+CSimpleApp FAR * lpCSimpleApp;
+BOOL fBeVerbose = FALSE;
+extern "C"
+void TestDebugOut(LPSTR psz)
+{
+ if (fBeVerbose)
+ {
+ OutputDebugStringA(psz);
+ }
+}
+
+BOOL gfUseEmptyEnumerator;
+
+
+//**********************************************************************
+//
+// WinMain
+//
+// Purpose:
+//
+// Program entry point
+//
+// Parameters:
+//
+// HANDLE hInstance - Instance handle for this instance
+//
+// HANDLE hPrevInstance - Instance handle for the last instance
+//
+// LPSTR lpCmdLine - Pointer to the command line
+//
+// int nCmdShow - Window State
+//
+// Return Value:
+//
+// msg.wParam or FALSE if failure to initialize
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleApp::CSimpleApp APP.CPP
+// CSimpleApp::fInitApplication APP.CPP
+// CSimpleApp::fInitInstance APP.CPP
+// CSimpleApp::~CSimpleApp APP.CPP
+// CSimpleApp::AddRef APP.CPP
+// CSimpleApp::Release APP.CPP
+// OleUIInitialize OLE2UI
+// OleUIUninitialize OLE2UI
+// GetMessage Windows API
+// SetMessageQueue Windows API
+// MessageBox Windows API
+// TranslateMessage Windows API
+// DispatchMessage Windows API
+//
+//
+//********************************************************************
+
+int PASCAL WinMain
+#ifdef WIN32
+ (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
+ int nCmdShow)
+#else
+ (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+#endif
+{
+ MSG msg;
+ LPSTR pszTemp;
+ fBeVerbose = GetProfileInt("OLEUTEST","BeVerbose",0);
+
+ if(fBeVerbose == 0)
+ {
+ fBeVerbose = GetProfileInt("OLEUTEST","simpdnd",0);
+ }
+
+ // needed for LRPC to work properly...
+ SetMessageQueue(96);
+
+ lpCSimpleApp = new CSimpleApp;
+
+
+ if (!lpCSimpleApp)
+ {
+ /* memory allocation problem. We cannot carry on.
+ */
+ MessageBox(NULL, TEXT("Out of Memory"), TEXT("SimpDnD"),
+ MB_SYSTEMMODAL | MB_ICONHAND);
+ return(FALSE);
+ }
+
+ // we will add one ref count on our App. later when we want to destroy
+ // the App object we will release this ref count. when the App's ref
+ // count goes to 0, it will be deleted.
+ lpCSimpleApp->AddRef();
+
+ // process the command line
+
+ if( (pszTemp = strstr(lpCmdLine, "-driver")) )
+ {
+ //we were launched by the test driver
+ lpCSimpleApp->m_hDriverWnd = (HWND)strtoul(pszTemp+8, NULL, 10);
+ }
+
+ // check for the -empty flag (use empty enumerator)
+ if( strstr(lpCmdLine, "-empty") )
+ {
+ gfUseEmptyEnumerator = TRUE;
+ }
+
+ // app initialization
+ if (!hPrevInstance)
+ if (!lpCSimpleApp->fInitApplication(hInstance))
+ {
+ lpCSimpleApp->Release();
+ return (FALSE);
+ }
+
+ // instance initialization
+ if (!lpCSimpleApp->fInitInstance(hInstance, nCmdShow))
+ {
+ lpCSimpleApp->Release();
+ return (FALSE);
+ }
+
+#if 0
+ /* Initialization required for OLE 2 UI library. This call is
+ ** needed ONLY if we are using the static link version of the UI
+ ** library. If we are using the DLL version, we should NOT call
+ ** this function in our application.
+ */
+
+ if (!OleUIInitialize(hInstance, hPrevInstance, TEXT(SZCLASSICONBOX),
+ TEXT(SZCLASSRESULTIMAGE)))
+ {
+ OleDbgOut(TEXT("Could not initialize OLEUI library\n"));
+ lpCSimpleApp->Release();
+ return FALSE;
+ }
+#endif
+ // message loop
+ while (GetMessage(&msg, NULL, NULL, NULL))
+ if (!lpCSimpleApp->HandleAccelerators(&msg))
+ {
+ TranslateMessage(&msg); /* Translates virtual key codes */
+ DispatchMessage(&msg); /* Dispatches message to window */
+ }
+
+#if 0
+ // De-initialization for UI libraries. Just like OleUIInitialize, this
+ // funciton is needed ONLY if we are using the static link version of the
+ // OLE UI library.
+ OleUIUninitialize();
+#endif
+
+ // Release the ref count added on the App above. this will make
+ // the App's ref count go to 0, and the App object will be deleted.
+ lpCSimpleApp->Release();
+
+ return (msg.wParam); /* Returns the value from PostQuitMessage */
+}
+
+
+//**********************************************************************
+//
+// MainWndProc
+//
+// Purpose:
+//
+// Processes messages for the frame window
+//
+// Parameters:
+//
+// HWND hWnd - Window handle for frame window
+//
+// UINT message - Message value
+//
+// WPARAM wParam - Message info
+//
+// LPARAM lParam - Message info
+//
+// Return Value:
+//
+// long
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleApp::lCommandHandler APP.CPP
+// CSimpleApp::DestroyDocs APP.CPP
+// CSimpleApp::lCreateDoc APP.CPP
+// CSimpleApp::lSizeHandler APP.CPP
+// CSimpleDoc::lAddVerbs DOC.CPP
+// PostQuitMessage Windows API
+// DefWindowProc Windows API
+// DestroyWindow Windows API
+//
+//
+//********************************************************************
+
+long FAR PASCAL EXPORT MainWndProc(HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+
+ switch (message)
+ {
+ case WM_TEST2:
+ StartTest2(lpCSimpleApp);
+ break;
+ case WM_TEST1:
+ StartTest1(lpCSimpleApp);
+ break;
+ case WM_CLOSE:
+ DestroyWindow(lpCSimpleApp->m_hAppWnd);
+ break;
+
+ case WM_COMMAND: // message: command from application menu
+ return lpCSimpleApp->lCommandHandler(hWnd, message, wParam,
+ lParam);
+ break;
+
+ case WM_CREATE:
+#ifdef NOTREADY
+ RemoveMenu(GetSubMenu(GetMenu(hWnd), 1), 0, MF_BYPOSITION);
+#endif // NOTREADY
+ return lpCSimpleApp->lCreateDoc(hWnd, message, wParam, lParam);
+ break;
+
+ case WM_DESTROY: // message: window being destroyed
+ lpCSimpleApp->DestroyDocs(); // need to destroy the doc...
+ PostQuitMessage(0);
+ break;
+
+ case WM_INITMENUPOPUP:
+ // is this the edit menu?
+ if ( LOWORD(lParam) == 1)
+ return lpCSimpleApp->m_lpDoc->lAddVerbs();
+ break;
+
+ case WM_SIZE:
+ return lpCSimpleApp->lSizeHandler(hWnd, message, wParam, lParam);
+
+ default: // Passes it on if unproccessed
+ return (DefWindowProc(hWnd, message, wParam, lParam));
+ }
+ return (NULL);
+}
+
+
+//**********************************************************************
+//
+// About
+//
+// Purpose:
+//
+// Processes dialog box messages
+//
+// Parameters:
+//
+// HWND hWnd - Window handle for dialog box
+//
+// UINT message - Message value
+//
+// WPARAM wParam - Message info
+//
+// LPARAM lParam - Message info
+//
+// Return Value:
+//
+// Function Calls:
+// Function Location
+//
+// EndDialog Windows API
+//
+//
+//********************************************************************
+BOOL
+#ifdef WIN32
+ CALLBACK
+#else
+ FAR PASCAL EXPORT
+#endif
+ About(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
+
+{
+ switch (message)
+ {
+ case WM_INITDIALOG: /* message: initialize dialog box */
+ return (TRUE);
+
+ case WM_COMMAND: /* message: received a command */
+ if (wParam == IDOK /* "OK" box selected? */
+ || wParam == IDCANCEL) /* System menu close command? */
+ {
+ EndDialog(hDlg, TRUE); /* Exits the dialog box */
+ return (TRUE);
+ }
+ break;
+ }
+
+ return (FALSE); /* Didn't process a message */
+}
+
+//**********************************************************************
+//
+// DocWndProc
+//
+// Purpose:
+//
+// Processes dialog box messages
+//
+// Parameters:
+//
+// HWND hWnd - Window handle for doc window
+//
+// UINT message - Message value
+//
+// WPARAM wParam - Message info
+//
+// LPARAM lParam - Message info
+//
+// Return Value:
+//
+// long
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleApp::PaintApp APP.CPP
+// BeginPaint Windows API
+// EndPaint Windows API
+// DefWindowProc Windows API
+// IOleObject::DoVerb Object
+// CSimpleSite::GetObjRect SITE.CPP
+// CSimpleDoc::QueryDrag DOC.CPP
+// CSimpleDoc::DoDragDrop DOC.CPP
+// SetTimer Windows API
+// KillTimer Windows API
+// SetCapture Windows API
+// ReleaseCapture Windows API
+//
+//
+//********************************************************************
+
+long FAR PASCAL EXPORT DocWndProc(HWND hWnd, UINT message, WPARAM wParam,
+ LPARAM lParam)
+{
+ HDC hDC;
+ PAINTSTRUCT ps;
+
+ switch (message)
+ {
+ case WM_PAINT:
+
+ hDC = BeginPaint(hWnd, &ps);
+
+ if (lpCSimpleApp)
+ lpCSimpleApp->PaintApp (hDC);
+
+ EndPaint(hWnd, &ps);
+ break;
+
+ case WM_LBUTTONDBLCLK:
+ {
+ POINT pt;
+
+ pt.x = (int)(short)LOWORD (lParam );
+ pt.y = (int)(short)HIWORD (lParam );
+
+ if (lpCSimpleApp->m_lpDoc->m_lpSite &&
+ lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject)
+ {
+ RECT rect;
+
+ lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);
+
+ if ( PtInRect(&rect, pt) )
+ {
+ // Execute object's default verb
+ lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
+ OLEIVERB_PRIMARY, (LPMSG)&message,
+ &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite,
+ -1, hWnd, &rect);
+ }
+ }
+ break;
+ }
+
+ case WM_LBUTTONDOWN:
+ {
+ POINT pt;
+
+ pt.x = (int)(short)LOWORD (lParam );
+ pt.y = (int)(short)HIWORD (lParam );
+
+ /* OLE2NOTE: check if this is a button down on the region
+ ** that is a handle to start a drag operation. for us,
+ ** this this is any where in the window. we
+ ** do NOT want to start a drag immediately; we want to
+ ** wait until the mouse moves a certain threshold. or a
+ ** certain amount of time has elapsed. if
+ ** LButtonUp comes before the drag is started, then
+ ** the fPendingDrag state is cleared. we must capture
+ ** the mouse to ensure the modal state is handled
+ ** properly.
+ */
+ if (lpCSimpleApp->m_lpDoc->QueryDrag(pt) )
+ {
+ lpCSimpleApp->m_lpDoc->m_fPendingDrag = TRUE;
+ lpCSimpleApp->m_lpDoc->m_ptButDown = pt;
+ SetTimer(hWnd, 1, lpCSimpleApp->m_nDragDelay, NULL);
+ SetCapture(hWnd);
+ }
+ break;
+ }
+
+ case WM_LBUTTONUP:
+
+ if (lpCSimpleApp->m_lpDoc->m_fPendingDrag)
+ {
+ /* ButtonUP came BEFORE distance/time threshholds were
+ ** exceeded. clear fPendingDrag state.
+ */
+ ReleaseCapture();
+ KillTimer(hWnd, 1);
+ lpCSimpleApp->m_lpDoc->m_fPendingDrag = FALSE;
+ }
+ break;
+
+ case WM_MOUSEMOVE:
+ {
+ if (lpCSimpleApp->m_lpDoc->m_fPendingDrag)
+ {
+ int x = (int)(short)LOWORD (lParam );
+ int y = (int)(short)HIWORD (lParam );
+ POINT pt = lpCSimpleApp->m_lpDoc->m_ptButDown;
+ int nDragMinDist = lpCSimpleApp->m_nDragMinDist;
+
+ if (! ( ((pt.x - nDragMinDist) <= x)
+ && (x <= (pt.x + nDragMinDist))
+ && ((pt.y - nDragMinDist) <= y)
+ && (y <= (pt.y + nDragMinDist)) ) )
+ {
+ // mouse moved beyond threshhold to start drag
+ ReleaseCapture();
+ KillTimer(hWnd, 1);
+ lpCSimpleApp->m_lpDoc->m_fPendingDrag = FALSE;
+
+ // perform the modal drag/drop operation.
+ lpCSimpleApp->m_lpDoc->DoDragDrop( );
+ }
+ }
+ break;
+ }
+
+ case WM_TIMER:
+ {
+ // drag time delay threshhold exceeded -- start drag
+ ReleaseCapture();
+ KillTimer(hWnd, 1);
+ lpCSimpleApp->m_lpDoc->m_fPendingDrag = FALSE;
+
+ // perform the modal drag/drop operation.
+ lpCSimpleApp->m_lpDoc->DoDragDrop( );
+ break;
+ }
+
+ default: /* Passes it on if unproccessed */
+ return (DefWindowProc(hWnd, message, wParam, lParam));
+ }
+ return (NULL);
+}
+
+
diff --git a/private/oleutest/simpdnd/simpdnd.h b/private/oleutest/simpdnd/simpdnd.h
new file mode 100644
index 000000000..1337a3907
--- /dev/null
+++ b/private/oleutest/simpdnd/simpdnd.h
@@ -0,0 +1,45 @@
+//**********************************************************************
+// File name: simpdnd.h
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#define IDM_ABOUT 100
+#define IDM_INSERT 101
+#define IDM_VERB0 1000
+
+int PASCAL WinMain
+#ifdef WIN32
+ (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
+#else
+ (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
+#endif
+
+
+BOOL InitApplication(HANDLE hInstance);
+BOOL InitInstance(HANDLE hInstance, int nCmdShow);
+
+long FAR PASCAL EXPORT MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+long FAR PASCAL EXPORT DocWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+#ifdef WIN32
+BOOL CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LONG lParam);
+#else
+BOOL FAR PASCAL EXPORT About(HWND hDlg, UINT message, WPARAM wParam, LONG lParam);
+#endif
+
+#ifndef LATER
+#define SZCLASSICONBOX "SimpDndIBClass"
+#define SZCLASSRESULTIMAGE "SimpDndRIClass"
+#endif
+
+
+#ifdef WIN32
+
+// Macro for TestDebugOut
+#ifdef UNICODE
+#undef TestDebugOut
+#define TestDebugOut(A); TestDebugOutW(TEXT(A));
+#endif
+
+#endif
+
diff --git a/private/oleutest/simpdnd/simpdnd.ico b/private/oleutest/simpdnd/simpdnd.ico
new file mode 100644
index 000000000..c5aceb582
--- /dev/null
+++ b/private/oleutest/simpdnd/simpdnd.ico
Binary files differ
diff --git a/private/oleutest/simpdnd/simpdnd.rc b/private/oleutest/simpdnd/simpdnd.rc
new file mode 100644
index 000000000..ebd4f8ff4
--- /dev/null
+++ b/private/oleutest/simpdnd/simpdnd.rc
@@ -0,0 +1,114 @@
+//Microsoft App Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+#include "simpdnd.h"
+#include "ole2ui.rc"
+
+//////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+SimpDnd icon simpdnd.ico
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+SIMPLEMENU MENU DISCARDABLE
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&New", IDM_NEW
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", IDM_EXIT
+ END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "&Copy", IDM_COPY
+ MENUITEM "&Insert Object...", IDM_INSERTOBJECT
+ END
+ POPUP "&Other"
+ BEGIN
+ POPUP "&Source Options"
+ BEGIN
+ MENUITEM "&Copy Only", IDM_SOURCE_COPY
+ MENUITEM "&Move Only", IDM_SOURCE_MOVE
+ MENUITEM "&Both Copy/Move" IDM_SOURCE_COPYMOVE
+ END
+ POPUP "&Target Options"
+ BEGIN
+ MENUITEM "&Copy Only", IDM_TARGET_COPY
+ MENUITEM "&Move Only", IDM_TARGET_MOVE
+ MENUITEM "&Both Copy/Move" IDM_TARGET_COPYMOVE
+ END
+ MENUITEM "&About Simple...", IDM_ABOUT
+ END
+END
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+ABOUTBOX DIALOG DISCARDABLE 22, 17, 144, 75
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About SimpDnD"
+FONT 8, "System"
+BEGIN
+ CTEXT "Simple OLE 2.0",-1,0,5,144,8
+ CTEXT "Drag/Drop Container Application",-1,0,14,144,8
+ CTEXT "Version 2.01",-1,0,34,144,8
+ DEFPUSHBUTTON "OK",IDOK,53,59,32,14,WS_GROUP
+END
+
+#ifdef APSTUDIO_INVOKED
+//////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""windows.h""\r\n"
+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""simpdnd.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef APSTUDIO_INVOKED
+////////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
+
diff --git a/private/oleutest/simpdnd/site.cpp b/private/oleutest/simpdnd/site.cpp
new file mode 100644
index 000000000..3ae88d623
--- /dev/null
+++ b/private/oleutest/simpdnd/site.cpp
@@ -0,0 +1,632 @@
+//**********************************************************************
+// File name: SITE.CPP
+//
+// Implementation file for CSimpleSite
+//
+// Functions:
+//
+// See SITE.H for class definition
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+
+//**********************************************************************
+//
+// CSimpleSite::Create
+//
+// Purpose:
+//
+// Creation routine for CSimpleSite
+//
+// Parameters:
+//
+// CSimpleDoc FAR *lpDoc - Pointer to CSimpleDoc
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::CSimpleSite SITE.CPP
+// CSimpleSite::~CSimpleSite SITE.CPP
+// CSimpleSite::AddRef SITE.CPP
+// IStorage::CreateStorage OLE API
+// assert C Runtime
+//
+//
+//********************************************************************
+
+CSimpleSite FAR * CSimpleSite::Create(CSimpleDoc FAR *lpDoc)
+{
+ CSimpleSite FAR * lpTemp = new CSimpleSite(lpDoc);
+
+ if (!lpTemp)
+ return NULL;
+
+ // create a sub-storage for the object
+ HRESULT hErr = lpDoc->m_lpStorage->CreateStorage( OLESTR("Object"),
+ STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
+ 0,
+ 0,
+ &lpTemp->m_lpObjStorage);
+
+ assert(hErr == NOERROR);
+
+ if (hErr != NOERROR)
+ {
+ delete lpTemp;
+ return NULL;
+ }
+
+ // we will add one ref count on our Site. later when we want to destroy
+ // the Site object we will release this ref count. when the Site's ref
+ // count goes to 0, it will be deleted.
+ lpTemp->AddRef();
+
+ return lpTemp;
+}
+
+//**********************************************************************
+//
+// CSimpleSite::CSimpleSite
+//
+// Purpose:
+//
+// Constructor for CSimpleSite
+//
+// Parameters:
+//
+// CSimpleDoc FAR *lpDoc - Pointer to CSimpleDoc
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+//
+//********************************************************************
+#pragma warning(disable : 4355) // turn off this warning. This warning
+ // tells us that we are passing this in
+ // an initializer, before "this" is through
+ // initializing. This is ok, because
+ // we just store the ptr in the other
+ // constructors
+
+CSimpleSite::CSimpleSite (CSimpleDoc FAR *lpDoc) : m_OleClientSite(this),
+ m_AdviseSink(this)
+#pragma warning (default : 4355) // Turn the warning back on
+{
+ // remember the pointer to the doc
+ m_lpDoc = lpDoc;
+ m_sizel.cx = 0;
+ m_sizel.cy = 0;
+
+ // clear the reference count
+ m_nCount = 0;
+
+ m_dwDrawAspect = DVASPECT_CONTENT;
+ m_lpOleObject = NULL;
+ m_fObjectOpen = FALSE;
+}
+
+//**********************************************************************
+//
+// CSimpleSite::~CSimpleSite
+//
+// Purpose:
+//
+// Destructor for CSimpleSite
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleObject::Release Object
+// IStorage::Release OLE API
+//
+//
+//********************************************************************
+
+CSimpleSite::~CSimpleSite ()
+{
+ TestDebugOut ("In CSimpleSite's Destructor \r\n");
+
+ if (m_lpOleObject)
+ m_lpOleObject->Release();
+
+ if (m_lpObjStorage)
+ m_lpObjStorage->Release();
+}
+
+
+//**********************************************************************
+//
+// CSimpleSite::CloseOleObject
+//
+// Purpose:
+//
+// Call IOleObject::Close on the object of the CSimpleSite
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleObject::Close Object
+//
+//
+//********************************************************************
+
+void CSimpleSite::CloseOleObject (void)
+{
+ LPVIEWOBJECT lpViewObject = NULL;
+
+ TestDebugOut ("In CSimpleSite::CloseOleObject \r\n");
+
+ if (m_lpOleObject)
+ {
+ m_lpOleObject->Close(OLECLOSE_NOSAVE);
+ }
+}
+
+
+//**********************************************************************
+//
+// CSimpleSite::UnloadOleObject
+//
+// Purpose:
+//
+// Close and release all pointers to the object of the CSimpleSite
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleSite::CloseOleObject SITE.CPP
+// IOleObject::QueryInterface Object
+// IViewObject::SetAdvise Object
+// IViewObject::Release Object
+// IOleObject::Release Object
+//
+//
+//********************************************************************
+
+void CSimpleSite::UnloadOleObject (void)
+{
+ TestDebugOut ("In CSimpleSite::UnloadOleObject \r\n");
+
+ if (m_lpOleObject)
+ {
+ LPVIEWOBJECT lpViewObject;
+ CloseOleObject(); // ensure object is closed; NOP if already closed
+
+ m_lpOleObject->QueryInterface(IID_IViewObject,
+ (LPVOID FAR *)&lpViewObject);
+
+ if (lpViewObject)
+ {
+ // Remove the view advise
+ lpViewObject->SetAdvise(m_dwDrawAspect, 0, NULL);
+ lpViewObject->Release();
+ }
+
+ m_lpOleObject->Release();
+ m_lpOleObject = NULL;
+ }
+}
+
+
+//**********************************************************************
+//
+// CSimpleSite::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation of the container Site.
+//
+// Parameters:
+//
+// REFIID riid - A reference to the interface that is
+// being queried.
+//
+// LPVOID FAR* ppvObj - An out parameter to return a pointer to
+// the interface.
+//
+// Return Value:
+//
+// S_OK - The interface is supported.
+// S_FALSE - The interface is not supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IsEqualIID OLE API
+// ResultFromScode OLE API
+// CSimpleSite::AddRef OBJ.CPP
+// COleClientSite::AddRef IOCS.CPP
+// CAdviseSink::AddRef IAS.CPP
+//
+//
+//********************************************************************
+
+STDMETHODIMP CSimpleSite::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpleSite::QueryInterface\r\n");
+
+ *ppvObj = NULL; // must set out pointer parameters to NULL
+
+ if ( IsEqualIID(riid, IID_IUnknown))
+ {
+ AddRef();
+ *ppvObj = this;
+ return ResultFromScode(S_OK);
+ }
+
+ if ( IsEqualIID(riid, IID_IOleClientSite))
+ {
+ m_OleClientSite.AddRef();
+ *ppvObj = &m_OleClientSite;
+ return ResultFromScode(S_OK);
+ }
+
+ if ( IsEqualIID(riid, IID_IAdviseSink))
+ {
+ m_AdviseSink.AddRef();
+ *ppvObj = &m_AdviseSink;
+ return ResultFromScode(S_OK);
+ }
+
+ // Not a supported interface
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+//**********************************************************************
+//
+// CSimpleSite::AddRef
+//
+// Purpose:
+//
+// Increments the reference count of the container Site.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the site.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpleSite::AddRef()
+{
+ TestDebugOut("In CSimpleSite::AddRef\r\n");
+
+ return ++m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpleSite::Release
+//
+// Purpose:
+//
+// Decrements the reference count of the container Site
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the Site.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpleSite::Release()
+{
+ TestDebugOut("In CSimpleSite::Release\r\n");
+
+ if (--m_nCount == 0)
+ {
+ delete this;
+ return 0;
+ }
+ return m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpleSite::InitObject
+//
+// Purpose:
+//
+// Used to initialize a newly create object (can't be done in the
+// constructor).
+//
+// Parameters:
+//
+// BOOL fCreateNew - TRUE if insert NEW object
+// FALSE if create object FROM FILE
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// IOleObject::SetHostNames Object
+// IOleObject::QueryInterface Object
+// IViewObject2::GetExtent Object
+// IOleObject::DoVerb Object
+// IViewObject2::SetAdvise Object
+// IViewObject2::Release Object
+// GetClientRect Windows API
+// OleSetContainedObject OLE API
+//
+//
+//********************************************************************
+
+HRESULT CSimpleSite::InitObject(BOOL fCreateNew)
+{
+ LPVIEWOBJECT2 lpViewObject2;
+ RECT rect;
+ HRESULT hRes;
+
+ // Set a View Advise
+ hRes = m_lpOleObject->QueryInterface(IID_IViewObject2,
+ (LPVOID FAR *)&lpViewObject2);
+ if (hRes == ResultFromScode(S_OK))
+ {
+ hRes = lpViewObject2->SetAdvise(m_dwDrawAspect, ADVF_PRIMEFIRST,
+ &m_AdviseSink);
+
+ if( FAILED(hRes))
+ {
+ goto errRtn;
+ }
+ // get the initial size of the object
+
+ hRes = lpViewObject2->GetExtent(m_dwDrawAspect, -1 /*lindex*/, NULL /*ptd*/,
+ &m_sizel);
+
+ //
+ // Is OK if the object is actually blank
+ //
+ if( FAILED(hRes) && (hRes != OLE_E_BLANK) )
+ {
+ goto errRtn;
+ }
+
+ lpViewObject2->Release();
+ }
+ GetObjRect(&rect); // get the rectangle of the object in pixels
+
+ // give the object the name of the container app/document
+ hRes = m_lpOleObject->SetHostNames(OLESTR("Simple Application"),
+ OLESTR("Simple OLE 2.0 Drag/Drop Container"));
+
+ if( FAILED(hRes) )
+ {
+ goto errRtn;
+ }
+
+ // inform object handler/DLL object that it is used in the embedding
+ // container's context
+ if (OleSetContainedObject(m_lpOleObject, TRUE) != ResultFromScode(S_OK))
+ {
+ TestDebugOut("Fail in OleSetContainedObject\n");
+ }
+
+ if (fCreateNew)
+ {
+ // force new object to save to guarantee valid object in our storage.
+ // OLE 1.0 objects may close w/o saving. this is NOT necessary if the
+ // object is created FROM FILE; its data in storage is already valid.
+ m_OleClientSite.SaveObject();
+
+ // we only want to DoVerb(SHOW) if this is an InsertNew object.
+ // we should NOT DoVerb(SHOW) if the object is created FromFile.
+ hRes = m_lpOleObject->DoVerb(
+ OLEIVERB_SHOW,
+ NULL,
+ &m_OleClientSite,
+ -1,
+ m_lpDoc->m_hDocWnd,
+ &rect);
+ }
+
+errRtn:
+ return hRes;
+
+}
+
+//**********************************************************************
+//
+// CSimpleSite::PaintObj
+//
+// Purpose:
+//
+// Paints the object
+//
+// Parameters:
+//
+// HDC hDC - Device context of the document window
+//
+// Return Value:
+// None
+//
+// Function Calls:
+// Function Location
+//
+// IOleObject::QueryInterface Object
+// IViewObject::GetColorSet Object
+// IViewObject::Release Object
+// CreateHatchBrush Windows API
+// SelectObject Windows API
+// SetROP2 Windows API
+// Rectangle Windows API
+// DeleteObject Windows API
+// CreatePalette Windows API
+// SelectPalette Windows API
+// RealizePalette Windows API
+// OleStdFree OUTLUI Function
+// OleDraw OLE API
+// CSimpleSite::GetObjRect SITE.CPP
+//
+//
+//********************************************************************
+
+void CSimpleSite::PaintObj(HDC hDC)
+{
+ RECT rect;
+
+ // need to check to make sure there is a valid object
+ // available. This is needed if there is a paint msg
+ // between the time that CSimpleSite is instantiated
+ // and OleUIInsertObject returns.
+ if (!m_lpOleObject)
+ return;
+
+ // convert it to pixels
+ GetObjRect(&rect);
+
+ LPLOGPALETTE pColorSet = NULL;
+ LPVIEWOBJECT lpView = NULL;
+
+ // get a pointer to IViewObject
+ m_lpOleObject->QueryInterface(IID_IViewObject,(LPVOID FAR *) &lpView);
+
+ // if the QI succeeds, get the LOGPALETTE for the object
+ if (lpView)
+ lpView->GetColorSet(m_dwDrawAspect, -1, NULL, NULL, NULL, &pColorSet);
+
+ HPALETTE hPal=NULL;
+ HPALETTE hOldPal=NULL;
+
+ // if a LOGPALETTE was returned (not guarateed), create the palette and
+ // realize it. NOTE: A smarter application would want to get the LOGPALETTE
+ // for each of its visible objects, and try to create a palette that
+ // satisfies all of the visible objects. ALSO: OleStdFree() is use to
+ // free the returned LOGPALETTE.
+ if ((pColorSet))
+ {
+ hPal = CreatePalette((const LPLOGPALETTE) pColorSet);
+ hOldPal = SelectPalette(hDC, hPal, FALSE);
+ RealizePalette(hDC);
+ OleStdFree(pColorSet);
+ }
+
+ // draw the object
+ HRESULT hRes;
+ hRes = OleDraw(m_lpOleObject, m_dwDrawAspect, hDC, &rect);
+ if ((hRes != ResultFromScode(S_OK)) &&
+ (hRes != ResultFromScode(OLE_E_BLANK)) &&
+ (hRes != ResultFromScode(DV_E_NOIVIEWOBJECT)))
+ {
+ TestDebugOut("Fail in OleDraw\n");
+ }
+
+ // if the object is open, draw a hatch rect.
+ if (m_fObjectOpen)
+ {
+ HBRUSH hBrush = CreateHatchBrush ( HS_BDIAGONAL, RGB(0,0,0) );
+ HBRUSH hOldBrush = (HBRUSH) SelectObject (hDC, hBrush);
+ SetROP2(hDC, R2_MASKPEN);
+ Rectangle (hDC, rect.left, rect.top, rect.right, rect.bottom);
+ SelectObject(hDC, hOldBrush);
+ DeleteObject(hBrush);
+ }
+
+ // if we created a palette, restore the old one, and destroy
+ // the object.
+ if (hPal)
+ {
+ SelectPalette(hDC,hOldPal,FALSE);
+ DeleteObject(hPal);
+ }
+
+ // if a view pointer was successfully returned, it needs to be released.
+ if (lpView)
+ lpView->Release();
+}
+
+//**********************************************************************
+//
+// CSimpleSite::GetObjRect
+//
+// Purpose:
+//
+// Retrieves the rect of the object in pixels
+//
+// Parameters:
+//
+// LPRECT lpRect - Rect structure filled with object's rect in pixels
+//
+// Return Value:
+// None
+//
+// Function Calls:
+// Function Location
+//
+// XformWidthInHimetricToPixels OLE2UI Function
+// XformHeightInHimetricToPixels OLE2UI Function
+//
+//
+//********************************************************************
+
+void CSimpleSite::GetObjRect(LPRECT lpRect)
+{
+ // convert it to pixels
+ lpRect->left = lpRect->top = 0;
+ lpRect->right = XformWidthInHimetricToPixels(NULL,(int)m_sizel.cx);
+ lpRect->bottom = XformHeightInHimetricToPixels(NULL,(int)m_sizel.cy);
+}
diff --git a/private/oleutest/simpdnd/site.h b/private/oleutest/simpdnd/site.h
new file mode 100644
index 000000000..f9e0301ab
--- /dev/null
+++ b/private/oleutest/simpdnd/site.h
@@ -0,0 +1,47 @@
+//**********************************************************************
+// File name: SITE.H
+//
+// Definition of CSimpleSite
+//
+// Copyright (c) 1992 - 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _SITE_H_ )
+#define _SITE_H_
+
+#include <ole2.h>
+#include "ias.h"
+#include "iocs.h"
+
+class CSimpleDoc;
+
+class CSimpleSite : public IUnknown
+{
+public:
+ int m_nCount;
+ LPOLEOBJECT m_lpOleObject;
+ DWORD m_dwDrawAspect;
+ SIZEL m_sizel;
+ BOOL m_fObjectOpen;
+ LPSTORAGE m_lpObjStorage;
+
+ CAdviseSink m_AdviseSink;
+ COleClientSite m_OleClientSite;
+
+ CSimpleDoc FAR * m_lpDoc;
+
+ // IUnknown Interfaces
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ HRESULT InitObject(BOOL fCreateNew);
+ static CSimpleSite FAR * Create(CSimpleDoc FAR *lpDoc);
+ CSimpleSite(CSimpleDoc FAR *lpDoc);
+ ~CSimpleSite();
+ void PaintObj(HDC hDC);
+ void GetObjRect(LPRECT lpRect);
+ void CloseOleObject(void);
+ void UnloadOleObject(void);
+};
+
+#endif // _SITE_H_
diff --git a/private/oleutest/simpdnd/strings.rc b/private/oleutest/simpdnd/strings.rc
new file mode 100644
index 000000000..f3f8c415a
--- /dev/null
+++ b/private/oleutest/simpdnd/strings.rc
@@ -0,0 +1,124 @@
+/*
+ * STRINGS.RC
+ *
+ * strings for the OLE 2.0 UI Support Library.
+ *
+ * Copyright (c)1992 Microsoft Corporation, All Right Reserved
+ */
+
+
+#include "ole2ui.h"
+
+
+//Stringtable common for all dialogs.
+STRINGTABLE
+ BEGIN
+ IDS_FILTERS, "All Files (*.*)|*.*|"
+ IDS_ICONFILTERS, "Icon Files|*.exe;*.dll;*.ico|Programs (*.exe)|*.exe|Libraries (*.dll)|Icons (*.ico)|All Files (*.*)|*.*|"
+ END
+
+// browse dialog
+STRINGTABLE
+ BEGIN
+ IDS_BROWSE "Browse"
+ END
+
+
+//Insert Object stringtable.
+STRINGTABLE
+ BEGIN
+ IDS_IORESULTNEW, "Inserts a new %s object into your document."
+ IDS_IORESULTNEWICON, "Inserts a new %s object into your document. It will be displayed as an icon."
+ IDS_IORESULTFROMFILE1, "Inserts the contents of the file as an object into your document so that you may activate it using the "
+ IDS_IORESULTFROMFILE2, "application which created it."
+ IDS_IORESULTFROMFILEICON2, "application which created it. It will be displayed as an icon."
+ IDS_IORESULTLINKFILE1, "Inserts a picture of the file contents into your document. The picture will be linked to "
+ IDS_IORESULTLINKFILE2, "the file so that changes to the file will be reflected in your document."
+ IDS_IORESULTLINKFILEICON1, "Inserts an icon into your document which represents the file. The icon will be linked to "
+ IDS_IORESULTLINKFILEICON2, "the file so that changes to the file will be reflected in your document."
+ END
+
+//Change Icon stringtable
+STRINGTABLE
+ BEGIN
+ IDS_CINOICONSINFILE, "There are no icons in %s."
+ IDS_CIINVALIDFILE, "File %s does not exist."
+ IDS_CIFILEACCESS, "Unable to open file %s. Access denied."
+ IDS_CIFILESHARE, "Unable to open file %s. Sharing violation."
+ IDS_CIFILEOPENFAIL, "Unable to open file %s. General failure."
+ END
+
+// Convert stringtable.
+STRINGTABLE
+ BEGIN
+ IDS_CVRESULTCONVERTLINK, "A linked object must be converted at the source."
+ IDS_CVRESULTCONVERTTO, "Permanently changes the selected %s object to a %s object."
+ IDS_CVRESULTNOCHANGE, "The selected %s object will not be converted."
+ IDS_CVRESULTDISPLAYASICON, " It will be displayed as an icon."
+ IDS_CVRESULTACTIVATEAS, "Every %s object will be activated as a %s object"
+ IDS_CVRESULTACTIVATEDIFF, ", but it will not be converted."
+ END
+
+//Paste Special stringtable
+STRINGTABLE
+ BEGIN
+ IDS_PSPASTEDATA, "Inserts the contents of the Clipboard into your document as %s."
+ IDS_PSPASTEOBJECT, "Inserts the contents of the Clipboard into your document so that you may activate it using %s."
+ IDS_PSPASTEOBJECTASICON, "Inserts the contents of the Clipboard into your document so that you may activate it using %s. It will be displayed as an icon."
+ IDS_PSPASTELINKDATA, "Inserts the contents of the Clipboard into your document as %s. Paste Link creates a link to the source file so that changes to the source file will be reflected in your document."
+ IDS_PSPASTELINKOBJECT, "Inserts a picture of the Clipboard contents into your document. Paste Link creates a link to the source file so that changes to the source file will be reflected in your document."
+ IDS_PSPASTELINKOBJECTASICON, "Inserts an icon into your document which represents the Clipboard contents. Paste Link creates a link to the source file so that changes to the source file will be reflected in your document."
+ IDS_PSNONOLE, "Inserts the contents of the Clipboard into your document."
+ IDS_PSUNKNOWNTYPE, "Unknown Type"
+ IDS_PSUNKNOWNSRC, "Unknown Source"
+ IDS_PSUNKNOWNAPP, "the application which created it"
+ END
+
+// Busy/Blocked dialog stringtable
+STRINGTABLE
+ BEGIN
+ IDS_BZRESULTTEXTBUSY "This action cannot be completed because the %s application (%s) is busy. Choose ""Switch To"" to activate %s and correct the problem."
+ IDS_BZRESULTTEXTNOTRESPONDING "This action cannot be completed because the %s application (%s) is not responding. Choose ""Switch To"" to activate %s and correct the problem."
+ END
+
+// OLESTD stringtable
+STRINGTABLE
+ BEGIN
+ IDS_OLESTDNOCREATEFILE, "Could not create file!"
+ IDS_OLESTDNOOPENFILE, "Could not open file!"
+ IDS_OLESTDDISKFULL, "Disk full--unable to complete save operation"
+ END
+
+// OLE2UI stringtable
+STRINGTABLE
+ BEGIN
+ IDS_OLE2UIEDITNOOBJCMD, "&Object"
+ IDS_OLE2UIEDITLINKCMD_1VERB, "0%s Linked %s &Object"
+ IDS_OLE2UIEDITOBJECTCMD_1VERB, "0%s %s &Object"
+ IDS_OLE2UIEDITLINKCMD_NVERB, "Linked %s &Object"
+ IDS_OLE2UIEDITOBJECTCMD_NVERB, "%s &Object"
+ IDS_OLE2UIUNKNOWN, "Unknown"
+ IDS_OLE2UILINK, "Link"
+ IDS_OLE2UIOBJECT, "Object"
+ IDS_OLE2UIEDIT, "&Edit"
+ IDS_OLE2UICONVERT, "&Convert..."
+ IDS_DEFICONLABEL, "Document"
+ IDS_OLE2UIPASTELINKEDTYPE, "Linked %s"
+ END
+
+// LINKS stringtable
+STRINGTABLE
+ BEGIN
+ IDS_LINK_AUTO "Automatic"
+ IDS_LINK_MANUAL "Manual"
+ IDS_LINK_UNKNOWN "Unavail"
+ IDS_LINKS "Links"
+ IDS_FAILED "Operation failed!"
+ IDS_CHANGESOURCE "Change Source"
+ IDS_INVALIDSOURCE "Invalid Source : Do you want to correct it?"
+ IDS_CHANGEADDITIONALLINKS "The selected link has been changed.\nThis document contains additional links to\n%s.\n\nChange additional links?"
+ IDS_ERR_GETLINKSOURCE "Fail to get source of the link!"
+ IDS_ERR_GETLINKUPDATEOPTIONS "Fail to get update option of the link!"
+ IDS_ERR_ADDSTRING "Fail to add item to ListBox!"
+ IDS_CLOSE "Close"
+ END
diff --git a/private/oleutest/simpdnd/tests.cpp b/private/oleutest/simpdnd/tests.cpp
new file mode 100644
index 000000000..7119442de
--- /dev/null
+++ b/private/oleutest/simpdnd/tests.cpp
@@ -0,0 +1,198 @@
+//+-------------------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1992 - 1993.
+//
+// File: tests.cpp
+//
+// Contents: Implementations of the Upper Layer unit tests
+//
+// Classes:
+//
+// Functions: StartTest1
+//
+// History: dd-mmm-yy Author Comment
+// 07-Feb-94 alexgo author
+//
+//--------------------------------------------------------------------------
+
+#include "pre.h"
+#include "iocs.h"
+#include "ias.h"
+#include "app.h"
+#include "site.h"
+#include "doc.h"
+#include <testmess.h>
+
+const CLSID CLSID_SimpleServer = {0xbcf6d4a0, 0xbe8c, 0x1068, { 0xb6, 0xd4,
+ 0x00, 0xdd, 0x01, 0x0c, 0x05, 0x09 }};
+
+const CLSID CLSID_Paintbrush = {0x0003000a, 0, 0, { 0xc0, 0,0,0,0,0,0,0x46 }};
+
+//+-------------------------------------------------------------------------
+//
+// Function: StartTest1
+//
+// Synopsis: Starts unit test1, inserting a simple server object into
+// this (simpdnd) container.
+//
+// Effects:
+//
+// Arguments: pApp -- a pointer to the CSimpleApp that we're a part of
+//
+// Requires:
+//
+// Returns:
+//
+// Signals:
+//
+// Modifies:
+//
+// Algorithm:
+//
+// History: dd-mmm-yy Author Comment
+// 07-Feb-94 alexgo author
+//
+// Notes:
+//
+//--------------------------------------------------------------------------
+
+void StartTest1( CSimpleApp *pApp )
+{
+ HRESULT hresult;
+ static FORMATETC formatetc;
+
+ //insert the simple server object
+
+ formatetc.dwAspect = DVASPECT_CONTENT;
+ formatetc.cfFormat = NULL;
+ formatetc.lindex = -1;
+
+ //need to create the client site
+
+ pApp->m_lpDoc->m_lpSite = CSimpleSite::Create(pApp->m_lpDoc);
+
+ hresult = OleCreate(CLSID_SimpleServer, IID_IOleObject,
+ OLERENDER_DRAW, &formatetc,
+ &pApp->m_lpDoc->m_lpSite->m_OleClientSite,
+ pApp->m_lpDoc->m_lpSite->m_lpObjStorage,
+ (void **)&(pApp->m_lpDoc->m_lpSite->m_lpOleObject));
+
+ if( hresult != NOERROR )
+ {
+ goto errRtn;
+ }
+
+ //initialize the object
+
+ hresult = pApp->m_lpDoc->m_lpSite->InitObject(TRUE);
+
+ if( hresult == NOERROR )
+ {
+ //tell it to paint itself, then we'll quit
+ PostMessage(pApp->m_lpDoc->m_hDocWnd, WM_PAINT, 0L, 0L);
+ PostMessage(pApp->m_hDriverWnd, WM_TESTEND, TEST_SUCCESS,
+ (LPARAM)hresult);
+ PostMessage(pApp->m_hAppWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
+ return;
+ }
+
+errRtn:
+ PostMessage(pApp->m_hDriverWnd, WM_TESTEND, TEST_FAILURE,
+ (LPARAM)hresult);
+ PostMessage(pApp->m_hAppWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
+ return;
+}
+
+
+//+-------------------------------------------------------------------------
+//
+// Function: StartTest2
+//
+// Synopsis: Starts unit Test2, inserting a paintbrush object into
+// this (simpdnd) container.
+//
+// Effects:
+//
+// Arguments: pApp -- a pointer to the CSimpleApp that we're a part of
+//
+// Requires:
+//
+// Returns:
+//
+// Signals:
+//
+// Modifies:
+//
+// Algorithm:
+//
+// History: dd-mmm-yy Author Comment
+// 24-May-94 kevinro & alexgo author
+//
+// Notes:
+//
+//--------------------------------------------------------------------------
+
+void StartTest2( CSimpleApp *pApp )
+{
+ HRESULT hresult;
+ static FORMATETC formatetc;
+
+ //insert the simple server object
+
+ formatetc.dwAspect = DVASPECT_CONTENT;
+ formatetc.cfFormat = NULL;
+ formatetc.lindex = -1;
+
+ //need to create the client site
+
+ pApp->m_lpDoc->m_lpSite = CSimpleSite::Create(pApp->m_lpDoc);
+
+ hresult = OleCreate(CLSID_Paintbrush, IID_IOleObject,
+ OLERENDER_DRAW, &formatetc,
+ &pApp->m_lpDoc->m_lpSite->m_OleClientSite,
+ pApp->m_lpDoc->m_lpSite->m_lpObjStorage,
+ (void **)&(pApp->m_lpDoc->m_lpSite->m_lpOleObject));
+
+ if( hresult != NOERROR )
+ {
+ goto errRtn;
+ }
+
+ //initialize the object
+
+ hresult = pApp->m_lpDoc->m_lpSite->InitObject(TRUE);
+
+ //
+ // The DDE layer is going to ignore all of the parameters except
+ // the verb index. The parameters here are mostly dummies.
+ //
+ if (hresult == NOERROR)
+ {
+ hresult = pApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(0,
+ NULL,
+ &(pApp->m_lpDoc->m_lpSite->m_OleClientSite),
+ -1,
+ NULL,
+ NULL);
+ }
+
+ if( hresult == NOERROR )
+ {
+ //tell it to paint itself, then we'll quit
+ PostMessage(pApp->m_lpDoc->m_hDocWnd, WM_PAINT, 0L, 0L);
+ PostMessage(pApp->m_hDriverWnd, WM_TESTEND, TEST_SUCCESS,
+ (LPARAM)hresult);
+ PostMessage(pApp->m_hAppWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
+ return;
+ }
+
+errRtn:
+ PostMessage(pApp->m_hDriverWnd, WM_TESTEND, TEST_FAILURE,
+ (LPARAM)hresult);
+ PostMessage(pApp->m_hAppWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
+ return;
+}
+
+
+
diff --git a/private/oleutest/simpdnd/tests.h b/private/oleutest/simpdnd/tests.h
new file mode 100644
index 000000000..30d3b1baa
--- /dev/null
+++ b/private/oleutest/simpdnd/tests.h
@@ -0,0 +1,27 @@
+//+-------------------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1992 - 1993.
+//
+// File: tests.h
+//
+// Contents: Declarations for the unit test functions
+//
+// Classes:
+//
+// Functions:
+//
+// History: dd-mmm-yy Author Comment
+// 07-Feb-94 alexgo author
+//
+//--------------------------------------------------------------------------
+
+#ifndef __TESTS_H
+#define __TESTS_H
+
+void StartTest1(CSimpleApp *);
+void StartTest2(CSimpleApp *);
+
+#endif
+
+