summaryrefslogtreecommitdiffstats
path: root/private/oleutest/utests16
diff options
context:
space:
mode:
Diffstat (limited to 'private/oleutest/utests16')
-rw-r--r--private/oleutest/utests16/makefile.inc330
-rw-r--r--private/oleutest/utests16/ole2ui/ole2ui.h918
-rw-r--r--private/oleutest/utests16/ole2ui/ole2ui.rc40
-rw-r--r--private/oleutest/utests16/ole2ui/res/localole.h1001
-rw-r--r--private/oleutest/utests16/ole2ui/res/ole2ui.rcv90
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/bang.icobin0 -> 1846 bytes
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/busy.dlg13
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/convert.dlg32
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/default.icobin0 -> 766 bytes
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/egares.bmpbin0 -> 6838 bytes
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/fileopen.dlg33
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/hivgares.bmpbin0 -> 20326 bytes
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/icon.dlg48
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/insobj.dlg52
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/links.dlg35
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/pastespl.dlg40
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/prompt.dlg80
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/strings.rc124
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/verlocal.h54
-rw-r--r--private/oleutest/utests16/ole2ui/res/usa/vgares.bmpbin0 -> 9078 bytes
-rw-r--r--private/oleutest/utests16/ole2ui/strings.rc124
-rw-r--r--private/oleutest/utests16/simpdnd/app.cpp710
-rw-r--r--private/oleutest/utests16/simpdnd/app.h63
-rw-r--r--private/oleutest/utests16/simpdnd/doc.cpp722
-rw-r--r--private/oleutest/utests16/simpdnd/doc.h70
-rw-r--r--private/oleutest/utests16/simpdnd/dxferobj.cpp574
-rw-r--r--private/oleutest/utests16/simpdnd/dxferobj.h57
-rw-r--r--private/oleutest/utests16/simpdnd/ias.cpp316
-rw-r--r--private/oleutest/utests16/simpdnd/ias.h44
-rw-r--r--private/oleutest/utests16/simpdnd/ids.cpp330
-rw-r--r--private/oleutest/utests16/simpdnd/ids.h43
-rw-r--r--private/oleutest/utests16/simpdnd/idt.cpp814
-rw-r--r--private/oleutest/utests16/simpdnd/idt.h77
-rw-r--r--private/oleutest/utests16/simpdnd/iocs.cpp365
-rw-r--r--private/oleutest/utests16/simpdnd/iocs.h44
-rw-r--r--private/oleutest/utests16/simpdnd/makefile94
-rw-r--r--private/oleutest/utests16/simpdnd/pre.cpp9
-rw-r--r--private/oleutest/utests16/simpdnd/pre.h23
-rw-r--r--private/oleutest/utests16/simpdnd/readme.txt5
-rw-r--r--private/oleutest/utests16/simpdnd/resource.h29
-rw-r--r--private/oleutest/utests16/simpdnd/simpdnd.cpp452
-rw-r--r--private/oleutest/utests16/simpdnd/simpdnd.h15
-rw-r--r--private/oleutest/utests16/simpdnd/simpdnd.icobin0 -> 766 bytes
-rw-r--r--private/oleutest/utests16/simpdnd/site.cpp627
-rw-r--r--private/oleutest/utests16/simpdnd/site.h47
-rw-r--r--private/oleutest/utests16/simpdnd/spdnd16.def22
-rw-r--r--private/oleutest/utests16/simpdnd/spdnd16.rc105
-rw-r--r--private/oleutest/utests16/simpdnd/tests.cpp202
-rw-r--r--private/oleutest/utests16/simpdnd/tests.h27
-rw-r--r--private/oleutest/utests16/simpsvr/app.cpp810
-rw-r--r--private/oleutest/utests16/simpsvr/app.h85
-rw-r--r--private/oleutest/utests16/simpsvr/doc.cpp693
-rw-r--r--private/oleutest/utests16/simpsvr/doc.h65
-rw-r--r--private/oleutest/utests16/simpsvr/icf.cpp235
-rw-r--r--private/oleutest/utests16/simpsvr/icf.h45
-rw-r--r--private/oleutest/utests16/simpsvr/ido.cpp544
-rw-r--r--private/oleutest/utests16/simpsvr/ido.h53
-rw-r--r--private/oleutest/utests16/simpsvr/iec.cpp212
-rw-r--r--private/oleutest/utests16/simpsvr/iec.h44
-rw-r--r--private/oleutest/utests16/simpsvr/ioipao.cpp400
-rw-r--r--private/oleutest/utests16/simpsvr/ioipao.h50
-rw-r--r--private/oleutest/utests16/simpsvr/ioipo.cpp413
-rw-r--r--private/oleutest/utests16/simpsvr/ioipo.h45
-rw-r--r--private/oleutest/utests16/simpsvr/ioo.cpp1082
-rw-r--r--private/oleutest/utests16/simpsvr/ioo.h73
-rw-r--r--private/oleutest/utests16/simpsvr/ips.cpp651
-rw-r--r--private/oleutest/utests16/simpsvr/ips.h53
-rw-r--r--private/oleutest/utests16/simpsvr/makefile98
-rw-r--r--private/oleutest/utests16/simpsvr/obj.cpp1057
-rw-r--r--private/oleutest/utests16/simpsvr/obj.h141
-rw-r--r--private/oleutest/utests16/simpsvr/pre.cpp9
-rw-r--r--private/oleutest/utests16/simpsvr/pre.h22
-rw-r--r--private/oleutest/utests16/simpsvr/readme.txt7
-rw-r--r--private/oleutest/utests16/simpsvr/resource.h32
-rw-r--r--private/oleutest/utests16/simpsvr/simpsvr.cpp357
-rw-r--r--private/oleutest/utests16/simpsvr/simpsvr.h16
-rw-r--r--private/oleutest/utests16/simpsvr/simpsvr.icobin0 -> 766 bytes
-rw-r--r--private/oleutest/utests16/simpsvr/simpsvr.reg21
-rw-r--r--private/oleutest/utests16/simpsvr/spsvr16.def22
-rw-r--r--private/oleutest/utests16/simpsvr/spsvr16.rc107
80 files changed, 16342 insertions, 0 deletions
diff --git a/private/oleutest/utests16/makefile.inc b/private/oleutest/utests16/makefile.inc
new file mode 100644
index 000000000..daaf0ac61
--- /dev/null
+++ b/private/oleutest/utests16/makefile.inc
@@ -0,0 +1,330 @@
+# 16-bit makefile
+#
+# Copyright (c) 1991, Microsoft Corporation
+#
+# History:
+#
+# 18-Feb-1994 KevinRo
+# 24-Feb-1994 DrewB, added OBJDIR and some other niceties from win40.mk
+#
+
+.SUFFIXES:
+.SUFFIXES: .c .cxx .cpp .asm .h .inc .obj .lst
+.SUFFIXES: .sys .exe .com .map .sym .def .lib .rc .res
+
+!if "$(TARGET)" == ""
+!error TARGET must be defined
+!endif
+
+OUTNUL= 1>nul 2>nul
+
+!if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
+OBJDIR = objd
+!else
+OBJDIR = objr
+!endif
+
+# Build up lists of files to produce from sources
+
+!if "$(CFILES)" != ""
+OBJFILES = $(OBJFILES) $(CFILES:.c=.obj)
+!endif
+!if "$(CXXFILES)" != ""
+OBJFILES = $(OBJFILES) $(CXXFILES:.cxx=.obj)
+!endif
+!if "$(CPPFILES)" != ""
+OBJFILES = $(OBJFILES) $(CPPFILES:.cpp=.obj)
+!endif
+
+!if "$(ASMFILES)" != ""
+OBJFILES = $(OBJFILES) $(ASMFILES:.asm=.obj)
+!endif
+
+!if "$(RCFILES)" != ""
+RESFILES = $(RCFILES:.rc=.res)
+!endif
+
+# Replace .\ with $(OBJDIR)
+# Unfortunately we can't do this directly so we have to explicitly check
+# the value of OBJDIR
+
+!if "$(OBJDIR)" == "objd"
+OBJFILES = $(OBJFILES:.\=objd\)
+RESFILES = $(RESFILES:.\=objd\)
+
+!elseif "$(OBJDIR)" == "objr"
+OBJFILES = $(OBJFILES:.\=objr\)
+RESFILES = $(RESFILES:.\=objr\)
+
+!else
+!error Unknown OBJDIR: $(OBJDIR)
+!endif
+
+# Default target
+
+all: $(OBJDIR)\$(TARGET)
+
+# Determine target type and base name
+
+# Is it a DLL?
+TARGETBASE=$(TARGET:.dll=)
+!if "$(TARGETBASE)" != "$(TARGET)"
+TARGETTYPE=dll
+!else
+
+# Is it an EXE?
+TARGETBASE=$(TARGET:.exe=)
+! if "$(TARGETBASE)" != "$(TARGET)"
+TARGETTYPE=exe
+! else
+
+# Is it a LIB?
+TARGETBASE=$(TARGET:.lib=)
+! if "$(TARGETBASE)" != "$(TARGET)"
+TARGETTYPE=lib
+! endif
+! endif
+!endif
+
+!if "$(TARGETTYPE)" == ""
+!error Unknown target type for "$(TARGET)"
+!endif
+
+!if "$(BUILDDETAILS)" != ""
+BLDKEEP= KEEP
+!endif
+
+OLETHUNK= $(_NTDRIVE)$(_NTROOT)\private\ole32\olethunk
+OLE16= $(OLETHUNK)\ole16
+
+RCINC = $(RCINC) -i$(OLE16)\inc
+INCS = -I$(OLE16)\inc -I$(OLETHUNK)\h -I$(_NTDRIVE)$(_NTROOT)\private\cinc
+
+
+PATH = $(OLE16)\tools;$(PATH)
+LINK = link16
+RC = rc16
+CL = cl16
+IMPLIB = implib
+LIBUTIL = lib16
+MAPSYM = mapsym
+MASM = masm
+
+DEFINES = -DWOW
+
+AOBJ = -Mx -t $(DEFINES) $(INCS)
+
+!if "$(TARGETTYPE)" == "exe"
+CW16 = -GA
+!else
+CW16 = -GD
+DEFINES = $(DEFINES) -D_WINDLL
+!endif
+
+CW16 = $(CW16) -G2 -AL $(DEFINES) $(INCS) /NMSEG_CODE
+
+LFLAGS = $(LFLAGS) /nod /noe /map:0 /align:16
+
+!if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
+
+DEFINES = $(DEFINES) -DDBG=1 -DDEVL=1
+
+!if "$(NTDEBUGTYPE)" == "windbg"
+AOBJ = $(AOBJ) -Zi
+CW16 = $(CW16) /Odi /Zip /FA
+LFLAGS = $(LFLAGS) /CO
+!else
+AOBJ = $(AOBJ) -Zd
+CW16 = $(CW16) /Odi /Zd
+LFLAGS = $(LFLAGS) /LI
+!endif
+
+!else
+CW16 = $(CW16) /Os /Zp /Gs
+DEFINES = $(DEFINES) -DDBG=0 -DDEVL=1
+!endif
+
+!if "$(TARGETTYPE)" == "dll"
+W16LIBS = $(OLE16)\lib\ldllcew.lib
+!else
+!if "$(QUICKWINDOWS)" != ""
+W16LIBS = $(OLE16)\lib\llibcewq.lib
+!else
+W16LIBS = $(OLE16)\lib\llibcew.lib
+!endif
+!endif
+
+W16LIBS = $(W16LIBS) $(OLE16)\lib\libw.lib
+
+!if "$(TARGETTYPE)" == "dll" || "$(TARGETTYPE)" == "exe"
+LIBS = $(LIBS) $(W16LIBS)
+!endif
+
+.asm{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(MASM) $(AOBJ) $*,$*;
+
+.asm.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(MASM) $(AOBJ) -l $*,nul,$*.lst;
+
+
+.c{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$*.rsp
+$(CW16: =
+)
+-Fo$*.obj
+$<
+<<$(BLDKEEP)
+
+.c.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
+$(CW16: =
+)
+-Fonul
+-Fc$*.lst
+$<
+<<$(BLDKEEP)
+
+.cxx{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$*.rsp
+$(CW16: =
+)
+-Fo$*.obj
+-Tp$<
+<<$(BLDKEEP)
+
+.cxx.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
+$(CW16: =
+)
+-Fc$*.lst
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+.cxx.pp:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp > $*.pp
+$(CW16: =
+)
+-E
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+
+.cpp{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$*.rsp
+$(CW16: =
+)
+-Fo$*.obj
+-Tp$<
+<<$(BLDKEEP)
+
+.cpp.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
+$(CW16: =
+)
+-Fc$*.lst
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+.cpp.pp:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp > $*.pp
+$(CW16: =
+)
+-E
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+
+.def{$(OBJDIR)}.lib:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(IMPLIB) $*.lib $<
+
+{$(OBJDIR)}.map{$(OBJDIR)}.sym:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(MAPSYM) $<
+
+.rc{$(OBJDIR)}.res:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(RC) -r $(RCINC) -fo $*.res $<
+
+
+cleanup:
+ if exist $(OBJDIR)\*.lrf del $(OBJDIR)\*.lrf
+ if exist $(OBJDIR)\*.obj del $(OBJDIR)\*.obj
+ if exist $(OBJDIR)\*.exe del $(OBJDIR)\*.exe
+ if exist $(OBJDIR)\*.map del $(OBJDIR)\*.map
+ if exist $(OBJDIR)\*.sym del $(OBJDIR)\*.sym
+ if exist $(OBJDIR)\*.res del $(OBJDIR)\*.res
+
+clean: cleanup
+
+!if "$(TARGETTYPE)" == "dll"
+
+$(OBJDIR)\$(TARGETBASE).lib: $(TARGETBASE).def
+
+$(OBJDIR)\$(TARGET) $(OBJDIR)\$(TARGETBASE).map: $(OBJFILES) $(RESFILES) \
+ $(TARGETBASE).def $(OBJDIR)\$(TARGETBASE).lib $(LIBS)
+ @-md $(OBJDIR) $(OUTNUL)
+ $(LINK) $(LFLAGS) @<<$(OBJDIR)\$(TARGETBASE).rsp
+$(OBJFILES: =+^
+)
+$(OBJDIR)\$(TARGET)
+$(OBJDIR)\$(TARGETBASE).map
+$(LIBS: =+^
+)
+$(TARGETBASE).def
+<<$(BLDKEEP)
+ $(MAPSYM) -o $(OBJDIR)\$(TARGETBASE).sym $(OBJDIR)\$(TARGETBASE).map
+!if "$(RCFILES)" != ""
+ $(RC) -t $(OBJDIR)\$(TARGETBASE).res $(OBJDIR)\$(TARGET)
+!endif
+
+!elseif "$(TARGETTYPE)" == "lib"
+
+$(OBJDIR)\$(TARGET): $(OBJFILES) $(LIBS)
+ @-md $(OBJDIR) $(OUTNUL)
+ -del $@ $(OUTNUL)
+ $(LIBUTIL) @<<$*.lnb
+$(OBJDIR)\$(TARGET)
+y
+$(OBJFILES: = &^
+)&
+$(LIBS: = &^
+)&
+
+$*.lls
+<<$(BLDKEEP)
+
+!elseif "$(TARGETTYPE)" == "exe"
+
+$(OBJDIR)\$(TARGET) $(OBJDIR)\$(TARGETBASE).map: $(OBJFILES) $(RESFILES) \
+ $(TARGETBASE).def $(LIBS)
+ @-md $(OBJDIR) $(OUTNUL)
+ $(LINK) $(LFLAGS) @<<$(OBJDIR)\$(TARGETBASE).rsp
+$(OBJFILES: =+^
+)
+$(OBJDIR)\$(TARGET)
+$(OBJDIR)\$(TARGETBASE).map
+$(LIBS: =+^
+)
+$(TARGETBASE).def
+<<$(BLDKEEP)
+!if "$(RCFILES)" != ""
+ $(RC) -t $(OBJDIR)\$(TARGETBASE).res $(OBJDIR)\$(TARGET)
+!endif
+ $(MAPSYM) -o $(OBJDIR)\$(TARGETBASE).sym $(OBJDIR)\$(TARGETBASE).map
+
+!endif
diff --git a/private/oleutest/utests16/ole2ui/ole2ui.h b/private/oleutest/utests16/ole2ui/ole2ui.h
new file mode 100644
index 000000000..4691c005b
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/ole2ui.h
@@ -0,0 +1,918 @@
+/*
+ * OLE2UI.H
+ *
+ * Published definitions, structures, types, and function prototypes for the
+ * OLE 2.0 User Interface support library.
+ *
+ * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
+ */
+
+/* NOTE: All dialog and string resource ID's defined in this file are
+ * in the range:
+ * 32248 - 32504 (0x7DF8 - 0x7EF8)
+*/
+
+
+#ifndef _OLE2UI_H_
+#define _OLE2UI_H_
+
+#ifndef RC_INVOKED
+#pragma message ("Including OLE2UI.H from " __FILE__)
+#endif //RC_INVOKED
+
+#ifdef WIN32
+#define _INC_OLE
+#define __RPC_H__
+#endif
+
+#if !defined(__cplusplus) && !defined( __TURBOC__)
+#define NONAMELESSUNION // use strict ANSI standard (for DVOBJ.H)
+#endif
+
+#include <windows.h>
+#include <shellapi.h>
+#include <ole2.h>
+#include <string.h>
+#include <dlgs.h> //For fileopen dlg; standard include
+#include "olestd.h"
+
+#ifdef __TURBOC__
+#define _getcwd getcwd
+#define _itoa itoa
+#define __max max
+#define _find_t find_t
+#endif // __TURBOC__
+
+#ifdef WIN32
+#define _fmemset memset
+#define _fmemcpy memcpy
+#define _fmemcmp memcmp
+#define _fstrcpy strcpy
+#define _fstrlen strlen
+#define _fstrrchr strrchr
+#define _fstrtok strtok
+#define lstrcpyn strncpy
+
+// BUGBUG32: isspace function does not seem to work properly
+#undef isspace
+#define isspace(j) (j==' ' || j=='\t' || j=='\n')
+#endif // WIN32
+
+#if !defined( EXPORT )
+#ifdef WIN32
+#define EXPORT
+#else
+#define EXPORT __export
+#endif // WIN32
+#endif // !EXPORT
+
+/*
+ * Initialization / Uninitialization routines. OleUIInitialize
+ * must be called prior to using any functions in OLE2UI, and OleUIUnInitialize
+ * must be called before you app shuts down and when you are done using the
+ * library.
+ *
+ * NOTE: If you are using the DLL version of this library, these functions
+ * are automatically called in the DLL's LibMain and WEP, so you should
+ * not call them directly from your application.
+ */
+
+// Backward compatibility with older library
+#define OleUIUninitialize OleUIUnInitialize
+
+STDAPI_(BOOL) OleUIInitialize(HINSTANCE hInstance, HINSTANCE hPrevInst);
+STDAPI_(BOOL) OleUIUninitialize(void);
+
+#if !defined( SZCLASSICONBOX )
+#define SZCLASSICONBOX "ole2uiIBCls"
+#endif
+
+#if !defined( SZCLASSRESULTIMAGE )
+#define SZCLASSRESULTIMAGE "ole2uiRICls"
+#endif
+
+// object count, used to support DllCanUnloadNow and OleUICanUnloadNow
+extern DWORD g_dwObjectCount;
+
+STDAPI OleUICanUnloadNow(void);
+STDAPI OleUILockLibrary(BOOL fLock);
+
+
+//Dialog Identifiers as passed in Help messages to identify the source.
+#define IDD_INSERTOBJECT 32248
+#define IDD_CHANGEICON 32249
+#define IDD_CONVERT 32250
+#define IDD_PASTESPECIAL 32251
+#define IDD_EDITLINKS 32252
+#define IDD_FILEOPEN 32253
+#define IDD_BUSY 32254
+#define IDD_UPDATELINKS 32255
+#define IDD_CANNOTUPDATELINK 32256
+#define IDD_CHANGESOURCE 32257
+#define IDD_INSERTFILEBROWSE 32258
+#define IDD_CHANGEICONBROWSE 32259
+
+// The following Dialogs are message dialogs used by OleUIPromptUser API
+#define IDD_LINKSOURCEUNAVAILABLE 32260
+#define IDD_SERVERNOTREG 32261
+#define IDD_LINKTYPECHANGED 32262
+#define IDD_SERVERNOTFOUND 32263
+#define IDD_OUTOFMEMORY 32264
+
+// Stringtable identifers
+#define IDS_OLE2UIUNKNOWN 32300
+#define IDS_OLE2UILINK 32301
+#define IDS_OLE2UIOBJECT 32302
+#define IDS_OLE2UIEDIT 32303
+#define IDS_OLE2UICONVERT 32304
+#define IDS_OLE2UIEDITLINKCMD_1VERB 32305
+#define IDS_OLE2UIEDITOBJECTCMD_1VERB 32306
+#define IDS_OLE2UIEDITLINKCMD_NVERB 32307
+#define IDS_OLE2UIEDITOBJECTCMD_NVERB 32308
+#define IDS_OLE2UIEDITNOOBJCMD 32309
+// def. icon label (usu. "Document")
+#define IDS_DEFICONLABEL 32310
+#define IDS_OLE2UIPASTELINKEDTYPE 32311
+
+
+#define IDS_FILTERS 32320
+#define IDS_ICONFILTERS 32321
+#define IDS_BROWSE 32322
+
+//Resource identifiers for bitmaps
+#define IDB_RESULTSEGA 32325
+#define IDB_RESULTSVGA 32326
+#define IDB_RESULTSHIRESVGA 32327
+
+
+//Missing from windows.h
+#ifndef PVOID
+typedef VOID *PVOID;
+#endif
+
+
+//Hook type used in all structures.
+typedef UINT (CALLBACK *LPFNOLEUIHOOK)(HWND, UINT, WPARAM, LPARAM);
+
+
+//Strings for registered messages
+#define SZOLEUI_MSG_HELP "OLEUI_MSG_HELP"
+#define SZOLEUI_MSG_ENDDIALOG "OLEUI_MSG_ENDDIALOG"
+#define SZOLEUI_MSG_BROWSE "OLEUI_MSG_BROWSE"
+#define SZOLEUI_MSG_CHANGEICON "OLEUI_MSG_CHANGEICON"
+#define SZOLEUI_MSG_CLOSEBUSYDIALOG "OLEUI_MSG_CLOSEBUSYDIALOG"
+#define SZOLEUI_MSG_FILEOKSTRING "OLEUI_MSG_FILEOKSTRING"
+
+//Standard error definitions
+#define OLEUI_FALSE 0
+#define OLEUI_SUCCESS 1 //No error, same as OLEUI_OK
+#define OLEUI_OK 1 //OK button pressed
+#define OLEUI_CANCEL 2 //Cancel button pressed
+
+#define OLEUI_ERR_STANDARDMIN 100
+#define OLEUI_ERR_STRUCTURENULL 101 //Standard field validation
+#define OLEUI_ERR_STRUCTUREINVALID 102
+#define OLEUI_ERR_CBSTRUCTINCORRECT 103
+#define OLEUI_ERR_HWNDOWNERINVALID 104
+#define OLEUI_ERR_LPSZCAPTIONINVALID 105
+#define OLEUI_ERR_LPFNHOOKINVALID 106
+#define OLEUI_ERR_HINSTANCEINVALID 107
+#define OLEUI_ERR_LPSZTEMPLATEINVALID 108
+#define OLEUI_ERR_HRESOURCEINVALID 109
+
+#define OLEUI_ERR_FINDTEMPLATEFAILURE 110 //Initialization errors
+#define OLEUI_ERR_LOADTEMPLATEFAILURE 111
+#define OLEUI_ERR_DIALOGFAILURE 112
+#define OLEUI_ERR_LOCALMEMALLOC 113
+#define OLEUI_ERR_GLOBALMEMALLOC 114
+#define OLEUI_ERR_LOADSTRING 115
+
+#define OLEUI_ERR_STANDARDMAX 116 //Start here for specific errors.
+
+
+
+//Help Button Identifier
+#define ID_OLEUIHELP 99
+
+// Help button for fileopen.dlg (need this for resizing) 1038 is pshHelp
+#define IDHELP 1038
+
+// Static text control (use this instead of -1 so things work correctly for
+// localization
+#define ID_STATIC 98
+
+//Maximum key size we read from the RegDB.
+#define OLEUI_CCHKEYMAX 256 // make any changes to this in geticon.c too
+
+//Maximum verb length and length of Object menu
+#define OLEUI_CCHVERBMAX 32
+#define OLEUI_OBJECTMENUMAX 256
+
+//Maximum MS-DOS pathname.
+#define OLEUI_CCHPATHMAX 256 // make any changes to this in geticon.c too
+#define OLEUI_CCHFILEMAX 13
+
+//Icon label length
+#define OLEUI_CCHLABELMAX 40 // make any changes to this in geticon.c too
+
+//Length of the CLSID string
+#define OLEUI_CCHCLSIDSTRING 39
+
+
+/*
+ * What follows here are first function prototypes for general utility
+ * functions, then sections laid out by dialog. Each dialog section
+ * defines the dialog structure, the API prototype, flags for the dwFlags
+ * field, the dialog-specific error values, and dialog control IDs (for
+ * hooks and custom templates.
+ */
+
+
+//Miscellaneous utility functions.
+STDAPI_(BOOL) OleUIAddVerbMenu(LPOLEOBJECT lpOleObj,
+ LPSTR lpszShortType,
+ HMENU hMenu,
+ UINT uPos,
+ UINT uIDVerbMin,
+ UINT uIDVerbMax,
+ BOOL bAddConvert,
+ UINT idConvert,
+ HMENU FAR *lphMenu);
+
+//Metafile utility functions
+STDAPI_(HGLOBAL) OleUIMetafilePictFromIconAndLabel(HICON, LPSTR, LPSTR, UINT);
+STDAPI_(void) OleUIMetafilePictIconFree(HGLOBAL);
+STDAPI_(BOOL) OleUIMetafilePictIconDraw(HDC, LPRECT, HGLOBAL, BOOL);
+STDAPI_(UINT) OleUIMetafilePictExtractLabel(HGLOBAL, LPSTR, UINT, LPDWORD);
+STDAPI_(HICON) OleUIMetafilePictExtractIcon(HGLOBAL);
+STDAPI_(BOOL) OleUIMetafilePictExtractIconSource(HGLOBAL,LPSTR,UINT FAR *);
+
+
+
+
+
+/*************************************************************************
+** INSERT OBJECT DIALOG
+*************************************************************************/
+
+
+typedef struct tagOLEUIINSERTOBJECT
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUIINSERTOBJECT. All are IN-OUT unless otherwise spec.
+ CLSID clsid; //Return space for class ID
+ LPSTR lpszFile; //Filename for inserts or links
+ UINT cchFile; //Size of lpszFile buffer: OLEUI_CCHPATHMAX
+ UINT cClsidExclude; //IN only: CLSIDs in lpClsidExclude
+ LPCLSID lpClsidExclude; //List of CLSIDs to exclude from listing.
+
+ //Specific to create objects if flags say so
+ IID iid; //Requested interface on creation.
+ DWORD oleRender; //Rendering option
+ LPFORMATETC lpFormatEtc; //Desired format
+ LPOLECLIENTSITE lpIOleClientSite; //Site to be use for the object.
+ LPSTORAGE lpIStorage; //Storage used for the object
+ LPVOID FAR *ppvObj; //Where the object is returned.
+ SCODE sc; //Result of creation calls.
+ HGLOBAL hMetaPict; //OUT: METAFILEPICT containing iconic aspect.
+ //IFF we couldn't stuff it in the cache.
+ } OLEUIINSERTOBJECT, *POLEUIINSERTOBJECT, FAR *LPOLEUIINSERTOBJECT;
+
+//API prototype
+STDAPI_(UINT) OleUIInsertObject(LPOLEUIINSERTOBJECT);
+
+
+//Insert Object flags
+#define IOF_SHOWHELP 0x00000001L
+#define IOF_SELECTCREATENEW 0x00000002L
+#define IOF_SELECTCREATEFROMFILE 0x00000004L
+#define IOF_CHECKLINK 0x00000008L
+#define IOF_CHECKDISPLAYASICON 0x00000010L
+#define IOF_CREATENEWOBJECT 0x00000020L
+#define IOF_CREATEFILEOBJECT 0x00000040L
+#define IOF_CREATELINKOBJECT 0x00000080L
+#define IOF_DISABLELINK 0x00000100L
+#define IOF_VERIFYSERVERSEXIST 0x00000200L
+#define IOF_DISABLEDISPLAYASICON 0x00000400L
+
+
+//Insert Object specific error codes
+#define OLEUI_IOERR_LPSZFILEINVALID (OLEUI_ERR_STANDARDMAX+0)
+#define OLEUI_IOERR_LPSZLABELINVALID (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_IOERR_HICONINVALID (OLEUI_ERR_STANDARDMAX+2)
+#define OLEUI_IOERR_LPFORMATETCINVALID (OLEUI_ERR_STANDARDMAX+3)
+#define OLEUI_IOERR_PPVOBJINVALID (OLEUI_ERR_STANDARDMAX+4)
+#define OLEUI_IOERR_LPIOLECLIENTSITEINVALID (OLEUI_ERR_STANDARDMAX+5)
+#define OLEUI_IOERR_LPISTORAGEINVALID (OLEUI_ERR_STANDARDMAX+6)
+#define OLEUI_IOERR_SCODEHASERROR (OLEUI_ERR_STANDARDMAX+7)
+#define OLEUI_IOERR_LPCLSIDEXCLUDEINVALID (OLEUI_ERR_STANDARDMAX+8)
+#define OLEUI_IOERR_CCHFILEINVALID (OLEUI_ERR_STANDARDMAX+9)
+
+
+//Insert Object Dialog identifiers
+#define ID_IO_CREATENEW 2100
+#define ID_IO_CREATEFROMFILE 2101
+#define ID_IO_LINKFILE 2102
+#define ID_IO_OBJECTTYPELIST 2103
+#define ID_IO_DISPLAYASICON 2104
+#define ID_IO_CHANGEICON 2105
+#define ID_IO_FILE 2106
+#define ID_IO_FILEDISPLAY 2107
+#define ID_IO_RESULTIMAGE 2108
+#define ID_IO_RESULTTEXT 2109
+#define ID_IO_ICONDISPLAY 2110
+#define ID_IO_OBJECTTYPETEXT 2111
+#define ID_IO_FILETEXT 2112
+#define ID_IO_FILETYPE 2113
+
+// Strings in OLE2UI resources
+#define IDS_IORESULTNEW 32400
+#define IDS_IORESULTNEWICON 32401
+#define IDS_IORESULTFROMFILE1 32402
+#define IDS_IORESULTFROMFILE2 32403
+#define IDS_IORESULTFROMFILEICON2 32404
+#define IDS_IORESULTLINKFILE1 32405
+#define IDS_IORESULTLINKFILE2 32406
+#define IDS_IORESULTLINKFILEICON1 32407
+#define IDS_IORESULTLINKFILEICON2 32408
+
+/*************************************************************************
+** PASTE SPECIAL DIALOG
+*************************************************************************/
+
+// Maximum number of link types
+#define PS_MAXLINKTYPES 8
+
+//NOTE: OLEUIPASTEENTRY and OLEUIPASTEFLAG structs are defined in OLESTD.H
+
+typedef struct tagOLEUIPASTESPECIAL
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUIPASTESPECIAL.
+
+ //IN fields
+ LPDATAOBJECT lpSrcDataObj; //Source IDataObject* (on the
+ // clipboard) for data to paste
+
+ LPOLEUIPASTEENTRY arrPasteEntries; //OLEUIPASTEENTRY array which
+ // specifies acceptable formats. See
+ // OLEUIPASTEENTRY for more info.
+ int cPasteEntries; //No. of OLEUIPASTEENTRY array entries
+
+ UINT FAR *arrLinkTypes; //List of link types that are
+ // acceptable. Link types are referred
+ // to using OLEUIPASTEFLAGS in
+ // arrPasteEntries
+ int cLinkTypes; //Number of link types
+ UINT cClsidExclude; //Number of CLSIDs in lpClsidExclude
+ LPCLSID lpClsidExclude; //List of CLSIDs to exclude from list.
+
+ //OUT fields
+ int nSelectedIndex; //Index of arrPasteEntries[] that the
+ // user selected
+ BOOL fLink; //Indicates if Paste or Paste Link was
+ // selected by the user
+ HGLOBAL hMetaPict; //Handle to Metafile containing icon
+ // and icon title selected by the user
+ // Use the Metafile utility functions
+ // defined in this header to
+ // manipulate hMetaPict
+ SIZEL sizel; // size of object/link in its source
+ // if the display aspect chosen by
+ // the user matches the aspect
+ // displayed in the source. if
+ // different aspect is chosen then
+ // sizel.cx=sizel.cy=0 is returned.
+ // sizel displayed in source is
+ // retrieved from the
+ // ObjectDescriptor if fLink is FALSE
+ // LinkSrcDescriptor if fLink is TRUE
+ } OLEUIPASTESPECIAL, *POLEUIPASTESPECIAL, FAR *LPOLEUIPASTESPECIAL;
+
+
+//API to bring up PasteSpecial dialog
+STDAPI_(UINT) OleUIPasteSpecial(LPOLEUIPASTESPECIAL);
+
+
+//Paste Special flags
+// Show Help button. IN flag.
+#define PSF_SHOWHELP 0x00000001L
+
+//Select Paste radio button at dialog startup. This is the default if
+// PSF_SELECTPASTE or PSF_SELECTPASTELINK are not specified. Also specifies
+// state of button on dialog termination. IN/OUT flag.
+#define PSF_SELECTPASTE 0x00000002L
+
+//Select PasteLink radio button at dialog startup. Also specifies state of
+// button on dialog termination. IN/OUT flag.
+#define PSF_SELECTPASTELINK 0x00000004L
+
+//Specfies if DisplayAsIcon button was checked on dialog termination. OUT flag
+#define PSF_CHECKDISPLAYASICON 0x00000008L
+#define PSF_DISABLEDISPLAYASICON 0x00000010L
+
+
+//Paste Special specific error codes
+#define OLEUI_IOERR_SRCDATAOBJECTINVALID (OLEUI_ERR_STANDARDMAX+0)
+#define OLEUI_IOERR_ARRPASTEENTRIESINVALID (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_IOERR_ARRLINKTYPESINVALID (OLEUI_ERR_STANDARDMAX+2)
+#define OLEUI_PSERR_CLIPBOARDCHANGED (OLEUI_ERR_STANDARDMAX+3)
+
+//Paste Special Dialog identifiers
+#define ID_PS_PASTE 500
+#define ID_PS_PASTELINK 501
+#define ID_PS_SOURCETEXT 502
+#define ID_PS_PASTELIST 503
+#define ID_PS_PASTELINKLIST 504
+#define ID_PS_DISPLAYLIST 505
+#define ID_PS_DISPLAYASICON 506
+#define ID_PS_ICONDISPLAY 507
+#define ID_PS_CHANGEICON 508
+#define ID_PS_RESULTIMAGE 509
+#define ID_PS_RESULTTEXT 510
+#define ID_PS_RESULTGROUP 511
+#define ID_PS_STXSOURCE 512
+#define ID_PS_STXAS 513
+
+// Paste Special String IDs
+#define IDS_PSPASTEDATA 32410
+#define IDS_PSPASTEOBJECT 32411
+#define IDS_PSPASTEOBJECTASICON 32412
+#define IDS_PSPASTELINKDATA 32413
+#define IDS_PSPASTELINKOBJECT 32414
+#define IDS_PSPASTELINKOBJECTASICON 32415
+#define IDS_PSNONOLE 32416
+#define IDS_PSUNKNOWNTYPE 32417
+#define IDS_PSUNKNOWNSRC 32418
+#define IDS_PSUNKNOWNAPP 32419
+
+
+/*************************************************************************
+** EDIT LINKS DIALOG
+*************************************************************************/
+
+
+
+/* IOleUILinkContainer Interface
+** -----------------------------
+** This interface must be implemented by container applications that
+** want to use the EditLinks dialog. the EditLinks dialog calls back
+** to the container app to perform the OLE functions to manipulate
+** the links within the container.
+*/
+
+#define LPOLEUILINKCONTAINER IOleUILinkContainer FAR*
+
+#undef INTERFACE
+#define INTERFACE IOleUILinkContainer
+
+DECLARE_INTERFACE_(IOleUILinkContainer, IUnknown)
+{
+ //*** IUnknown methods ***/
+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
+ STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+ STDMETHOD_(DWORD,GetNextLink) (THIS_ DWORD dwLink) PURE;
+ STDMETHOD(SetLinkUpdateOptions) (THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE;
+ STDMETHOD(GetLinkUpdateOptions) (THIS_ DWORD dwLink, DWORD FAR* lpdwUpdateOpt) PURE;
+ STDMETHOD(SetLinkSource) (THIS_
+ DWORD dwLink,
+ LPSTR lpszDisplayName,
+ ULONG lenFileName,
+ ULONG FAR* pchEaten,
+ BOOL fValidateSource) PURE;
+ STDMETHOD(GetLinkSource) (THIS_
+ DWORD dwLink,
+ LPSTR FAR* lplpszDisplayName,
+ ULONG FAR* lplenFileName,
+ LPSTR FAR* lplpszFullLinkType,
+ LPSTR FAR* lplpszShortLinkType,
+ BOOL FAR* lpfSourceAvailable,
+ BOOL FAR* lpfIsSelected) PURE;
+ STDMETHOD(OpenLinkSource) (THIS_ DWORD dwLink) PURE;
+ STDMETHOD(UpdateLink) (THIS_
+ DWORD dwLink,
+ BOOL fErrorMessage,
+ BOOL fErrorAction) PURE;
+ STDMETHOD(CancelLink) (THIS_ DWORD dwLink) PURE;
+};
+
+
+typedef struct tagOLEUIEDITLINKS
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUI<STRUCT>. All are IN-OUT unless otherwise spec.
+
+ LPOLEUILINKCONTAINER lpOleUILinkContainer; //IN: Interface to manipulate
+ //links in the container
+ } OLEUIEDITLINKS, *POLEUIEDITLINKS, FAR *LPOLEUIEDITLINKS;
+
+
+//API Prototype
+STDAPI_(UINT) OleUIEditLinks(LPOLEUIEDITLINKS);
+
+
+// Edit Links flags
+#define ELF_SHOWHELP 0x00000001L
+#define ELF_DISABLEUPDATENOW 0x00000002L
+#define ELF_DISABLEOPENSOURCE 0x00000004L
+#define ELF_DISABLECHANGESOURCE 0x00000008L
+#define ELF_DISABLECANCELLINK 0x00000010L
+
+// Edit Links Dialog identifiers
+#define ID_EL_CHANGESOURCE 201
+#define ID_EL_AUTOMATIC 202
+#define ID_EL_CLOSE 208
+#define ID_EL_CANCELLINK 209
+#define ID_EL_UPDATENOW 210
+#define ID_EL_OPENSOURCE 211
+#define ID_EL_MANUAL 212
+#define ID_EL_LINKSOURCE 216
+#define ID_EL_LINKTYPE 217
+#define ID_EL_UPDATE 218
+#define ID_EL_NULL -1
+#define ID_EL_LINKSLISTBOX 206
+#define ID_EL_COL1 220
+#define ID_EL_COL2 221
+#define ID_EL_COL3 222
+
+
+
+/*************************************************************************
+** CHANGE ICON DIALOG
+*************************************************************************/
+
+typedef struct tagOLEUICHANGEICON
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUICHANGEICON. All are IN-OUT unless otherwise spec.
+ HGLOBAL hMetaPict; //Current and final image. Source of the
+ //icon is embedded in the metafile itself.
+ CLSID clsid; //IN only: class used to get Default icon
+ char szIconExe[OLEUI_CCHPATHMAX];
+ int cchIconExe;
+ } OLEUICHANGEICON, *POLEUICHANGEICON, FAR *LPOLEUICHANGEICON;
+
+
+//API prototype
+STDAPI_(UINT) OleUIChangeIcon(LPOLEUICHANGEICON);
+
+
+//Change Icon flags
+#define CIF_SHOWHELP 0x00000001L
+#define CIF_SELECTCURRENT 0x00000002L
+#define CIF_SELECTDEFAULT 0x00000004L
+#define CIF_SELECTFROMFILE 0x00000008L
+#define CIF_USEICONEXE 0x0000000aL
+
+
+//Change Icon specific error codes
+#define OLEUI_CIERR_MUSTHAVECLSID (OLEUI_ERR_STANDARDMAX+0)
+#define OLEUI_CIERR_MUSTHAVECURRENTMETAFILE (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_CIERR_SZICONEXEINVALID (OLEUI_ERR_STANDARDMAX+2)
+
+
+//Change Icon Dialog identifiers
+#define ID_GROUP 120
+#define ID_CURRENT 121
+#define ID_CURRENTICON 122
+#define ID_DEFAULT 123
+#define ID_DEFAULTICON 124
+#define ID_FROMFILE 125
+#define ID_FROMFILEEDIT 126
+#define ID_ICONLIST 127
+#define ID_LABEL 128
+#define ID_LABELEDIT 129
+#define ID_BROWSE 130
+#define ID_RESULTICON 132
+#define ID_RESULTLABEL 133
+
+// Stringtable defines for Change Icon
+#define IDS_CINOICONSINFILE 32430
+#define IDS_CIINVALIDFILE 32431
+#define IDS_CIFILEACCESS 32432
+#define IDS_CIFILESHARE 32433
+#define IDS_CIFILEOPENFAIL 32434
+
+
+
+/*************************************************************************
+** CONVERT DIALOG
+*************************************************************************/
+
+typedef struct tagOLEUICONVERT
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUICONVERT. All are IN-OUT unless otherwise spec.
+ CLSID clsid; //Class ID sent in to dialog: IN only
+ CLSID clsidConvertDefault; //Class ID to use as convert default: IN only
+ CLSID clsidActivateDefault; //Class ID to use as activate default: IN only
+
+ CLSID clsidNew; //Selected Class ID: OUT only
+ DWORD dvAspect; //IN-OUT, either DVASPECT_CONTENT or
+ //DVASPECT_ICON
+ WORD wFormat; //Original data format
+ BOOL fIsLinkedObject; //IN only; true if object is linked
+ HGLOBAL hMetaPict; //IN-OUT: METAFILEPICT containing iconic aspect.
+ LPSTR lpszUserType; //IN-OUT: user type name of original class.
+ // We'll do lookup if it's NULL.
+ // This gets freed on exit.
+ BOOL fObjectsIconChanged; // OUT; TRUE if ChangeIcon was called (and not cancelled)
+ LPSTR lpszDefLabel; //IN-OUT: default label to use for icon.
+ // if NULL, the short user type name
+ // will be used. if the object is a
+ // link, the caller should pass the
+ // DisplayName of the link source
+ // This gets freed on exit.
+
+ UINT cClsidExclude; //IN: No. of CLSIDs in lpClsidExclude
+ LPCLSID lpClsidExclude; //IN: List of CLSIDs to exclude from list
+ } OLEUICONVERT, *POLEUICONVERT, FAR *LPOLEUICONVERT;
+
+
+//API prototype
+STDAPI_(UINT) OleUIConvert(LPOLEUICONVERT);
+
+// Determine if there is at least one class that can Convert or ActivateAs
+// the given clsid.
+STDAPI_(BOOL) OleUICanConvertOrActivateAs(
+ REFCLSID rClsid,
+ BOOL fIsLinkedObject,
+ WORD wFormat
+);
+
+//Convert Dialog flags
+
+// IN only: Shows "HELP" button
+#define CF_SHOWHELPBUTTON 0x00000001L
+
+// IN only: lets you set the convert default object - the one that is
+// selected as default in the convert listbox.
+#define CF_SETCONVERTDEFAULT 0x00000002L
+
+
+// IN only: lets you set the activate default object - the one that is
+// selected as default in the activate listbox.
+
+#define CF_SETACTIVATEDEFAULT 0x00000004L
+
+
+// IN/OUT: Selects the "Convert To" radio button, is set on exit if
+// this button was selected
+#define CF_SELECTCONVERTTO 0x00000008L
+
+// IN/OUT: Selects the "Activate As" radio button, is set on exit if
+// this button was selected
+#define CF_SELECTACTIVATEAS 0x00000010L
+#define CF_DISABLEDISPLAYASICON 0x00000020L
+#define CF_DISABLEACTIVATEAS 0x00000040L
+
+
+//Convert specific error codes
+#define OLEUI_CTERR_CLASSIDINVALID (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_CTERR_DVASPECTINVALID (OLEUI_ERR_STANDARDMAX+2)
+#define OLEUI_CTERR_CBFORMATINVALID (OLEUI_ERR_STANDARDMAX+3)
+#define OLEUI_CTERR_HMETAPICTINVALID (OLEUI_ERR_STANDARDMAX+4)
+#define OLEUI_CTERR_STRINGINVALID (OLEUI_ERR_STANDARDMAX+5)
+
+
+//Convert Dialog identifiers
+#define IDCV_OBJECTTYPE 150
+#define IDCV_DISPLAYASICON 152
+#define IDCV_CHANGEICON 153
+#define IDCV_ACTIVATELIST 154
+#define IDCV_CONVERTTO 155
+#define IDCV_ACTIVATEAS 156
+#define IDCV_RESULTTEXT 157
+#define IDCV_CONVERTLIST 158
+#define IDCV_ICON 159
+#define IDCV_ICONLABEL1 160
+#define IDCV_ICONLABEL2 161
+#define IDCV_STXCURTYPE 162
+#define IDCV_GRPRESULT 163
+#define IDCV_STXCONVERTTO 164
+
+// String IDs for Convert dialog
+#define IDS_CVRESULTCONVERTLINK 32440
+#define IDS_CVRESULTCONVERTTO 32441
+#define IDS_CVRESULTNOCHANGE 32442
+#define IDS_CVRESULTDISPLAYASICON 32443
+#define IDS_CVRESULTACTIVATEAS 32444
+#define IDS_CVRESULTACTIVATEDIFF 32445
+
+
+/*************************************************************************
+** BUSY DIALOG
+*************************************************************************/
+
+typedef struct tagOLEUIBUSY
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags ** NOTE ** this dialog has no flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUIBUSY.
+ HTASK hTask; //IN: HTask which is blocking
+ HWND FAR * lphWndDialog; //IN: Dialog's HWND is placed here
+ } OLEUIBUSY, *POLEUIBUSY, FAR *LPOLEUIBUSY;
+
+//API prototype
+STDAPI_(UINT) OleUIBusy(LPOLEUIBUSY);
+
+// Flags for this dialog
+
+// IN only: Disables "Cancel" button
+#define BZ_DISABLECANCELBUTTON 0x00000001L
+
+// IN only: Disables "Switch To..." button
+#define BZ_DISABLESWITCHTOBUTTON 0x00000002L
+
+// IN only: Disables "Retry" button
+#define BZ_DISABLERETRYBUTTON 0x00000004L
+
+// IN only: Generates a "Not Responding" dialog as opposed to the
+// "Busy" dialog. The wording in the text is slightly different, and
+// the "Cancel" button is grayed out if you set this flag.
+#define BZ_NOTRESPONDINGDIALOG 0x00000008L
+
+// Busy specific error/return codes
+#define OLEUI_BZERR_HTASKINVALID (OLEUI_ERR_STANDARDMAX+0)
+
+// SWITCHTOSELECTED is returned when user hit "switch to"
+#define OLEUI_BZ_SWITCHTOSELECTED (OLEUI_ERR_STANDARDMAX+1)
+
+// RETRYSELECTED is returned when user hit "retry"
+#define OLEUI_BZ_RETRYSELECTED (OLEUI_ERR_STANDARDMAX+2)
+
+// CALLUNBLOCKED is returned when call has been unblocked
+#define OLEUI_BZ_CALLUNBLOCKED (OLEUI_ERR_STANDARDMAX+3)
+
+// Busy dialog identifiers
+#define IDBZ_RETRY 600
+#define IDBZ_ICON 601
+#define IDBZ_MESSAGE1 602
+#define IDBZ_SWITCHTO 604
+
+// Busy dialog stringtable defines
+#define IDS_BZRESULTTEXTBUSY 32447
+#define IDS_BZRESULTTEXTNOTRESPONDING 32448
+
+// Links dialog stringtable defines
+#define IDS_LINK_AUTO 32450
+#define IDS_LINK_MANUAL 32451
+#define IDS_LINK_UNKNOWN 32452
+#define IDS_LINKS 32453
+#define IDS_FAILED 32454
+#define IDS_CHANGESOURCE 32455
+#define IDS_INVALIDSOURCE 32456
+#define IDS_ERR_GETLINKSOURCE 32457
+#define IDS_ERR_GETLINKUPDATEOPTIONS 32458
+#define IDS_ERR_ADDSTRING 32459
+#define IDS_CHANGEADDITIONALLINKS 32460
+#define IDS_CLOSE 32461
+
+
+/*************************************************************************
+** PROMPT USER DIALOGS
+*************************************************************************/
+#define ID_PU_LINKS 900
+#define ID_PU_TEXT 901
+#define ID_PU_CONVERT 902
+#define ID_PU_BROWSE 904
+#define ID_PU_METER 905
+#define ID_PU_PERCENT 906
+#define ID_PU_STOP 907
+
+// used for -1 ids in dialogs:
+#define ID_DUMMY 999
+
+/* inside ole2ui.c */
+#ifdef __cplusplus
+extern "C"
+#endif
+int EXPORT FAR CDECL OleUIPromptUser(WORD nTemplate, HWND hwndParent, ...);
+
+#define UPDATELINKS_STARTDELAY 2000 // Delay before 1st link updates
+ // to give the user a chance to
+ // dismiss the dialog before any
+ // links update.
+
+STDAPI_(BOOL) OleUIUpdateLinks(
+ LPOLEUILINKCONTAINER lpOleUILinkCntr,
+ HWND hwndParent,
+ LPSTR lpszTitle,
+ int cLinks);
+
+
+/*************************************************************************
+** OLE OBJECT FEEDBACK EFFECTS
+*************************************************************************/
+
+#define OLEUI_HANDLES_USEINVERSE 0x00000001L
+#define OLEUI_HANDLES_NOBORDER 0x00000002L
+#define OLEUI_HANDLES_INSIDE 0x00000004L
+#define OLEUI_HANDLES_OUTSIDE 0x00000008L
+
+
+#define OLEUI_SHADE_FULLRECT 1
+#define OLEUI_SHADE_BORDERIN 2
+#define OLEUI_SHADE_BORDEROUT 3
+
+/* objfdbk.c function prototypes */
+STDAPI_(void) OleUIDrawHandles(LPRECT lpRect, HDC hdc, DWORD dwFlags, UINT cSize, BOOL fDraw);
+STDAPI_(void) OleUIDrawShading(LPRECT lpRect, HDC hdc, DWORD dwFlags, UINT cWidth);
+STDAPI_(void) OleUIShowObject(LPCRECT lprc, HDC hdc, BOOL fIsLink);
+
+
+/*************************************************************************
+** Hatch window definitions and prototypes **
+*************************************************************************/
+#define DEFAULT_HATCHBORDER_WIDTH 4
+
+STDAPI_(BOOL) RegisterHatchWindowClass(HINSTANCE hInst);
+STDAPI_(HWND) CreateHatchWindow(HWND hWndParent, HINSTANCE hInst);
+STDAPI_(UINT) GetHatchWidth(HWND hWndHatch);
+STDAPI_(void) GetHatchRect(HWND hWndHatch, LPRECT lpHatchRect);
+STDAPI_(void) SetHatchRect(HWND hWndHatch, LPRECT lprcHatchRect);
+STDAPI_(void) SetHatchWindowSize(
+ HWND hWndHatch,
+ LPRECT lprcIPObjRect,
+ LPRECT lprcClipRect,
+ LPPOINT lpptOffset
+);
+
+
+
+/*************************************************************************
+** VERSION VERIFICATION INFORMATION
+*************************************************************************/
+
+// The following magic number is used to verify that the resources we bind
+// to our EXE are the same "version" as the LIB (or DLL) file which
+// contains these routines. This is not the same as the Version information
+// resource that we place in OLE2UI.RC, this is a special ID that we will
+// have compiled in to our EXE. Upon initialization of OLE2UI, we will
+// look in our resources for an RCDATA called "VERIFICATION" (see OLE2UI.RC),
+// and make sure that the magic number there equals the magic number below.
+
+#define OLEUI_VERSION_MAGIC 0x4D42
+
+#endif //_OLE2UI_H_
diff --git a/private/oleutest/utests16/ole2ui/ole2ui.rc b/private/oleutest/utests16/ole2ui/ole2ui.rc
new file mode 100644
index 000000000..8317edcd6
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/ole2ui.rc
@@ -0,0 +1,40 @@
+/*
+ * OLE2UI.RC
+ *
+ * Icon, menus, strings, and dialogs for the OLE 2.0 UI Support Library.
+ *
+ * Copyright (c)1992 Microsoft Corporation, All Right Reserved
+ */
+
+#undef PURE
+#include "ole2ui.h"
+
+//Bitmaps for ResultImage control
+IDB_RESULTSEGA BITMAP egares.bmp
+IDB_RESULTSVGA BITMAP vgares.bmp
+IDB_RESULTSHIRESVGA BITMAP hivgares.bmp
+
+// Version Verification Resource (see OLE2UI.H)
+VERIFICATION RCDATA
+ BEGIN
+ OLEUI_VERSION_MAGIC
+ END
+
+//Include string tables here.
+#include "strings.rc"
+
+//Include each dialog template here.
+#include "insobj.dlg"
+#include "icon.dlg"
+#include "links.dlg"
+#include "pastespl.dlg"
+#include "busy.dlg"
+#include "convert.dlg"
+#include "fileopen.dlg"
+#include "prompt.dlg"
+
+// Only include the version resource if we are compiling the DLL version
+#ifdef DLL_VER
+//Version Information
+#include "RES\OLE2UI.RCV"
+#endif
diff --git a/private/oleutest/utests16/ole2ui/res/localole.h b/private/oleutest/utests16/ole2ui/res/localole.h
new file mode 100644
index 000000000..a66c97e0b
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/localole.h
@@ -0,0 +1,1001 @@
+/*
+ * OLE2UI.H
+ *
+ * Published definitions, structures, types, and function prototypes for the
+ * OLE 2.0 User Interface support library.
+ *
+ * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
+ */
+
+
+#define NONAMELESSUNION // use strict ANSI standard (for DVOBJ.H)
+
+#ifndef _OLE2UI_H_
+#define _OLE2UI_H_
+
+#ifndef RC_INVOKED
+#pragma message ("Including OLE2UI.H from " __FILE__)
+#endif //RC_INVOKED
+
+#include <windows.h>
+#include <shellapi.h>
+#include <ole2.h>
+#include <string.h>
+#include "olestd.h"
+#include "uiclass.h"
+// -- see below
+
+#ifdef __TURBOC__
+#define _getcwd getcwd
+#define _itoa itoa
+#define __max max
+#define _find_t find_t
+#endif // __TURBOC__
+
+/*
+ * Initialization / Uninitialization routines. OleUIInitialize
+ * MUST be called prior to using any functions in OLE2UI.
+ */
+
+STDAPI_(BOOL) OleUIInitialize(HINSTANCE);
+STDAPI_(BOOL) OleUIUnInitialize(void); // Must be called when completed using functions in OLE2UI
+
+//Dialog Identifiers as passed in Help messages to identify the source.
+#define IDD_INSERTOBJECT 1000
+#define IDD_CHANGEICON 1001
+#define IDD_CONVERT 1002
+#define IDD_PASTESPECIAL 1003
+#define IDD_EDITLINKS 1004
+#define IDD_FILEOPEN 1005
+#define IDD_BUSY 1006
+#define IDD_LINKSOURCEUNAVAILABLE 1007
+#define IDD_CANNOTUPDATELINK 1008
+#define IDD_SERVERNOTREG 1009
+#define IDD_LINKTYPECHANGED 1010
+#define IDD_SERVERNOTFOUND 1011
+#define IDD_UPDATELINKS 1012
+#define IDD_OUTOFMEMORY 1013
+
+#define IDOK 1
+#define IDCANCEL 2
+
+// Stringtable identifers
+#define IDS_OLE2UIUNKNOWN 300
+#define IDS_OLE2UILINK 301
+#define IDS_OLE2UIOBJECT 302
+#define IDS_OLE2UIEDIT 303
+#define IDS_OLE2UICONVERT 304
+#define IDS_OLE2UIEDITLINKCMD_1VERB 305
+#define IDS_OLE2UIEDITOBJECTCMD_1VERB 306
+#define IDS_OLE2UIEDITLINKCMD_NVERB 307
+#define IDS_OLE2UIEDITOBJECTCMD_NVERB 308
+#define IDS_OLE2UIEDITNOOBJCMD 309
+#define IDS_DEFICONLABEL 310 // def. icon label (usu. "Document")
+
+
+#define IDS_FILTERS 64
+#define IDS_ICONFILTERS 65
+
+//Resource identifiers for bitmaps
+#define IDB_RESULTSEGA 10
+#define IDB_RESULTSVGA 11
+#define IDB_RESULTSHIRESVGA 12
+
+
+//Missing from windows.h
+#ifndef PVOID
+typedef VOID *PVOID;
+#endif
+
+
+//Hook type used in all structures.
+typedef UINT (CALLBACK *LPFNOLEUIHOOK)(HWND, UINT, WPARAM, LPARAM);
+
+
+//Strings for registered messages
+#define SZOLEUI_MSG_HELP "OLEUI_MSG_HELP"
+#define SZOLEUI_MSG_ENDDIALOG "OLEUI_MSG_ENDDIALOG"
+#define SZOLEUI_MSG_BROWSE "OLEUI_MSG_BROWSE"
+#define SZOLEUI_MSG_CHANGEICON "OLEUI_MSG_CHANGEICON"
+#define SZOLEUI_MSG_CLOSEBUSYDIALOG "OLEUI_MSG_CLOSEBUSYDIALOG"
+#define SZOLEUI_MSG_FILEOKSTRING "OLEUI_MSG_FILEOKSTRING"
+
+// Define the classname strings. The strings below define the custom
+// control classnames for the controls used in the UI dialogs.
+//
+// **************************************************************
+// These classnames must be distinct for each application
+// which uses this library, or your application will generate an
+// fatal error under the debugging version of Windows 3.1.
+// **************************************************************
+//
+// The MAKEFILE for this library automatically generates a file
+// uiclass.h which contains distinct definitions for these
+// classname strings, as long as you use a distinct name when
+// you build the library. See the MAKEFILE for more information
+// on setting the name of the library.
+
+#define SZCLASSICONBOX OLEUICLASS1
+#define SZCLASSRESULTIMAGE OLEUICLASS2
+
+#define OLEUI_ERR_STANDARDMIN 100
+#define OLEUI_ERR_STRUCTURENULL 101 //Standard field validation
+#define OLEUI_ERR_STRUCTUREINVALID 102
+#define OLEUI_ERR_CBSTRUCTINCORRECT 103
+#define OLEUI_ERR_HWNDOWNERINVALID 104
+#define OLEUI_ERR_LPSZCAPTIONINVALID 105
+#define OLEUI_ERR_LPFNHOOKINVALID 106
+#define OLEUI_ERR_HINSTANCEINVALID 107
+#define OLEUI_ERR_LPSZTEMPLATEINVALID 108
+#define OLEUI_ERR_HRESOURCEINVALID 109
+
+#define OLEUI_ERR_FINDTEMPLATEFAILURE 110 //Initialization errors
+#define OLEUI_ERR_LOADTEMPLATEFAILURE 111
+#define OLEUI_ERR_DIALOGFAILURE 112
+#define OLEUI_ERR_LOCALMEMALLOC 113
+#define OLEUI_ERR_GLOBALMEMALLOC 114
+#define OLEUI_ERR_LOADSTRING 115
+
+#define OLEUI_ERR_STANDARDMAX 116 //Start here for specific errors.
+
+
+
+//Help Button Identifier
+#define ID_OLEUIHELP 99
+
+// Help button for fileopen.dlg (need this for resizing) 1038 is pshHelp
+#define IDHELP 1038
+
+// Static text control (use this instead of -1 so things work correctly for
+// localization
+#define ID_STATIC 98
+
+//Maximum key size we read from the RegDB.
+#define OLEUI_CCHKEYMAX 256 // make any changes to this in geticon.c too
+
+//Maximum verb length and length of Object menu
+#define OLEUI_CCHVERBMAX 32
+#define OLEUI_OBJECTMENUMAX 64
+
+//Maximum MS-DOS pathname.
+#define OLEUI_CCHPATHMAX 256 // make any changes to this in geticon.c too
+#define OLEUI_CCHFILEMAX 13
+
+//Icon label length
+#define OLEUI_CCHLABELMAX 40 // make any changes to this in geticon.c too
+
+//Length of the CLSID string
+#define OLEUI_CCHCLSIDSTRING 39
+
+
+/*
+ * What follows here are first function prototypes for general utility
+ * functions, then sections laid out by dialog. Each dialog section
+ * defines the dialog structure, the API prototype, flags for the dwFlags
+ * field, the dialog-specific error values, and dialog control IDs (for
+ * hooks and custom templates.
+ */
+
+
+//Miscellaneous utility functions.
+STDAPI_(BOOL) OleUIAddVerbMenu(LPOLEOBJECT lpOleObj,
+ LPSTR lpszShortType,
+ HMENU hMenu,
+ UINT uPos,
+ UINT uIDVerbMin,
+ BOOL bAddConvert,
+ UINT idConvert,
+ HMENU FAR *lphMenu);
+
+//Metafile utility functions
+STDAPI_(HGLOBAL) OleUIMetafilePictFromIconAndLabel(HICON, LPSTR, LPSTR, UINT);
+STDAPI_(void) OleUIMetafilePictIconFree(HGLOBAL);
+STDAPI_(BOOL) OleUIMetafilePictIconDraw(HDC, LPRECT, HGLOBAL, BOOL);
+STDAPI_(UINT) OleUIMetafilePictExtractLabel(HGLOBAL, LPSTR, UINT, LPDWORD);
+STDAPI_(HICON) OleUIMetafilePictExtractIcon(HGLOBAL);
+STDAPI_(BOOL) OleUIMetafilePictExtractIconSource(HGLOBAL,LPSTR,UINT FAR *);
+
+
+
+
+
+/*************************************************************************
+** INSERT OBJECT DIALOG
+*************************************************************************/
+
+
+typedef struct tagOLEUIINSERTOBJECT
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUIINSERTOBJECT. All are IN-OUT unless otherwise spec.
+ CLSID clsid; //Return space for class ID
+ LPSTR lpszFile; //Filename for inserts or links
+ UINT cchFile; //Size of lpszFile buffer: OLEUI_CCHPATHMAX
+ UINT cClsidExclude; //IN only: CLSIDs in lpClsidExclude
+ LPCLSID lpClsidExclude; //List of CLSIDs to exclude from listing.
+
+ //Specific to create objects if flags say so
+ IID iid; //Requested interface on creation.
+ DWORD oleRender; //Rendering option
+ LPFORMATETC lpFormatEtc; //Desired format
+ LPOLECLIENTSITE lpIOleClientSite; //Site to be use for the object.
+ LPSTORAGE lpIStorage; //Storage used for the object
+ LPVOID FAR *ppvObj; //Where the object is returned.
+ SCODE sc; //Result of creation calls.
+ HGLOBAL hMetaPict; //OUT: METAFILEPICT containing iconic aspect.
+ //IFF we couldn't stuff it in the cache.
+ } OLEUIINSERTOBJECT, *POLEUIINSERTOBJECT, FAR *LPOLEUIINSERTOBJECT;
+
+//API prototype
+STDAPI_(UINT) OleUIInsertObject(LPOLEUIINSERTOBJECT);
+
+
+//Insert Object flags
+#define IOF_SHOWHELP 0x00000001L
+#define IOF_SELECTCREATENEW 0x00000002L
+#define IOF_SELECTCREATEFROMFILE 0x00000004L
+#define IOF_CHECKLINK 0x00000008L
+#define IOF_CHECKDISPLAYASICON 0x00000010L
+#define IOF_CREATENEWOBJECT 0x00000020L
+#define IOF_CREATEFILEOBJECT 0x00000040L
+#define IOF_CREATELINKOBJECT 0x00000080L
+#define IOF_DISABLELINK 0x00000100L
+#define IOF_VERIFYSERVERSEXIST 0x00000200L
+
+
+//Insert Object specific error codes
+#define OLEUI_IOERR_LPSZFILEINVALID (OLEUI_ERR_STANDARDMAX+0)
+#define OLEUI_IOERR_LPSZLABELINVALID (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_IOERR_HICONINVALID (OLEUI_ERR_STANDARDMAX+2)
+#define OLEUI_IOERR_LPFORMATETCINVALID (OLEUI_ERR_STANDARDMAX+3)
+#define OLEUI_IOERR_PPVOBJINVALID (OLEUI_ERR_STANDARDMAX+4)
+#define OLEUI_IOERR_LPIOLECLIENTSITEINVALID (OLEUI_ERR_STANDARDMAX+5)
+#define OLEUI_IOERR_LPISTORAGEINVALID (OLEUI_ERR_STANDARDMAX+6)
+#define OLEUI_IOERR_SCODEHASERROR (OLEUI_ERR_STANDARDMAX+7)
+#define OLEUI_IOERR_LPCLSIDEXCLUDEINVALID (OLEUI_ERR_STANDARDMAX+8)
+#define OLEUI_IOERR_CCHFILEINVALID (OLEUI_ERR_STANDARDMAX+9)
+
+
+//Insert Object Dialog identifiers
+#define ID_IO_CREATENEW 2100
+#define ID_IO_CREATEFROMFILE 2101
+#define ID_IO_LINKFILE 2102
+#define ID_IO_OBJECTTYPELIST 2103
+#define ID_IO_DISPLAYASICON 2104
+#define ID_IO_CHANGEICON 2105
+#define ID_IO_FILE 2106
+#define ID_IO_FILEDISPLAY 2107
+#define ID_IO_RESULTIMAGE 2108
+#define ID_IO_RESULTTEXT 2109
+#define ID_IO_ICONDISPLAY 2110
+#define ID_IO_OBJECTTYPETEXT 2111
+#define ID_IO_FILETEXT 2112
+#define ID_IO_FILETYPE 2113
+
+// Strings in OLE2UI resources
+#define IDS_IORESULTNEW 256
+#define IDS_IORESULTNEWICON 257
+#define IDS_IORESULTFROMFILE1 258
+#define IDS_IORESULTFROMFILE2 259
+#define IDS_IORESULTFROMFILEICON2 260
+#define IDS_IORESULTLINKFILE1 261
+#define IDS_IORESULTLINKFILE2 262
+#define IDS_IORESULTLINKFILEICON1 263
+#define IDS_IORESULTLINKFILEICON2 264
+
+/*************************************************************************
+** PASTE SPECIAL DIALOG
+*************************************************************************/
+
+// Maximum number of link types
+#define PS_MAXLINKTYPES 8
+
+//NOTE: OLEUIPASTEENTRY and OLEUIPASTEFLAG structs are defined in OLESTD.H
+
+typedef struct tagOLEUIPASTESPECIAL
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUIPASTESPECIAL.
+
+ //IN fields
+ LPDATAOBJECT lpSrcDataObj; //Source IDataObject* (on the clipboard) for data to paste
+
+ LPOLEUIPASTEENTRY arrPasteEntries; //OLEUIPASTEENTRY array which specifies acceptable formats. See
+ // OLEUIPASTEENTRY for more information.
+ int cPasteEntries; //Number of OLEUIPASTEENTRY array entries
+
+ UINT FAR *arrLinkTypes; //List of link types that are acceptable. Link types are referred
+ // to using OLEUIPASTEFLAGS in arrPasteEntries
+ int cLinkTypes; //Number of link types
+
+ //OUT fields
+ int nSelectedIndex; //Index of arrPasteEntries[] that the user selected
+ BOOL fLink; //Indicates if Paste or Paste Link was selected by the user
+ HGLOBAL hMetaPict; //Handle to Metafile containing icon and icon title selected by the user
+ // Use the Metafile utility functions defined in this header to
+ // manipulate hMetaPict
+ } OLEUIPASTESPECIAL, *POLEUIPASTESPECIAL, FAR *LPOLEUIPASTESPECIAL;
+
+
+//API to bring up PasteSpecial dialog
+STDAPI_(UINT) OleUIPasteSpecial(LPOLEUIPASTESPECIAL);
+
+
+//Paste Special flags
+// Show Help button. IN flag.
+#define PSF_SHOWHELP 0x00000001L
+// Select Paste radio button at dialog startup. This is the default if PSF_SELECTPASTE or PSF_SELECTPASTELINK
+// are not specified. Also specifies state of button on dialog termination. IN/OUT flag.
+#define PSF_SELECTPASTE 0x00000002L
+// Select PasteLink radio button at dialog startup. Also specifies state of button on dialog termination.
+// IN/OUT flag.
+#define PSF_SELECTPASTELINK 0x00000004L
+// Specfies if DisplayAsIcon button was checked on dialog termination. OUT flag.
+#define PSF_CHECKDISPLAYASICON 0x00000008L
+
+
+//Paste Special specific error codes
+#define OLEUI_IOERR_SRCDATAOBJECTINVALID (OLEUI_ERR_STANDARDMAX+0)
+#define OLEUI_IOERR_ARRPASTEENTRIESINVALID (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_IOERR_ARRLINKTYPESINVALID (OLEUI_ERR_STANDARDMAX+2)
+#define OLEUI_PSERR_CLIPBOARDCHANGED (OLEUI_ERR_STANDARDMAX+3)
+
+//Paste Special Dialog identifiers
+#define ID_PS_PASTE 500
+#define ID_PS_PASTELINK 501
+#define ID_PS_SOURCETEXT 502
+#define ID_PS_PASTELIST 503
+#define ID_PS_PASTELINKLIST 504
+#define ID_PS_DISPLAYLIST 505
+#define ID_PS_DISPLAYASICON 506
+#define ID_PS_ICONDISPLAY 507
+#define ID_PS_CHANGEICON 508
+#define ID_PS_RESULTIMAGE 509
+#define ID_PS_RESULTTEXT 510
+#define ID_PS_RESULTGROUP 511
+#define ID_PS_STXSOURCE 512
+#define ID_PS_STXAS 513
+
+// Paste Special String IDs
+#define IDS_PSPASTEDATA 400
+#define IDS_PSPASTEOBJECT 401
+#define IDS_PSPASTEOBJECTASICON 402
+#define IDS_PSPASTELINKDATA 403
+#define IDS_PSPASTELINKOBJECT 404
+#define IDS_PSPASTELINKOBJECTASICON 405
+#define IDS_PSNONOLE 406
+#define IDS_PSUNKNOWNTYPE 407
+#define IDS_PSUNKNOWNSRC 408
+#define IDS_PSUNKNOWNAPP 409
+
+
+/*************************************************************************
+** EDIT LINKS DIALOG
+*************************************************************************/
+
+
+
+/* IOleUILinkContainer Interface
+** -----------------------------
+** This interface must be implemented by container applications that
+** want to use the EditLinks dialog. the EditLinks dialog calls back
+** to the container app to perform the OLE functions to manipulate
+** the links within the container.
+*/
+
+#define LPOLEUILINKCONTAINER IOleUILinkContainer FAR*
+
+#undef INTERFACE
+#define INTERFACE IOleUILinkContainer
+
+DECLARE_INTERFACE_(IOleUILinkContainer, IUnknown)
+{
+ //*** IUnknown methods ***/
+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
+ STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+ STDMETHOD_(DWORD,GetNextLink) (THIS_ DWORD dwLink) PURE;
+ STDMETHOD(SetLinkUpdateOptions) (THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE;
+ STDMETHOD(GetLinkUpdateOptions) (THIS_ DWORD dwLink, DWORD FAR* lpdwUpdateOpt) PURE;
+ STDMETHOD(SetLinkSource) (THIS_
+ DWORD dwLink,
+ LPSTR lpszDisplayName,
+ ULONG lenFileName,
+ ULONG FAR* pchEaten,
+ BOOL fValidateSource) PURE;
+ STDMETHOD(GetLinkSource) (THIS_
+ DWORD dwLink,
+ LPSTR FAR* lplpszDisplayName,
+ ULONG FAR* lplenFileName,
+ LPSTR FAR* lplpszFullLinkType,
+ LPSTR FAR* lplpszShortLinkType,
+ BOOL FAR* lpfSourceAvailable,
+ BOOL FAR* lpfIsSelected) PURE;
+ STDMETHOD(OpenLinkSource) (THIS_ DWORD dwLink) PURE;
+ STDMETHOD(UpdateLink) (THIS_
+ DWORD dwLink,
+ BOOL fErrorMessage,
+ BOOL fErrorAction) PURE;
+ STDMETHOD(CancelLink) (THIS_ DWORD dwLink) PURE;
+};
+
+
+typedef struct tagOLEUIEDITLINKS
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUI<STRUCT>. All are IN-OUT unless otherwise spec.
+
+ LPOLEUILINKCONTAINER lpOleUILinkContainer; //IN: Interface to manipulate
+ //links in the container
+ } OLEUIEDITLINKS, *POLEUIEDITLINKS, FAR *LPOLEUIEDITLINKS;
+
+
+//API Prototype
+STDAPI_(UINT) OleUIEditLinks(LPOLEUIEDITLINKS);
+
+
+// Edit Links flags
+#define ELF_SHOWHELP 0x00000001L
+
+// Edit Links Dialog identifiers
+#define ID_EL_CHANGESOURCE 201
+#define ID_EL_AUTOMATIC 202
+#define ID_EL_CLOSE 208
+#define ID_EL_CANCELLINK 209
+#define ID_EL_UPDATENOW 210
+#define ID_EL_OPENSOURCE 211
+#define ID_EL_MANUAL 212
+#define ID_EL_LINKSOURCE 216
+#define ID_EL_LINKTYPE 217
+#define ID_EL_UPDATE 218
+#define ID_EL_NULL -1
+#define ID_EL_LINKSLISTBOX 206
+#define ID_EL_HELP 207
+#define ID_EL_COL1 223
+#define ID_EL_COL2 221
+#define ID_EL_COL3 222
+
+
+
+/*************************************************************************
+** CHANGE ICON DIALOG
+*************************************************************************/
+
+typedef struct tagOLEUICHANGEICON
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUICHANGEICON. All are IN-OUT unless otherwise spec.
+ HGLOBAL hMetaPict; //Current and final image. Source of the
+ //icon is embedded in the metafile itself.
+ CLSID clsid; //IN only: class used to get Default icon
+ char szIconExe[OLEUI_CCHPATHMAX];
+ int cchIconExe;
+ } OLEUICHANGEICON, *POLEUICHANGEICON, FAR *LPOLEUICHANGEICON;
+
+
+//API prototype
+STDAPI_(UINT) OleUIChangeIcon(LPOLEUICHANGEICON);
+
+
+//Change Icon flags
+#define CIF_SHOWHELP 0x00000001L
+#define CIF_SELECTCURRENT 0x00000002L
+#define CIF_SELECTDEFAULT 0x00000004L
+#define CIF_SELECTFROMFILE 0x00000008L
+#define CIF_USEICONEXE 0x0000000aL
+
+
+//Change Icon specific error codes
+#define OLEUI_CIERR_MUSTHAVECLSID (OLEUI_ERR_STANDARDMAX+0)
+#define OLEUI_CIERR_MUSTHAVECURRENTMETAFILE (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_CIERR_SZICONEXEINVALID (OLEUI_ERR_STANDARDMAX+2)
+
+
+//Change Icon Dialog identifiers
+#define ID_GROUP 120
+#define ID_CURRENT 121
+#define ID_CURRENTICON 122
+#define ID_DEFAULT 123
+#define ID_DEFAULTICON 124
+#define ID_FROMFILE 125
+#define ID_FROMFILEEDIT 126
+#define ID_ICONLIST 127
+#define ID_LABEL 128
+#define ID_LABELEDIT 129
+#define ID_BROWSE 130
+#define ID_RESULTICON 132
+#define ID_RESULTLABEL 133
+
+// Stringtable defines for Change Icon
+#define IDS_CINOICONSINFILE 288
+#define IDS_CIINVALIDFILE 289
+#define IDS_CIFILEACCESS 290
+#define IDS_CIFILESHARE 291
+#define IDS_CIFILEOPENFAIL 292
+
+
+
+/*************************************************************************
+** CONVERT DIALOG
+*************************************************************************/
+
+typedef struct tagOLEUICONVERT
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUICONVERT. All are IN-OUT unless otherwise spec.
+ CLSID clsid; //Class ID sent in to dialog: IN only
+ CLSID clsidConvertDefault; //Class ID to use as convert default: IN only
+ CLSID clsidActivateDefault; //Class ID to use as activate default: IN only
+
+ CLSID clsidNew; //Selected Class ID: OUT only
+ DWORD dvAspect; //IN-OUT, either DVASPECT_CONTENT or
+ //DVASPECT_ICON
+ WORD wFormat; //Original data format
+ BOOL fIsLinkedObject; //IN only; true if object is linked
+ HGLOBAL hMetaPict; //IN-OUT: METAFILEPICT containing iconic aspect.
+ LPSTR lpszUserType; //IN: user type name of original class. We'll do lookup if it's NULL.
+ //This gets freed on exit.
+ BOOL fObjectsIconChanged; // OUT; TRUE if ChangeIcon was called (and not cancelled)
+
+ } OLEUICONVERT, *POLEUICONVERT, FAR *LPOLEUICONVERT;
+
+
+//API prototype
+STDAPI_(UINT) OleUIConvert(LPOLEUICONVERT);
+
+//Convert Dialog flags
+
+// IN only: Shows "HELP" button
+#define CF_SHOWHELPBUTTON 0x00000001L
+
+// IN only: lets you set the convert default object - the one that is
+// selected as default in the convert listbox.
+#define CF_SETCONVERTDEFAULT 0x00000002L
+
+
+// IN only: lets you set the activate default object - the one that is
+// selected as default in the activate listbox.
+
+#define CF_SETACTIVATEDEFAULT 0x00000004L
+
+
+// IN/OUT: Selects the "Convert To" radio button, is set on exit if
+// this button was selected
+#define CF_SELECTCONVERTTO 0x00000008L
+
+// IN/OUT: Selects the "Activate As" radio button, is set on exit if
+// this button was selected
+#define CF_SELECTACTIVATEAS 0x00000010L
+
+
+//Convert specific error codes
+#define OLEUI_CTERR_CLASSIDINVALID (OLEUI_ERR_STANDARDMAX+1)
+#define OLEUI_CTERR_DVASPECTINVALID (OLEUI_ERR_STANDARDMAX+2)
+#define OLEUI_CTERR_CBFORMATINVALID (OLEUI_ERR_STANDARDMAX+3)
+#define OLEUI_CTERR_HMETAPICTINVALID (OLEUI_ERR_STANDARDMAX+4)
+#define OLEUI_CTERR_STRINGINVALID (OLEUI_ERR_STANDARDMAX+5)
+
+
+//Convert Dialog identifiers
+#define IDCV_OBJECTTYPE 150
+#define IDCV_HELP 151
+#define IDCV_DISPLAYASICON 152
+#define IDCV_CHANGEICON 153
+#define IDCV_ACTIVATELIST 154
+#define IDCV_CONVERTTO 155
+#define IDCV_ACTIVATEAS 156
+#define IDCV_RESULTTEXT 157
+#define IDCV_CONVERTLIST 158
+#define IDCV_ICON 159
+#define IDCV_ICONLABEL1 160
+#define IDCV_ICONLABEL2 161
+#define IDCV_STXCURTYPE 162
+#define IDCV_GRPRESULT 163
+#define IDCV_STXCONVERTTO 164
+
+// String IDs for Convert dialog
+#define IDS_CVRESULTCONVERTLINK 500
+#define IDS_CVRESULTCONVERTTO 501
+#define IDS_CVRESULTNOCHANGE 502
+#define IDS_CVRESULTDISPLAYASICON 503
+#define IDS_CVRESULTACTIVATEAS 504
+#define IDS_CVRESULTACTIVATEDIFF 505
+
+
+/*************************************************************************
+** BUSY DIALOG
+*************************************************************************/
+
+typedef struct tagOLEUIBUSY
+ {
+ //These IN fields are standard across all OLEUI dialog functions.
+ DWORD cbStruct; //Structure Size
+ DWORD dwFlags; //IN-OUT: Flags ** NOTE ** this dialog has no flags
+ HWND hWndOwner; //Owning window
+ LPCSTR lpszCaption; //Dialog caption bar contents
+ LPFNOLEUIHOOK lpfnHook; //Hook callback
+ LPARAM lCustData; //Custom data to pass to hook
+ HINSTANCE hInstance; //Instance for customized template name
+ LPCSTR lpszTemplate; //Customized template name
+ HRSRC hResource; //Customized template handle
+
+ //Specifics for OLEUIBUSY.
+ HTASK hTask; //IN: HTask which is blocking
+ HWND FAR * lphWndDialog; //IN: Dialog's HWND is placed here
+ } OLEUIBUSY, *POLEUIBUSY, FAR *LPOLEUIBUSY;
+
+//API prototype
+STDAPI_(UINT) OleUIBusy(LPOLEUIBUSY);
+
+// Flags for this dialog
+
+// IN only: Disables "Cancel" button
+#define BZ_DISABLECANCELBUTTON 0x00000001L
+
+// IN only: Disables "Switch To..." button
+#define BZ_DISABLESWITCHTOBUTTON 0x00000002L
+
+// IN only: Disables "Retry" button
+#define BZ_DISABLERETRYBUTTON 0x00000004L
+
+// IN only: Generates a "Not Responding" dialog as opposed to the
+// "Busy" dialog. The wording in the text is slightly different, and
+// the "Cancel" button is grayed out if you set this flag.
+#define BZ_NOTRESPONDINGDIALOG 0x00000008L
+
+// Busy specific error/return codes
+#define OLEUI_BZERR_HTASKINVALID (OLEUI_ERR_STANDARDMAX+0)
+
+// SWITCHTOSELECTED is returned when user hit "switch to"
+#define OLEUI_BZ_SWITCHTOSELECTED (OLEUI_ERR_STANDARDMAX+1)
+
+// RETRYSELECTED is returned when user hit "retry"
+#define OLEUI_BZ_RETRYSELECTED (OLEUI_ERR_STANDARDMAX+2)
+
+// CALLUNBLOCKED is returned when call has been unblocked
+#define OLEUI_BZ_CALLUNBLOCKED (OLEUI_ERR_STANDARDMAX+3)
+
+// Busy dialog identifiers
+#define IDBZ_RETRY 600
+#define IDBZ_ICON 601
+#define IDBZ_MESSAGE1 602
+#define IDBZ_SWITCHTO 604
+
+// Busy dialog stringtable defines
+#define IDS_BZRESULTTEXTBUSY 601
+#define IDS_BZRESULTTEXTNOTRESPONDING 602
+
+// Links dialog stringtable defines
+#define IDS_LINK_AUTO 800
+#define IDS_LINK_MANUAL 801
+#define IDS_LINK_UNKNOWN 802
+#define IDS_LINKS 803
+#define IDS_FAILED 804
+#define IDS_CHANGESOURCE 805
+#define IDS_INVALIDSOURCE 806
+#define IDS_ERR_GETLINKSOURCE 807
+#define IDS_ERR_GETLINKUPDATEOPTIONS 808
+#define IDS_ERR_ADDSTRING 809
+#define IDS_CHANGEADDITIONALLINKS 810
+
+
+/*************************************************************************
+** PROMPT USER DIALOGS
+*************************************************************************/
+#define ID_PU_LINKS 900
+#define ID_PU_TEXT 901
+#define ID_PU_CONVERT 902
+#define ID_PU_HELP 903
+#define ID_PU_BROWSE 904
+#define ID_PU_METER 905
+#define ID_PU_PERCENT 906
+#define ID_PU_STOP 907
+
+// used for -1 ids in dialogs:
+#define ID_DUMMY 999
+
+/* inside ole2ui.c */
+#ifdef __cplusplus
+extern "C"
+#endif
+int __export FAR CDECL OleUIPromptUser(int nTemplate, HWND hwndParent, ...);
+STDAPI_(BOOL) OleUIUpdateLinks(
+ LPOLEUILINKCONTAINER lpOleUILinkCntr,
+ HWND hwndParent,
+ LPSTR lpszTitle,
+ int cLinks);
+
+
+/*************************************************************************
+** OLE OBJECT FEEDBACK EFFECTS
+*************************************************************************/
+
+#define OLEUI_HANDLES_USEINVERSE 0x00000001L
+#define OLEUI_HANDLES_NOBORDER 0x00000002L
+#define OLEUI_HANDLES_INSIDE 0x00000004L
+#define OLEUI_HANDLES_OUTSIDE 0x00000008L
+
+
+/* objfdbk.c function prototypes */
+STDAPI_(void) OleUIDrawHandles(LPRECT lpRect, HDC hdc, DWORD dwFlags, UINT cSize, BOOL fDraw);
+STDAPI_(void) OleUIDrawShading(LPRECT lpRect, HDC hdc, DWORD dwFlags, UINT cWidth);
+STDAPI_(void) OleUIShowObject(LPCRECT lprc, HDC hdc, BOOL fIsLink);
+
+
+/*************************************************************************
+** Hatch window definitions and prototypes **
+*************************************************************************/
+#define DEFAULT_HATCHBORDER_WIDTH 4
+
+STDAPI_(BOOL) RegisterHatchWindowClass(HINSTANCE hInst);
+STDAPI_(HWND) CreateHatchWindow(HWND hWndParent, HINSTANCE hInst);
+STDAPI_(UINT) GetHatchWidth(HWND hWndHatch);
+STDAPI_(void) GetHatchRect(HWND hWndHatch, LPRECT lpHatchRect);
+STDAPI_(void) SetHatchRect(HWND hWndHatch, LPRECT lprcHatchRect);
+STDAPI_(void) SetHatchWindowSize(
+ HWND hWndHatch,
+ LPRECT lprcIPObjRect,
+ LPRECT lprcClipRect,
+ LPPOINT lpptOffset
+);
+
+
+
+/*************************************************************************
+** VERSION VERIFICATION INFORMATION
+*************************************************************************/
+
+// The following magic number is used to verify that the resources we bind
+// to our EXE are the same "version" as the LIB (or DLL) file which
+// contains these routines. This is not the same as the Version information
+// resource that we place in OLE2UI.RC, this is a special ID that we will
+// have compiled in to our EXE. Upon initialization of OLE2UI, we will
+// look in our resources for an RCDATA called "VERIFICATION" (see OLE2UI.RC),
+// and make sure that the magic number there equals the magic number below.
+
+#define OLEUI_VERSION_MAGIC 0x4D42
+
+#endif //_OLE2UI_H_
+/*****************************************************************************\
+* *
+* dlgs.h - Common dialog's dialog element ID numbers *
+* *
+* Version 1.0 *
+* *
+* Copyright (c) 1992, Microsoft Corp. All rights reserved. *
+* *
+\*****************************************************************************/
+
+#ifndef _INC_DLGS
+#define _INC_DLGS
+
+#define ctlFirst 0x0400
+#define ctlLast 0x04ff
+ /* Push buttons */
+#define psh1 0x0400
+#define psh2 0x0401
+#define psh3 0x0402
+#define psh4 0x0403
+#define psh5 0x0404
+#define psh6 0x0405
+#define psh7 0x0406
+#define psh8 0x0407
+#define psh9 0x0408
+#define psh10 0x0409
+#define psh11 0x040a
+#define psh12 0x040b
+#define psh13 0x040c
+#define psh14 0x040d
+#define psh15 0x040e
+#define pshHelp psh15
+#define psh16 0x040f
+ /* Checkboxes */
+#define chx1 0x0410
+#define chx2 0x0411
+#define chx3 0x0412
+#define chx4 0x0413
+#define chx5 0x0414
+#define chx6 0x0415
+#define chx7 0x0416
+#define chx8 0x0417
+#define chx9 0x0418
+#define chx10 0x0419
+#define chx11 0x041a
+#define chx12 0x041b
+#define chx13 0x041c
+#define chx14 0x041d
+#define chx15 0x041e
+#define chx16 0x041f
+ /* Radio buttons */
+#define rad1 0x0420
+#define rad2 0x0421
+#define rad3 0x0422
+#define rad4 0x0423
+#define rad5 0x0424
+#define rad6 0x0425
+#define rad7 0x0426
+#define rad8 0x0427
+#define rad9 0x0428
+#define rad10 0x0429
+#define rad11 0x042a
+#define rad12 0x042b
+#define rad13 0x042c
+#define rad14 0x042d
+#define rad15 0x042e
+#define rad16 0x042f
+ /* Groups, frames, rectangles, and icons */
+#define grp1 0x0430
+#define grp2 0x0431
+#define grp3 0x0432
+#define grp4 0x0433
+#define frm1 0x0434
+#define frm2 0x0435
+#define frm3 0x0436
+#define frm4 0x0437
+#define rct1 0x0438
+#define rct2 0x0439
+#define rct3 0x043a
+#define rct4 0x043b
+#define ico1 0x043c
+#define ico2 0x043d
+#define ico3 0x043e
+#define ico4 0x043f
+ /* Static text */
+#define stc1 0x0440
+#define stc2 0x0441
+#define stc3 0x0442
+#define stc4 0x0443
+#define stc5 0x0444
+#define stc6 0x0445
+#define stc7 0x0446
+#define stc8 0x0447
+#define stc9 0x0448
+#define stc10 0x0449
+#define stc11 0x044a
+#define stc12 0x044b
+#define stc13 0x044c
+#define stc14 0x044d
+#define stc15 0x044e
+#define stc16 0x044f
+#define stc17 0x0450
+#define stc18 0x0451
+#define stc19 0x0452
+#define stc20 0x0453
+#define stc21 0x0454
+#define stc22 0x0455
+#define stc23 0x0456
+#define stc24 0x0457
+#define stc25 0x0458
+#define stc26 0x0459
+#define stc27 0x045a
+#define stc28 0x045b
+#define stc29 0x045c
+#define stc30 0x045d
+#define stc31 0x045e
+#define stc32 0x045f
+ /* Listboxes */
+#define lst1 0x0460
+#define lst2 0x0461
+#define lst3 0x0462
+#define lst4 0x0463
+#define lst5 0x0464
+#define lst6 0x0465
+#define lst7 0x0466
+#define lst8 0x0467
+#define lst9 0x0468
+#define lst10 0x0469
+#define lst11 0x046a
+#define lst12 0x046b
+#define lst13 0x046c
+#define lst14 0x046d
+#define lst15 0x046e
+#define lst16 0x046f
+ /* Combo boxes */
+#define cmb1 0x0470
+#define cmb2 0x0471
+#define cmb3 0x0472
+#define cmb4 0x0473
+#define cmb5 0x0474
+#define cmb6 0x0475
+#define cmb7 0x0476
+#define cmb8 0x0477
+#define cmb9 0x0478
+#define cmb10 0x0479
+#define cmb11 0x047a
+#define cmb12 0x047b
+#define cmb13 0x047c
+#define cmb14 0x047d
+#define cmb15 0x047e
+#define cmb16 0x047f
+ /* Edit controls */
+#define edt1 0x0480
+#define edt2 0x0481
+#define edt3 0x0482
+#define edt4 0x0483
+#define edt5 0x0484
+#define edt6 0x0485
+#define edt7 0x0486
+#define edt8 0x0487
+#define edt9 0x0488
+#define edt10 0x0489
+#define edt11 0x048a
+#define edt12 0x048b
+#define edt13 0x048c
+#define edt14 0x048d
+#define edt15 0x048e
+#define edt16 0x048f
+ /* Scroll bars */
+#define scr1 0x0490
+#define scr2 0x0491
+#define scr3 0x0492
+#define scr4 0x0493
+#define scr5 0x0494
+#define scr6 0x0495
+#define scr7 0x0496
+#define scr8 0x0497
+
+/* These dialog resource ordinals really start at 0x0600, but the
+ * RC Compiler can't handle hex for resource IDs, hence the decimal.
+ */
+#define FILEOPENORD 1536
+#define MULTIFILEOPENORD 1537
+#define PRINTDLGORD 1538
+#define PRNSETUPDLGORD 1539
+#define FINDDLGORD 1540
+#define REPLACEDLGORD 1541
+#define FONTDLGORD 1542
+#define FORMATDLGORD31 1543
+#define FORMATDLGORD30 1544
+
+#endif /* !_INC_DLGS */
diff --git a/private/oleutest/utests16/ole2ui/res/ole2ui.rcv b/private/oleutest/utests16/ole2ui/res/ole2ui.rcv
new file mode 100644
index 000000000..a083a822f
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/ole2ui.rcv
@@ -0,0 +1,90 @@
+/*
+ * OLE2UI.RCV
+ *
+ * Version resource file for the OLE 2.0 UI Support DLL.
+ *
+ * Copyright (c)1992-1993 Microsoft Corporation, All Rights Reserved.
+ *
+ * This file contains the non-localized version data, the U.S. English
+ * translation of the localized version data, and templates for the data
+ * that needs to be translated. Note that no text in this file should be
+ * translated. The text that has to be translated is in the file verlocal.h
+ * in the appropriate language subdirectory.
+ */
+
+
+#include <ver.h>
+#include "verlocal.h"
+
+//Default is nodebug
+#ifndef DEBUG
+#define VER_DEBUG 0
+#else
+#define VER_DEBUG VS_FF_DEBUG
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+#ifdef PUBLISHER
+ FILEVERSION 1,0,0,0
+#else
+ FILEVERSION 2,0,0,0
+#endif
+ PRODUCTVERSION 2,0,0,0
+ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+ FILEFLAGS VER_DEBUG
+ FILEOS VOS_DOS_WINDOWS16
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_UNKNOWN
+
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "CompanyName", "Microsoft Corporation\0", "\0"
+#ifdef PUBLISHER
+ VALUE "FileVersion", "1.00\0", "\0"
+ VALUE "InternalName", "PUBOLEUI", "\0"
+ VALUE "OriginalFilename","PUBOLEUI.DLL", "\0"
+ VALUE "ProductName", "Microsoft Publisher for Windows 2.0", "\0"
+ VALUE "ProductVersion", "2.00\0"
+#else
+ VALUE "FileVersion", "2.00\0", "\0"
+ VALUE "InternalName", "OLE2UI", "\0"
+ VALUE "OriginalFilename","OLE2UI.DLL", "\0"
+ VALUE "ProductName", "Microsoft Windows(TM) OLE 2.0 User Interface Support", "\0"
+ VALUE "ProductVersion", "2.00\0"
+#endif
+ VALUE "FileDescription", "Microsoft Windows(TM) OLE 2.0 User Interface Support", "\0"
+ VALUE "LegalCopyright", "Copyright \251 1992-1993 Microsoft Corp. All rights reserved.", "\0"
+ END
+
+#ifdef VER_LOC
+ /* Template for the localized version data. Only used for
+ non-USA versions. */
+ BLOCK szTranslation /* Language and codepage */
+ BEGIN
+ VALUE "CompanyName", szzCompanyName
+#ifdef PUBLISHER
+ VALUE "FileVersion", "1.00\0", "\0"
+ VALUE "InternalName", "PUBOLEUI", "\0"
+ VALUE "OriginalFilename","PUBOLEUI.DLL", "\0"
+ VALUE "ProductVersion", "2.00\0"
+#else
+ VALUE "FileVersion", "2.00\0", "\0"
+ VALUE "InternalName", "OLE2UI", "\0"
+ VALUE "OriginalFilename","OLE2UI.DLL", "\0"
+ VALUE "ProductVersion", "2.00\0"
+#endif
+ VALUE "FileDescription", szzFileDescription
+ VALUE "LegalCopyright", szzLegalCopyright
+ VALUE "ProductName", szzProductName
+ END
+#endif
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", wLanguage, 0x04E4
+ END
+ END
diff --git a/private/oleutest/utests16/ole2ui/res/usa/bang.ico b/private/oleutest/utests16/ole2ui/res/usa/bang.ico
new file mode 100644
index 000000000..90fe0f220
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/bang.ico
Binary files differ
diff --git a/private/oleutest/utests16/ole2ui/res/usa/busy.dlg b/private/oleutest/utests16/ole2ui/res/usa/busy.dlg
new file mode 100644
index 000000000..cb691c168
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/busy.dlg
@@ -0,0 +1,13 @@
+IDD_BUSY DIALOG DISCARDABLE 0, 0, 214, 76
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Server Busy"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "&Switch To...", IDBZ_SWITCHTO, 33, 55, 53, 15
+ PUSHBUTTON "&Cancel", IDCANCEL, 152, 55, 53, 15
+ PUSHBUTTON "&Retry", IDBZ_RETRY, 92, 55, 53, 15
+ LTEXT "This action cannot be completed because the other application is busy. Choose 'Switch To' to activate the busy application and correct the problem.", IDBZ_MESSAGE1, 35, 11, 167, 35
+ ICON "", IDBZ_ICON, 8, 18, 18, 20
+END
+
+
diff --git a/private/oleutest/utests16/ole2ui/res/usa/convert.dlg b/private/oleutest/utests16/ole2ui/res/usa/convert.dlg
new file mode 100644
index 000000000..68ea83d3a
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/convert.dlg
@@ -0,0 +1,32 @@
+
+IDD_CONVERT DIALOG 60, 26, 270, 146
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Convert"
+FONT 8, "MS Sans Serif"
+BEGIN
+ RTEXT "Current Type:", IDCV_STXCURTYPE, 5, 7, 47, 8
+ LTEXT "Current Object Type", IDCV_OBJECTTYPE, 55, 7, 129, 8
+ LTEXT "Object T&ype:", IDCV_STXCONVERTTO, 71, 21, 89, 8
+ LISTBOX IDCV_ACTIVATELIST, 71, 32, 118, 53,
+ LBS_USETABSTOPS | LBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+ LISTBOX IDCV_CONVERTLIST, 350, 180, 118, 53,
+ LBS_USETABSTOPS | LBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+ DEFPUSHBUTTON "OK", IDOK, 197, 6, 67, 14, WS_GROUP
+ PUSHBUTTON "Cancel", IDCANCEL, 197, 24, 66, 14
+ PUSHBUTTON "&Help", ID_OLEUIHELP, 197, 42, 66, 14
+ CONTROL "&Display As Icon", IDCV_DISPLAYASICON, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 200, 61, 64, 10
+ GROUPBOX "Result", IDCV_GRPRESULT, 6, 87, 183, 50
+ CONTROL "&Convert to:", IDCV_CONVERTTO, "Button",
+ BS_AUTORADIOBUTTON, 6, 34, 59, 10
+ CONTROL "&Activate as:", IDCV_ACTIVATEAS, "Button",
+ BS_AUTORADIOBUTTON, 7, 58, 59, 10
+ LTEXT "Result Text...", IDCV_RESULTTEXT, 11, 98, 174, 27
+ ICON "", IDCV_ICON, 221, 75, 18, 20
+ CTEXT "", IDCV_ICONLABEL1, 197, 100, 66, 8
+ CTEXT "", IDCV_ICONLABEL2, 197, 108, 66, 12
+ PUSHBUTTON "Change &Icon...", IDCV_CHANGEICON, 197, 121, 67, 14
+END
+
+
+
diff --git a/private/oleutest/utests16/ole2ui/res/usa/default.ico b/private/oleutest/utests16/ole2ui/res/usa/default.ico
new file mode 100644
index 000000000..4542c57d3
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/default.ico
Binary files differ
diff --git a/private/oleutest/utests16/ole2ui/res/usa/egares.bmp b/private/oleutest/utests16/ole2ui/res/usa/egares.bmp
new file mode 100644
index 000000000..e9dbb065a
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/egares.bmp
Binary files differ
diff --git a/private/oleutest/utests16/ole2ui/res/usa/fileopen.dlg b/private/oleutest/utests16/ole2ui/res/usa/fileopen.dlg
new file mode 100644
index 000000000..8d0b52c1a
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/fileopen.dlg
@@ -0,0 +1,33 @@
+DLGINCLUDE RCDATA DISCARDABLE
+BEGIN
+ "OLE2UI.H\0"
+END
+
+IDD_FILEOPEN DIALOG 36, 24, 264, 134
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Open"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "&Source:", stc3, 6, 3, 76, 9
+ EDITTEXT edt1, 7, 13, 195, 12, ES_AUTOHSCROLL | ES_OEMCONVERT
+ LISTBOX lst1, 6, 34, 90, 68, LBS_SORT | LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL |
+ WS_TABSTOP
+ LTEXT "&Directories:", ID_DUMMY, 110, 28, 92, 9
+ LTEXT "", stc1, 110, 36, 92, 9, SS_NOPREFIX
+ LISTBOX lst2, 110, 49, 92, 53, LBS_SORT | LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_VSCROLL |
+ WS_TABSTOP
+ LTEXT "List Files of &Type:", stc2, 6, 104, 90, 9
+ COMBOBOX cmb1, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
+ WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Dri&ves:", stc4, 110, 104, 92, 9
+ COMBOBOX cmb2, 110, 114, 92, 68, CBS_DROPDOWNLIST |
+ CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT |
+ CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK", IDOK, 208, 6, 50, 14, WS_GROUP
+ PUSHBUTTON "Cancel", IDCANCEL, 208, 24, 50, 14, WS_GROUP
+ PUSHBUTTON "&Help", IDHELP, 208, 46, 50, 14, WS_GROUP
+ CONTROL "&Read Only", chx1, "Button", BS_AUTOCHECKBOX | WS_GROUP |
+ WS_TABSTOP, 208, 68, 50, 12
+END
diff --git a/private/oleutest/utests16/ole2ui/res/usa/hivgares.bmp b/private/oleutest/utests16/ole2ui/res/usa/hivgares.bmp
new file mode 100644
index 000000000..0011166da
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/hivgares.bmp
Binary files differ
diff --git a/private/oleutest/utests16/ole2ui/res/usa/icon.dlg b/private/oleutest/utests16/ole2ui/res/usa/icon.dlg
new file mode 100644
index 000000000..9d25d1dec
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/icon.dlg
@@ -0,0 +1,48 @@
+// DLGINCLUDE RCDATA DISCARDABLE
+// BEGIN
+// "OLE2UI.H\0"
+// END
+
+
+IDD_CHANGEICON DIALOG 18, 18, 261, 152
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Change Icon"
+FONT 8, "MS Sans Serif"
+BEGIN
+ GROUPBOX "Icon", ID_GROUP, 4, 6, 180, 124
+ CONTROL "&Current:", ID_CURRENT, "Button", BS_AUTORADIOBUTTON |
+ WS_GROUP , 10, 19, 46, 10
+
+ CONTROL "&Default:", ID_DEFAULT, "Button", BS_AUTORADIOBUTTON,
+ 10, 44, 46, 10
+
+ CONTROL "&From File:", ID_FROMFILE, "Button", BS_AUTORADIOBUTTON,
+ 10, 68, 46, 10
+
+ ICON "", ID_CURRENTICON, 58, 15, 18, 20
+
+ ICON "", ID_DEFAULTICON, 58, 40, 18, 20
+
+ EDITTEXT ID_FROMFILEEDIT, 58, 68, 119, 12, ES_LOWERCASE |
+ ES_AUTOHSCROLL | WS_GROUP | ES_OEMCONVERT
+
+ LISTBOX ID_ICONLIST, 58, 84, 119, 40, LBS_OWNERDRAWFIXED |
+ LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL |
+ WS_TABSTOP
+
+ LTEXT "&Label:", ID_LABEL, 6, 138, 32, 8
+
+ EDITTEXT ID_LABELEDIT, 38, 136, 146, 12, ES_AUTOHSCROLL
+
+ DEFPUSHBUTTON "OK", IDOK, 189, 6, 66, 14
+
+ PUSHBUTTON "Cancel", IDCANCEL, 189, 23, 66, 14
+
+ PUSHBUTTON "&Browse...", ID_BROWSE, 189, 41, 66, 14
+
+ PUSHBUTTON "&Help", ID_OLEUIHELP, 189, 59, 66, 14
+
+ CTEXT "", ID_RESULTLABEL, 193, 114, 63, 24
+ ICON "", ID_RESULTICON, 214, 90, 18, 20
+END
+
diff --git a/private/oleutest/utests16/ole2ui/res/usa/insobj.dlg b/private/oleutest/utests16/ole2ui/res/usa/insobj.dlg
new file mode 100644
index 000000000..1a51a5205
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/insobj.dlg
@@ -0,0 +1,52 @@
+//DLGINCLUDE RCDATA DISCARDABLE
+//BEGIN
+// "OLE2UI.H\0"
+//END
+
+IDD_INSERTOBJECT DIALOG 6, 18, 291, 150
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Insert Object"
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "Create &New:", ID_IO_CREATENEW, "Button",
+ BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 6, 18, 67, 10
+
+ CONTROL "Create from &File:", ID_IO_CREATEFROMFILE, "Button",
+ BS_AUTORADIOBUTTON | WS_TABSTOP, 6, 36, 67, 10
+
+ LTEXT "Object &Type:", ID_IO_OBJECTTYPETEXT, 84, 4, 110, 8
+
+ LISTBOX ID_IO_OBJECTTYPELIST, 82, 16, 132, 73, LBS_SORT |
+ LBS_USETABSTOPS | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+
+ LTEXT "Fil&e:", ID_IO_FILETEXT, 82, 24, 20, 8
+ LTEXT "", ID_IO_FILETYPE, 120, 24, 80, 8
+
+ EDITTEXT ID_IO_FILEDISPLAY, 82, 34, 132, 12, ES_AUTOHSCROLL | ES_LOWERCASE | ES_OEMCONVERT
+
+ PUSHBUTTON "&Browse...", ID_IO_FILE, 82, 50, 48, 14
+
+ CONTROL "&Link", ID_IO_LINKFILE, "Button", BS_AUTOCHECKBOX |
+ WS_TABSTOP, 140, 52, 40, 10
+
+ DEFPUSHBUTTON "OK", IDOK, 222, 6, 66, 14, WS_GROUP
+
+ PUSHBUTTON "Cancel", IDCANCEL, 222, 24, 66, 14
+
+ PUSHBUTTON "&Help", ID_OLEUIHELP, 222, 42, 66, 14
+
+ CONTROL "&Display As Icon", ID_IO_DISPLAYASICON, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 222, 64, 66, 10
+
+ CONTROL "", ID_IO_ICONDISPLAY, SZCLASSICONBOX, 0, 220, 80, 66, 46
+
+ PUSHBUTTON "Change &Icon...", ID_IO_CHANGEICON, 222, 127, 66, 14
+
+ GROUPBOX "Result", ID_STATIC, 6, 96, 210, 47, WS_GROUP
+
+ CONTROL "", ID_IO_RESULTIMAGE, SZCLASSRESULTIMAGE, 0, 10, 106, 42, 34
+
+ LTEXT "Result", ID_IO_RESULTTEXT, 56, 106, 156, 32, SS_NOPREFIX |
+ NOT WS_GROUP
+END
+
diff --git a/private/oleutest/utests16/ole2ui/res/usa/links.dlg b/private/oleutest/utests16/ole2ui/res/usa/links.dlg
new file mode 100644
index 000000000..3682e4cf1
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/links.dlg
@@ -0,0 +1,35 @@
+// DLGINCLUDE RCDATA DISCARDABLE
+// BEGIN
+// "OLE2UI.H\0"
+// END
+
+IDD_EDITLINKS DIALOG 9, 25, 320, 158
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Links"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "&Links:", ID_EL_COL1, 11, 11, 26, 8
+ LTEXT "Type", ID_EL_COL2, 137, 12, 20, 8
+ LTEXT "Update", ID_EL_COL3, 201, 12, 25, 8
+ LISTBOX ID_EL_LINKSLISTBOX, 11, 23, 229, 81, LBS_OWNERDRAWFIXED
+ | LBS_EXTENDEDSEL | WS_VSCROLL | LBS_USETABSTOPS
+ | WS_TABSTOP | LBS_SORT | LBS_NOTIFY
+ DEFPUSHBUTTON "Cancel", IDCANCEL, 249, 12, 66, 14
+ PUSHBUTTON "&Update Now", ID_EL_UPDATENOW, 249, 36, 66, 14
+ PUSHBUTTON "&Open Source", ID_EL_OPENSOURCE, 249, 54, 66, 14,
+ WS_GROUP
+ PUSHBUTTON "&Change Source...", ID_EL_CHANGESOURCE, 249, 72, 66, 14,
+ WS_GROUP
+ PUSHBUTTON "&Break Link", ID_EL_CANCELLINK, 249, 96, 66, 14
+ PUSHBUTTON "&Help", ID_OLEUIHELP, 249, 138, 66, 14
+ CONTROL "&Automatic", ID_EL_AUTOMATIC, "Button",
+ BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 61, 138, 65,
+ 10
+ CONTROL "&Manual", ID_EL_MANUAL, "Button", BS_AUTORADIOBUTTON,
+ 130, 138, 39, 10
+ LTEXT "Source:", 219, 9, 113, 30, 8
+ LTEXT "Type:", 220, 9, 125, 20, 8
+ LTEXT "Update:", ID_EL_UPDATE, 9, 139, 32, 8
+ LTEXT "", ID_EL_LINKSOURCE, 45, 113, 195, 8, SS_NOPREFIX
+ LTEXT "", ID_EL_LINKTYPE, 45, 125, 195, 8, SS_NOPREFIX
+END
diff --git a/private/oleutest/utests16/ole2ui/res/usa/pastespl.dlg b/private/oleutest/utests16/ole2ui/res/usa/pastespl.dlg
new file mode 100644
index 000000000..bea203b80
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/pastespl.dlg
@@ -0,0 +1,40 @@
+// DLGINCLUDE RCDATA DISCARDABLE
+// BEGIN
+// "PASTESPL.H\0"
+// END
+
+IDD_PASTESPECIAL DIALOG 3, 15, 293, 140
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Paste Special"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "Source:", ID_PS_STXSOURCE, 6, 9, 30, 8
+ LTEXT "", ID_PS_SOURCETEXT, 37, 9, 180, 8, SS_NOPREFIX | NOT
+ WS_GROUP
+ CONTROL "&Paste:", ID_PS_PASTE, "Button", BS_AUTORADIOBUTTON |
+ WS_GROUP | WS_TABSTOP, 6, 38, 55, 10
+ CONTROL "Paste &Link:", ID_PS_PASTELINK, "Button",
+ BS_AUTORADIOBUTTON, 6, 63, 55, 10
+ LTEXT "&As:", ID_PS_STXAS, 65, 25, 16, 8
+ LISTBOX ID_PS_PASTELIST, 65, 36, 153, 57, LBS_USETABSTOPS |
+ WS_VSCROLL | WS_GROUP | WS_TABSTOP | NOT WS_VISIBLE
+ LISTBOX ID_PS_PASTELINKLIST, 65, 36, 153, 57, LBS_USETABSTOPS |
+ WS_VSCROLL | WS_GROUP | WS_TABSTOP | NOT WS_VISIBLE
+ LISTBOX ID_PS_DISPLAYLIST, 65, 36, 153, 57, LBS_USETABSTOPS |
+ WS_VSCROLL | WS_GROUP | WS_TABSTOP
+ DEFPUSHBUTTON "OK", IDOK, 224, 6, 66, 14, WS_GROUP
+ PUSHBUTTON "Cancel", IDCANCEL, 224, 23, 66, 14
+ PUSHBUTTON "&Help", ID_OLEUIHELP, 224, 42, 66, 14
+ CONTROL "&Display As Icon", ID_PS_DISPLAYASICON, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 224, 59, 66, 14
+ CONTROL "", ID_PS_ICONDISPLAY, SZCLASSICONBOX, 0, 224, 75, 66, 44
+ PUSHBUTTON "Change &Icon...", ID_PS_CHANGEICON, 224, 123, 66, 14
+ CONTROL "", ID_PS_RESULTIMAGE, SZCLASSRESULTIMAGE, 0, 8, 101,
+ 42, 34
+ LTEXT "Result", ID_PS_RESULTTEXT, 54, 100, 159, 35,
+ SS_NOPREFIX | NOT WS_GROUP
+ GROUPBOX "Result", ID_PS_RESULTGROUP, 6, 90, 212, 48, WS_GROUP
+END
+
+
+
diff --git a/private/oleutest/utests16/ole2ui/res/usa/prompt.dlg b/private/oleutest/utests16/ole2ui/res/usa/prompt.dlg
new file mode 100644
index 000000000..28047bc5b
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/prompt.dlg
@@ -0,0 +1,80 @@
+Exclamation ICON bang.ico
+
+
+IDD_LINKSOURCEUNAVAILABLE DIALOG 21, 34, 175, 78
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION ""
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON "Exclamation", ID_DUMMY, 8, 8, 0, 0, SS_ICON
+ LTEXT "This action cannot be completed because the selected link's source is presently unavailable.", ID_PU_TEXT, 48, 8, 117, 32
+ DEFPUSHBUTTON "OK", IDOK, 39, 58, 40, 14
+ PUSHBUTTON "&Links...", ID_PU_LINKS, 95, 58, 40, 14
+END
+
+
+IDD_CANNOTUPDATELINK DIALOG 21, 34, 175, 78
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION ""
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON "Exclamation", ID_DUMMY, 8, 8, 0, 0, SS_ICON
+ LTEXT "Some links could not be updated because their sources are presently unavailable.", ID_PU_TEXT, 48, 8, 117, 32
+ DEFPUSHBUTTON "OK", IDOK, 39, 58, 40, 14
+ PUSHBUTTON "&Links...", ID_PU_LINKS, 95, 58, 40, 14
+END
+
+
+IDD_SERVERNOTREG DIALOG 39, 30, 198, 78
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON "Exclamation", ID_DUMMY, 8, 8, 0, 0, SS_ICON
+ LTEXT "The application necessary to activate this %s is unavailable. You may convert it to or activate it as another type of object using Convert...", ID_PU_TEXT, 39, 8, 152, 36
+ DEFPUSHBUTTON "&Convert...", ID_PU_CONVERT, 23, 58, 40, 14
+ PUSHBUTTON "Cancel", IDCANCEL, 79, 58, 40, 14
+ PUSHBUTTON "&Help", ID_OLEUIHELP, 135, 58, 40, 14
+END
+
+
+IDD_LINKTYPECHANGED DIALOG 39, 30, 198, 78
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON "Exclamation", ID_DUMMY, 8, 8, 0, 0, SS_ICON
+ LTEXT "The link is no longer a %s. Please choose a different command offered by the new type.",
+ ID_PU_TEXT, 39, 8, 152, 36
+ PUSHBUTTON "OK", IDOK, 79, 58, 40, 14
+END
+
+
+IDD_SERVERNOTFOUND DIALOG 36, 39, 183, 90
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON "Exclamation", ID_DUMMY, 8, 8, 0, 0, SS_ICON
+ LTEXT "The server application cannot be found.\n\nMake sure the application is properly installed, or exists in your DOS path, and that is has not been deleted, moved, or renamed.",
+ ID_PU_TEXT, 38, 8, 136, 52
+ DEFPUSHBUTTON "OK", IDOK, 71, 70, 40, 14
+END
+
+
+IDD_UPDATELINKS DIALOG 50, 57, 179, 55
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "", ID_PU_METER, "Static", SS_BLACKFRAME, 5, 40, 122, 9
+ DEFPUSHBUTTON "&Stop", ID_PU_STOP, 134, 37, 40, 14
+ LTEXT "Update links...", ID_DUMMY, 5, 7, 56, 8
+ LTEXT "", ID_PU_PERCENT, 56, 26, 20, 8
+END
+
+
+IDD_OUTOFMEMORY DIALOG 36, 39, 107, 73
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON "Exclamation", ID_DUMMY, 8, 8, 0, 0, SS_ICON
+ LTEXT "Out of memory!", ID_PU_TEXT, 41, 13, 57, 12
+ DEFPUSHBUTTON "OK", IDOK, 33, 53, 40, 14
+END
diff --git a/private/oleutest/utests16/ole2ui/res/usa/strings.rc b/private/oleutest/utests16/ole2ui/res/usa/strings.rc
new file mode 100644
index 000000000..f3f8c415a
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/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/utests16/ole2ui/res/usa/verlocal.h b/private/oleutest/utests16/ole2ui/res/usa/verlocal.h
new file mode 100644
index 000000000..92b7000c8
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/verlocal.h
@@ -0,0 +1,54 @@
+/*
+ * VERLOCAL.H
+ *
+ * Version resource file for the OLE 2.0 UI Support DLL.
+ *
+ * Copyright (c)1993 Microsoft Corporation, All Rights Reserved.
+ *
+ * This file contains the text that needs to be translated in the version
+ * resource. All of the following variables must be localized:
+ *
+ * wLanguage
+ * szTranslation
+ * szzCompanyName
+ * szzProductName
+ * szzLegalCopyright
+ */
+
+/* wLanguage comes from the table of "langID" values on page 218 of
+ the Windows 3.1 SDK Programmer's Reference, Volume 4: Resources.
+ This page is in Chapter 13, "Resource-Definition Statements", in the
+ description of the "VERSIONINFO" statment.
+
+ For example,
+ 0x0407 German
+ 0x0409 U.S. English
+ 0x0809 U.K. English
+ 0x040C French
+ 0x040A Castilian Spanish
+*/
+#define wLanguage 0x0409 /* U.S. English */
+
+/* The first 4 characters of szTranslation must be the same as wLanguage,
+ without the "0x". The last 4 characters of szTranslation MUST be
+ 04E4. Note that any alphabetic characters in szTranslation must
+ be capitalized. */
+#define szTranslation "040904E4" /* U.S. English */
+
+
+/* The following szz strings must all end with the two characters "\0" */
+/* Note that the "\251" in szzLegalCopyright stands for the "circle c"
+ copyright symbol, and it should be left as \251 rather than
+ substituting the actual ANSI copyright character in the string. */
+#define szzCompanyName "Microsoft Corporation\0"
+#define szzFileDescription "Microsoft Windows(TM) OLE 2.0 User Interface Support\0"
+#define szzLegalCopyright "Copyright \251 1992-1993 Microsoft Corp. All rights reserved.\0"
+
+#ifdef PUBLISHER
+#define szzProductName "Microsoft Publisher for Windows 2.0\0"
+#else
+#define szzProductName szzFileDescription
+#endif
+
+
+/* DO NOT CHANGE ANY LINES BELOW THIS POINT */
diff --git a/private/oleutest/utests16/ole2ui/res/usa/vgares.bmp b/private/oleutest/utests16/ole2ui/res/usa/vgares.bmp
new file mode 100644
index 000000000..496902f9f
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/res/usa/vgares.bmp
Binary files differ
diff --git a/private/oleutest/utests16/ole2ui/strings.rc b/private/oleutest/utests16/ole2ui/strings.rc
new file mode 100644
index 000000000..f3f8c415a
--- /dev/null
+++ b/private/oleutest/utests16/ole2ui/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/utests16/simpdnd/app.cpp b/private/oleutest/utests16/simpdnd/app.cpp
new file mode 100644
index 000000000..174ea4b19
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/app.cpp
@@ -0,0 +1,710 @@
+//**********************************************************************
+// 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>
+
+//**********************************************************************
+//
+// CSimpleApp::CSimpleApp()
+//
+// Purpose:
+//
+// Constructor for CSimpleApp
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// SetRectEmpty Windows API
+//
+// Comments:
+//
+//********************************************************************
+CSimpleApp::CSimpleApp()
+{
+ TestDebugOut("In CSimpleApp's Constructor \r\n");
+
+ // Set Ref Count
+ m_nCount = 0;
+
+ // clear members
+ m_hAppWnd = NULL;
+ m_hDriverWnd = NULL;
+ m_hInst = NULL;
+ m_lpDoc = NULL;
+
+ // clear flags
+ m_fInitialized = FALSE;
+}
+
+//**********************************************************************
+//
+// CSimpleApp::~CSimpleApp()
+//
+// Purpose:
+//
+// Destructor for CSimpleApp Class.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleUninitialize OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpleApp::DestroyDocs()
+{
+ m_lpDoc->Close(); // we have only 1 document
+}
+
+//**********************************************************************
+//
+// CSimpleApp::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation at the Frame 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
+//
+// Comments:
+//
+//********************************************************************
+
+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 this level
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the application.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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; // Application that owns the class.
+ wc.hIcon = LoadIcon(hInstance,"SimpDnd");
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = "SIMPLEMENU"; // Name of menu resource in .RC file.
+ wc.lpszClassName = "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; // Application that owns the class.
+ wc.hIcon = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "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
+// OleBuildVersion OLE API
+// OleInitialize OLE API
+//
+// 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)
+{
+ DWORD dwVer = OleBuildVersion();
+ LPMALLOC lpMalloc = NULL;
+
+#ifdef NO
+ // 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
+
+#if defined( _DEBUG )
+ /* OLE2NOTE: Use a special debug allocator to help track down
+ ** memory leaks.
+ */
+ OleStdCreateDbAlloc(0, &lpMalloc);
+#endif
+
+ if (OleInitialize(lpMalloc) == NOERROR)
+ 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;
+
+ // Create the "application" windows
+ m_hAppWnd = CreateWindow ("SimpDndAppWClass",
+ "Simple OLE 2.0 Drag/Drop Container",
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ NULL,
+ NULL,
+ 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(
+ "windows",
+ "DragDelay",
+ DD_DEFDRAGDELAY
+ );
+
+ // minimum distance (radius) before drag should start, in pixels
+ m_nDragMinDist = GetProfileInt(
+ "windows",
+ "DragMinDist",
+ DD_DEFDRAGMINDIST
+ );
+
+ // delay before scrolling, in milliseconds
+ m_nScrollDelay = GetProfileInt(
+ "windows",
+ "DragScrollDelay",
+ DD_DEFSCROLLDELAY
+ );
+
+ // inset-width of the hot zone, in pixels
+ m_nScrollInset = GetProfileInt(
+ "windows",
+ "DragScrollInset",
+ DD_DEFSCROLLINSET
+ );
+
+ // scroll interval, in milliseconds
+ m_nScrollInterval = GetProfileInt(
+ "windows",
+ "DragScrollInterval",
+ DD_DEFSCROLLINTERVAL
+ );
+
+ ShowWindow (m_hAppWnd, nCmdShow);
+ UpdateWindow (m_hAppWnd);
+
+ return m_fInitialized;
+}
+
+//**********************************************************************
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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);
+
+ m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
+ wParam - IDM_VERB0, NULL,
+ &m_lpDoc->m_lpSite->m_OleClientSite, -1,
+ m_lpDoc->m_hDocWnd, &rect);
+ }
+ else
+ {
+ switch (wParam) {
+ // bring up the About box
+ case IDM_ABOUT:
+ {
+ FARPROC lpProcAbout = MakeProcInstance((FARPROC)About, m_hInst);
+
+ DialogBox(m_hInst, // current instance
+ "AboutBox", // resource to use
+ m_hAppWnd, // parent handle
+ lpProcAbout); // About() instance address
+
+ FreeProcInstance(lpProcAbout);
+ 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:
+ m_lpDoc->Close();
+ m_lpDoc = NULL;
+ lCreateDoc(hWnd, 0, 0, 0);
+ 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
+//
+// Comments:
+//
+//********************************************************************
+
+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.
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+long CSimpleApp::lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+
+ GetClientRect(hWnd, &rect);
+
+ m_lpDoc = CSimpleDoc::Create(this, &rect, hWnd);
+
+ 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
+//
+// Comments:
+//
+//********************************************************************
+
+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/utests16/simpdnd/app.h b/private/oleutest/utests16/simpdnd/app.h
new file mode 100644
index 000000000..0205e06ef
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/app.h
@@ -0,0 +1,63 @@
+//**********************************************************************
+// 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)
+
+ 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();
+};
+
+#endif // _APP_H_
diff --git a/private/oleutest/utests16/simpdnd/doc.cpp b/private/oleutest/utests16/simpdnd/doc.cpp
new file mode 100644
index 000000000..722280d55
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/doc.cpp
@@ -0,0 +1,722 @@
+//**********************************************************************
+// 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
+//
+// 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)
+ 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(
+ "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
+
+ // 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);
+
+ // 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.
+ CoLockObjectExternal (&lpTemp->m_DropTarget, TRUE, 0);
+
+ // Register our window as a DropTarget
+ RegisterDragDrop(lpTemp->m_hDocWnd, &lpTemp->m_DropTarget);
+ lpTemp->m_fRegDragDrop = TRUE;
+
+ return (lpTemp);
+
+error:
+ 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:
+//
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// RevokeDragDrop OLE API
+// CoLockObjectExternal OLE API
+// OleFlushClipboard OLE API
+// ShowWindow Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpleDoc::Close(void)
+{
+ TestDebugOut("In CSimpleDoc::Close\r\n");
+
+ 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.
+ OleFlushClipboard();
+
+ // Revoke our window as a DropTarget
+ if (m_fRegDragDrop) {
+ RevokeDragDrop(m_hDocWnd);
+ 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.
+ CoLockObjectExternal (&m_DropTarget, FALSE, TRUE);
+}
+
+//**********************************************************************
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+#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
+// CSimpleSite::Release SITE.CPP
+// IStorage::Release OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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:
+//
+// 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
+// ResultFromScode OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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 ( riid == IID_IUnknown)
+ {
+ AddRef();
+ *ppvObj = this;
+ return ResultFromScode(S_OK);
+ }
+
+ // looking for IDropTarget
+ if ( riid == IID_IDropTarget)
+ {
+ m_DropTarget.AddRef();
+ *ppvObj=&m_DropTarget;
+ return ResultFromScode(S_OK);
+ }
+
+ // looking for IDropSource
+ if ( 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 current reference count on the document
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleApp::AddRef APP.CPP
+//
+// Comments:
+//
+//********************************************************************
+
+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 current reference count on the document
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+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::CSimpleSite SITE.CPP
+// CSimpleSite::InitObject SITE.CPP
+// memset C Runtime
+// OleUIInsertObject OUTLUI 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;
+ char szFile[OLEUI_CCHPATHMAX];
+
+ m_lpSite = CSimpleSite::Create(this);
+
+ // 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 = (LPSTR)"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);
+ _fmemset((LPSTR)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;
+ m_lpStorage->Revert();
+ }
+
+}
+
+//**********************************************************************
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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 OUTLUI function
+//
+// Comments:
+//
+//********************************************************************
+
+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);
+
+ 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);
+
+ 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
+//
+// Comments:
+//
+//********************************************************************
+
+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)
+{
+ // 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);
+
+ // We no longer accept dropping of objects
+ if (m_fRegDragDrop) {
+ RevokeDragDrop(m_hDocWnd);
+ 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::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) {
+ MessageBox(NULL,"Out-of-memory","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.
+ OleSetClipboard(lpDataObj);
+
+ // Give ownership of data transfer object to clipboard
+ pDataXferObj->Release();
+}
diff --git a/private/oleutest/utests16/simpdnd/doc.h b/private/oleutest/utests16/simpdnd/doc.h
new file mode 100644
index 000000000..f1703d582
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/doc.h
@@ -0,0 +1,70 @@
+//**********************************************************************
+// 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...*/ }
+};
+
+#endif // _DOC_H_
diff --git a/private/oleutest/utests16/simpdnd/dxferobj.cpp b/private/oleutest/utests16/simpdnd/dxferobj.cpp
new file mode 100644
index 000000000..91f2a5fe4
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/dxferobj.cpp
@@ -0,0 +1,574 @@
+//**********************************************************************
+// 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"
+
+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;
+
+ lpSite->m_lpOleObject->QueryInterface(IID_IPersistStorage,
+ (LPVOID FAR*)&pPersistStorage);
+ assert(pPersistStorage);
+ OleSave(pPersistStorage, lpTemp->m_lpObjStorage, FALSE);
+
+ // pass NULL so that object application won't forget the real stg
+ pPersistStorage->SaveCompleted(NULL);
+ pPersistStorage->Release();
+ } else {
+ // Object not loaded so use cheaper IStorage CopyTo operation
+ lpSite->m_lpObjStorage->CopyTo(0, NULL, NULL, lpTemp->m_lpObjStorage);
+ }
+
+ OleLoad(lpTemp->m_lpObjStorage, IID_IOleObject, NULL,
+ (LPVOID FAR*)&lpTemp->m_lpOleObject);
+ 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CDataXferObj::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CDataXferObj::QueryInterface\r\n");
+
+ if ( riid == IID_IUnknown || 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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;
+
+ return ResultFromScode(sc);
+}
+
+
+STDMETHODIMP CDataXferObj::EnumFormatEtc(
+ DWORD dwDirection,
+ LPENUMFORMATETC FAR* ppenumFormatEtc
+)
+{
+ SCODE sc = E_NOTIMPL;
+
+ TestDebugOut("In CDataXferObj::EnumFormatEtc\r\n");
+ *ppenumFormatEtc = NULL;
+
+ 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
+// ResultFromScode OLE API
+//
+// 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.
+ */
+ m_lpOleObject->QueryInterface(
+ IID_IPersistStorage, (LPVOID FAR*)&pPersistStorage);
+ 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,
+ "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;
+ }
+ }
+
+ 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:
+//
+// DATA_E_FORMATETC - We don't support the requested format
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleStdGetOleObjectData OLE2UI API
+//
+// Comments:
+//
+//********************************************************************
+
+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.
+ */
+ m_lpOleObject->QueryInterface(
+ IID_IPersistStorage, (LPVOID FAR*)&pPersistStorage);
+ 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/utests16/simpdnd/dxferobj.h b/private/oleutest/utests16/simpdnd/dxferobj.h
new file mode 100644
index 000000000..5b468b394
--- /dev/null
+++ b/private/oleutest/utests16/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/utests16/simpdnd/ias.cpp b/private/oleutest/utests16/simpdnd/ias.cpp
new file mode 100644
index 000000000..52e593e20
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/ias.cpp
@@ -0,0 +1,316 @@
+//**********************************************************************
+// 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:
+//
+// Returns a pointer to a requested interface.
+//
+// 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 this interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The current reference count on this interface.
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::AddReff SITE.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function adds one to the ref count of the interface,
+// and calls then calls CSimpleSite to increment its ref.
+// count.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CAdviseSink::AddRef()
+{
+ TestDebugOut("In IAS::AddRef\r\n");
+
+ // increment the interface reference count (for debugging only)
+ ++m_nCount;
+
+ // delegate to the container Site
+ return m_pSite->AddRef();
+}
+
+//**********************************************************************
+//
+// CAdviseSink::Release
+//
+// Purpose:
+//
+// Decrements the reference count on this interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The current reference count on this interface.
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleSite::Release SITE.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function subtracts one from the ref count of the interface,
+// and calls then calls CSimpleSite to decrement its ref.
+// count.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CAdviseSink::Release()
+{
+ TestDebugOut("In IAS::Release\r\n");
+
+ // decrement the interface reference count (for debugging only)
+ m_nCount--;
+
+ // delegate to the container Site
+ return m_pSite->Release();
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnDataChange
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Return Value:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Not Implemented (needs to be stubbed out)
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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();
+ }
+
+ InvalidateRect(m_pSite->m_lpDoc->m_hDocWnd, NULL, TRUE);
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnRename
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Return Value:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Not Implemented (needs to be stubbed out)
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnRename (LPMONIKER pmk)
+{
+ TestDebugOut("In IAS::OnRename\r\n");
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnSave
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Return Value:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Not Implemented (needs to be stubbed out)
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnSave ()
+{
+ TestDebugOut("In IAS::OnSave\r\n");
+}
+
+//**********************************************************************
+//
+// CAdviseSink::OnClose
+//
+// Purpose:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Parameters:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Return Value:
+//
+// Not Implemented (needs to be stubbed out)
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Not Implemented (needs to be stubbed out)
+//
+//********************************************************************
+
+STDMETHODIMP_(void) CAdviseSink::OnClose()
+{
+ TestDebugOut("In IAS::OnClose\r\n");
+}
diff --git a/private/oleutest/utests16/simpdnd/ias.h b/private/oleutest/utests16/simpdnd/ias.h
new file mode 100644
index 000000000..3d948f5dc
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/ias.h
@@ -0,0 +1,44 @@
+//**********************************************************************
+// 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
+{
+ int m_nCount;
+ CSimpleSite FAR * m_pSite;
+
+ CAdviseSink(CSimpleSite FAR * pSite) {
+ TestDebugOut("In IAS's constructor\r\n");
+ m_pSite = pSite;
+ m_nCount = 0;
+ };
+
+ ~CAdviseSink() {
+ TestDebugOut("In IAS's destructor\r\n");
+ assert(m_nCount == 0);
+ } ;
+
+ 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/utests16/simpdnd/ids.cpp b/private/oleutest/utests16/simpdnd/ids.cpp
new file mode 100644
index 000000000..35870af83
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/ids.cpp
@@ -0,0 +1,330 @@
+//**********************************************************************
+// 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 "doc.h"
+#include "site.h"
+#include "dxferobj.h"
+
+
+//**********************************************************************
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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,"Out-of-memory","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;
+
+ ::DoDragDrop ( lpDataObj,
+ &m_DropSource,
+ DROPEFFECT_COPY, // we only allow copy
+ &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 ) {
+ // ... delete source object here (we do NOT support MOVE)
+ }
+
+ 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
+//
+// Comments:
+//
+//********************************************************************
+
+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 on this interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The current reference count on this interface.
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleObj::AddReff OBJ.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function adds one to the ref count of the interface,
+// and calls then calls CSimpleDoc to increment its ref.
+// count.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropSource::AddRef()
+{
+ TestDebugOut("In IDS::AddRef\r\n");
+
+ // increment the interface reference count (for debugging only)
+ ++m_nCount;
+
+ // delegate to the document Object
+ return m_pDoc->AddRef();
+}
+
+//**********************************************************************
+//
+// CDropSource::Release
+//
+// Purpose:
+//
+// Decrements the reference count on this interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The current reference count on this interface.
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleObj::Release OBJ.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function subtracts one from the ref count of the interface,
+// and calls then calls CSimpleDoc to decrement its ref.
+// count.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropSource::Release()
+{
+ TestDebugOut("In IDS::Release\r\n");
+
+ // decrement the interface reference count (for debugging only)
+ --m_nCount;
+
+ // 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+STDMETHODIMP CDropSource::GiveFeedback (DWORD dwEffect)
+{
+ return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS);
+}
diff --git a/private/oleutest/utests16/simpdnd/ids.h b/private/oleutest/utests16/simpdnd/ids.h
new file mode 100644
index 000000000..0046c1b51
--- /dev/null
+++ b/private/oleutest/utests16/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
+{
+ int m_nCount;
+ CSimpleDoc FAR * m_pDoc;
+
+ CDropSource(CSimpleDoc FAR * pDoc) {
+ TestDebugOut("In IDS's constructor\r\n");
+ m_pDoc = pDoc;
+ m_nCount = 0;
+ };
+
+ ~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/utests16/simpdnd/idt.cpp b/private/oleutest/utests16/simpdnd/idt.cpp
new file mode 100644
index 000000000..006dcc117
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/idt.cpp
@@ -0,0 +1,814 @@
+//**********************************************************************
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+BOOL CDropTarget::QueryDrop (
+ DWORD grfKeyState,
+ POINTL pointl,
+ BOOL fDragScroll,
+ LPDWORD pdwEffect
+)
+{
+ DWORD dwScrollEffect = 0L;
+ DWORD dwOKEffects = *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 = 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 = 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 known 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
+// GlobalUnlock WINDOWS API
+// HighlightRect IDT.CPP
+//
+// Comments:
+// In order to known 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
+// HighlightRect IDT.CPP
+// GetDC WINDOWS API
+// ReleaseDC WINDOWS API
+//
+// Comments:
+//
+//********************************************************************
+
+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:
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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 on this interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The current reference count on this interface.
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::AddReff DOC.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function adds one to the ref count of the interface,
+// and calls then calls CSimpleObj to increment its ref.
+// count.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropTarget::AddRef()
+{
+ TestDebugOut("In IDT::AddRef\r\n");
+
+ // increment the interface reference count (for debugging only)
+ ++m_nCount;
+
+ // delegate to the document Object
+ return m_pDoc->AddRef();
+}
+
+//**********************************************************************
+//
+// CDropTarget::Release
+//
+// Purpose:
+//
+// Decrements the reference count on this interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The current reference count on this interface.
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleDoc::Release DOC.CPP
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function subtracts one from the ref count of the interface,
+// and calls then calls CSimpleDoc to decrement its ref.
+// count.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDropTarget::Release()
+{
+ TestDebugOut("In IDT::Release\r\n");
+
+ // decrement the interface reference count (for debugging only)
+ --m_nCount;
+
+ // 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:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleQueryCreateFromData OLE2 API
+// DoDragScroll IDT.CPP
+// QueryDrop IDT.CPP
+// InitDragFeedback 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.
+//
+//********************************************************************
+
+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 );
+
+ 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:
+//
+// S_OK
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// 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);
+ // 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/utests16/simpdnd/idt.h b/private/oleutest/utests16/simpdnd/idt.h
new file mode 100644
index 000000000..50610d1e8
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/idt.h
@@ -0,0 +1,77 @@
+//**********************************************************************
+// 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
+{
+ int m_nCount; // reference count
+ 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_nCount = 0;
+ 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");
+ assert(m_nCount == 0);
+ } ;
+
+ 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/utests16/simpdnd/iocs.cpp b/private/oleutest/utests16/simpdnd/iocs.cpp
new file mode 100644
index 000000000..e4503f99d
--- /dev/null
+++ b/private/oleutest/utests16/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 at this interface
+//
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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);
+}
+
+//**********************************************************************
+//
+// CSimpleApp::AddRef
+//
+// Purpose:
+//
+// Adds to the reference count at the interface level.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the interface
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleClientSite::AddRef()
+{
+ TestDebugOut("In IOCS::AddRef\r\n");
+
+ // increment the interface reference count (for debugging only)
+ ++m_nCount;
+
+ // delegate to the container Site
+ return m_pSite->AddRef();
+}
+
+
+//**********************************************************************
+//
+// CSimpleApp::Release
+//
+// Purpose:
+//
+// Decrements the reference count at this level
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the interface.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleClientSite::Release()
+{
+ TestDebugOut("In IOCS::Release\r\n");
+
+ // decrement the interface reference count (for debugging only)
+ --m_nCount;
+
+ // 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
+// OleSave OLE API
+// ResultFromScode OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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:
+//
+// Not Implemented
+//
+// Return Value:
+//
+// 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:
+//
+// Not Implemented
+//
+// Return Value:
+//
+// Not Implemented
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Not Implemented
+//
+//********************************************************************
+
+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:
+//
+// Not Implemented
+//
+// Return Value:
+//
+// Not Implemented
+//
+// 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
+// ResultFromScode OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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:
+//
+// Not Implemented
+//
+// Return Value:
+//
+// Not Implemented
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Not Implemented
+//
+//********************************************************************
+
+STDMETHODIMP COleClientSite::RequestNewObjectLayout()
+{
+ TestDebugOut("In IOCS::RequestNewObjectLayout\r\n");
+ return ResultFromScode(E_NOTIMPL);
+}
diff --git a/private/oleutest/utests16/simpdnd/iocs.h b/private/oleutest/utests16/simpdnd/iocs.h
new file mode 100644
index 000000000..00b6fa742
--- /dev/null
+++ b/private/oleutest/utests16/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
+{
+ int m_nCount;
+ CSimpleSite FAR * m_pSite;
+
+ COleClientSite(CSimpleSite FAR * pSite) {
+ TestDebugOut("In IOCS's constructor\r\n");
+ m_pSite = pSite;
+ m_nCount = 0;
+ }
+
+ ~COleClientSite() {
+ TestDebugOut("In IOCS's destructor\r\n");
+ assert(m_nCount == 0);
+ }
+
+ 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/utests16/simpdnd/makefile b/private/oleutest/utests16/simpdnd/makefile
new file mode 100644
index 000000000..fd3bc375b
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/makefile
@@ -0,0 +1,94 @@
+#//+---------------------------------------------------------------------------
+#//
+#// Microsoft Windows
+#// Copyright (C) Microsoft Corporation, 1992 - 1994.
+#//
+#// File: makefile
+#// Contents: makefile for 16 bit spdnd16 for OLETHUNK unit test.
+#//
+#// History: 06-16-94 terryru Created
+#//
+#//----------------------------------------------------------------------------
+
+
+!IFDEF USEBUILD
+
+# If using BUILD.EXE, 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
+
+!ELSE
+
+default: copy_bin
+
+TARGET = spdnd16.exe
+TARGETTYPE = EXE
+OLETHUNK = $(_NTDRIVE)$(_NTROOT)\private\cairole\olethunk
+
+
+RCINC=$(RCINC) -i..\ole2ui -i..\ole2ui\res\usa
+
+CDEFINES= -I..\ole32ui /GEs
+
+LFLAGS= /STACK:16384
+
+CPPFILES = \
+ .\APP.cpp \
+ .\DOC.cpp \
+ .\DXFEROBJ.cpp \
+ .\IAS.cpp \
+ .\IDS.cpp \
+ .\IDT.cpp \
+ .\IOCS.cpp \
+ .\PRE.cpp \
+ .\SIMPDND.cpp \
+ .\SITE.cpp \
+ .\TESTS.cpp
+
+RCFILES = \
+ .\spdnd16.rc
+
+LIBS = $(LIBS)\
+ $(OLE16)\lib\ole2.lib \
+ $(OLE16)\lib\storage.lib \
+ $(OLE16)\lib\compobj.lib \
+ $(OLE16)\lib\loleuic.lib \
+ $(OLE16)\lib\shell.lib
+
+
+!include ..\makefile.inc
+
+copy_bin: all
+ binplace $(OBJDIR)\spdnd16.exe
+ binplace $(OBJDIR)\spdnd16.sym
+ binplace $(OBJDIR)\spdnd16.map
+
+
+
+app.obj: APP.cpp
+
+doc.obj: DOC.cpp
+
+DXFEROBJ.obj: DXFEROBJ.cpp
+
+IAS.obj: IAS.cpp
+
+IDS.obj: IDS.cpp
+
+IDT.obj: IDT.cpp
+
+IOCS.obj: IOCS.cpp
+
+PRE.obj: PRE.cpp
+
+SIMPDND.obj: SIMPDND.cpp
+
+SITE.obj: SITE.cpp
+
+TESTS.obj: TESTS.cpp
+
+
+
+!ENDIF
diff --git a/private/oleutest/utests16/simpdnd/pre.cpp b/private/oleutest/utests16/simpdnd/pre.cpp
new file mode 100644
index 000000000..9603f4089
--- /dev/null
+++ b/private/oleutest/utests16/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/utests16/simpdnd/pre.h b/private/oleutest/utests16/simpdnd/pre.h
new file mode 100644
index 000000000..c97f3ab85
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/pre.h
@@ -0,0 +1,23 @@
+//**********************************************************************
+// 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"
+#include <ole2ver.h>
+
+extern "C" void TestDebugOut(LPSTR psz);
+
+#endif
diff --git a/private/oleutest/utests16/simpdnd/readme.txt b/private/oleutest/utests16/simpdnd/readme.txt
new file mode 100644
index 000000000..d9334a0ae
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/readme.txt
@@ -0,0 +1,5 @@
+ Simple Drag and Drop Sample
+
+ This sample demonstrates an implementation of OLE 2 drag and drop.
+For information on compiling and building the sample, see the makefile in
+this directory.
diff --git a/private/oleutest/utests16/simpdnd/resource.h b/private/oleutest/utests16/simpdnd/resource.h
new file mode 100644
index 000000000..8c8b12041
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/resource.h
@@ -0,0 +1,29 @@
+//{{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
+
+// 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/utests16/simpdnd/simpdnd.cpp b/private/oleutest/utests16/simpdnd/simpdnd.cpp
new file mode 100644
index 000000000..4f2f692d1
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/simpdnd.cpp
@@ -0,0 +1,452 @@
+//**********************************************************************
+// 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 <testmess.h>
+#include <stdlib.h>
+#include "tests.h"
+
+// This line is needed for the debug utilities in OLE2UI
+extern "C" {
+ OLEDBGDATA_MAIN("SIMPDND")
+}
+
+CSimpleApp FAR * lpCSimpleApp;
+BOOL fBeVerbose = FALSE;
+extern "C"
+void TestDebugOut(LPSTR psz)
+{
+ if (fBeVerbose)
+ {
+ OutputDebugString(psz);
+ }
+}
+
+//**********************************************************************
+//
+// 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
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleApp::CSimpleApp APP.CPP
+// CSimpleApp::fInitApplication APP.CPP
+// CSimpleApp::fInitInstance APP.CPP
+// CSimpleApp::HandleAccelerators APP.CPP
+// CSimpleApp::~CSimpleApp APP.CPP
+// OleUIInitialize OLE2UI
+// OleUIUninitialize OLE2UI
+// GetMessage Windows API
+// TranslateMessage Windows API
+// DispatchMessage Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
+
+{
+ LPSTR pszTemp;
+ MSG msg;
+ fBeVerbose = GetProfileInt("OLEUTEST","BeVerbose",0);
+
+ if(fBeVerbose == 0)
+ {
+ fBeVerbose = GetProfileInt("OLEUTEST","spdnd16",0);
+ }
+
+ // needed for LRPC to work properly...
+ SetMessageQueue(96);
+
+ lpCSimpleApp = new CSimpleApp;
+
+ // 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);
+ }
+
+
+
+ // app initialization
+ if (!hPrevInstance)
+ if (!lpCSimpleApp->fInitApplication(hInstance))
+ return (FALSE);
+
+ // instance initialization
+ if (!lpCSimpleApp->fInitInstance(hInstance, nCmdShow))
+ return (FALSE);
+
+ /* 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))
+ {
+ OleDbgOut("Could not initialize OLEUI library\n");
+ return FALSE;
+ }
+
+ // message loop
+ while (GetMessage(&msg, NULL, NULL, NULL))
+ if (!lpCSimpleApp->HandleAccelerators(&msg))
+ {
+ TranslateMessage(&msg); /* Translates virtual key codes */
+ DispatchMessage(&msg); /* Dispatches message to window */
+ }
+
+ // 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();
+
+ // 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
+//
+// Comments:
+//
+//********************************************************************
+
+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:
+ 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
+//
+// Comments:
+//
+//********************************************************************
+
+BOOL FAR PASCAL _export About(HWND hDlg,unsigned message,WORD wParam,LONG 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:
+//
+// Function Calls:
+// Function Location
+//
+// CSimpleApp::PaintApp APP.CPP
+// BeginPaint Windows API
+// EndPaint Windows API
+// DefWindowProc Windows API
+// IOleObject::QueryInterface Object
+// 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
+//
+// Comments:
+//
+//********************************************************************
+
+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/utests16/simpdnd/simpdnd.h b/private/oleutest/utests16/simpdnd/simpdnd.h
new file mode 100644
index 000000000..d1f9c347a
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/simpdnd.h
@@ -0,0 +1,15 @@
+//**********************************************************************
+// 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(HANDLE hInstance,HANDLE hPrevInstance,LPSTR lpCmdLine,int nCmdShow);
+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);
+BOOL FAR PASCAL _export About(HWND hDlg, unsigned message, WORD wParam, LONG lParam);
diff --git a/private/oleutest/utests16/simpdnd/simpdnd.ico b/private/oleutest/utests16/simpdnd/simpdnd.ico
new file mode 100644
index 000000000..c5aceb582
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/simpdnd.ico
Binary files differ
diff --git a/private/oleutest/utests16/simpdnd/site.cpp b/private/oleutest/utests16/simpdnd/site.cpp
new file mode 100644
index 000000000..df2b2746e
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/site.cpp
@@ -0,0 +1,627 @@
+//**********************************************************************
+// 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
+//
+// IStorage::CreateStorage OLE API
+// assert C Runtime
+//
+// Comments:
+//
+//********************************************************************
+
+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( "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
+//
+// Comments:
+//
+//********************************************************************
+#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;
+
+ // 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+// IStorage::Release OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CSimpleSite::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpleSite::QueryInterface\r\n");
+
+ *ppvObj = NULL; // must set out pointer parameters to NULL
+
+ if ( riid == IID_IUnknown)
+ {
+ AddRef();
+ *ppvObj = this;
+ return ResultFromScode(S_OK);
+ }
+
+ if ( riid == IID_IOleClientSite)
+ {
+ m_OleClientSite.AddRef();
+ *ppvObj = &m_OleClientSite;
+ return ResultFromScode(S_OK);
+ }
+
+ if ( 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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+//
+// Comments:
+//
+//********************************************************************
+
+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
+// IViewObject::SetAdvise Object
+// IViewObject::Release Object
+// GetClientRect Windows API
+// OleSetContainedObject OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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) && (GetScode(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("Simple Application",
+ "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:
+//
+// Function Calls:
+// Function Location
+//
+// IOleObject::QueryInterface Object
+// IViewObject::GetColorSet Object
+// IViewObject::Release Object
+// SetMapMode Windows API
+// LPtoDP Windows API
+// CreateHatchBrush Windows API
+// SelectObject Windows API
+// DeleteObject Windows API
+// CreatePalette Windows API
+// SelectPalette Windows API
+// RealizePalette Windows API
+// OleStdFree OUTLUI Function
+// OleDraw OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+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
+ OleDraw(m_lpOleObject, m_dwDrawAspect, hDC, &rect);
+
+ // if the object is open, draw a hatch rect.
+ if (m_fObjectOpen)
+ {
+ HBRUSH hBrush = CreateHatchBrush ( HS_BDIAGONAL, RGB(0,0,0) );
+ HBRUSH hOldBrush = 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:
+//
+// Function Calls:
+// Function Location
+//
+// XformWidthInHimetricToPixels OUTLUI Function
+// XformHeightInHimetricToPixels OUTLUI Function
+//
+// Comments:
+//
+//********************************************************************
+
+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/utests16/simpdnd/site.h b/private/oleutest/utests16/simpdnd/site.h
new file mode 100644
index 000000000..ebd3e5800
--- /dev/null
+++ b/private/oleutest/utests16/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/utests16/simpdnd/spdnd16.def b/private/oleutest/utests16/simpdnd/spdnd16.def
new file mode 100644
index 000000000..5c3ffbd1a
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/spdnd16.def
@@ -0,0 +1,22 @@
+; module-definition file for generic -- used by LINK.EXE
+
+NAME SpDnd16 ; application's module name
+
+DESCRIPTION 'Sample Microsoft Windows Application'
+
+EXETYPE WINDOWS ; required for all Windows applications
+
+STUB 'WINSTUB.EXE' ; Generates error message if application
+ ; is run without Windows
+
+;CODE can be moved in memory and discarded/reloaded
+CODE PRELOAD MOVEABLE DISCARDABLE
+
+;DATA must be MULTIPLE if program can be invoked more than once
+DATA PRELOAD MOVEABLE MULTIPLE
+
+
+HEAPSIZE 1024
+
+; All functions that will be called by any Windows routine
+; MUST be exported.
diff --git a/private/oleutest/utests16/simpdnd/spdnd16.rc b/private/oleutest/utests16/simpdnd/spdnd16.rc
new file mode 100644
index 000000000..0ff7b797b
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/spdnd16.rc
@@ -0,0 +1,105 @@
+//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"
+
+/////////////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+SIMPDND ICON DISCARDABLE "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
+ 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
+ "#include ""ole2ui.rc""\r\n"
+ "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef APSTUDIO_INVOKED
+////////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#include "ole2ui.rc"
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/private/oleutest/utests16/simpdnd/tests.cpp b/private/oleutest/utests16/simpdnd/tests.cpp
new file mode 100644
index 000000000..81b554ac8
--- /dev/null
+++ b/private/oleutest/utests16/simpdnd/tests.cpp
@@ -0,0 +1,202 @@
+//+-------------------------------------------------------------------------
+//
+// 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>
+
+#ifdef WIN32
+const CLSID CLSID_SimpleServer = {0xbcf6d4a0, 0xbe8c, 0x1068, { 0xb6, 0xd4,
+ 0x00, 0xdd, 0x01, 0x0c, 0x05, 0x09 }};
+#else
+const CLSID CLSID_SimpleServer = {0x9fb878d0, 0x6f88, 0x101b, { 0xbc, 0x65,
+ 0x00, 0x00, 0x0b, 0x65, 0xc7, 0xa6 }};
+#endif
+
+
+
+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/utests16/simpdnd/tests.h b/private/oleutest/utests16/simpdnd/tests.h
new file mode 100644
index 000000000..30d3b1baa
--- /dev/null
+++ b/private/oleutest/utests16/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
+
+
diff --git a/private/oleutest/utests16/simpsvr/app.cpp b/private/oleutest/utests16/simpsvr/app.cpp
new file mode 100644
index 000000000..745349e13
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/app.cpp
@@ -0,0 +1,810 @@
+//**********************************************************************
+// File name: app.cpp
+//
+// Implementation file for the CSimpSvrApp Class
+//
+// Functions:
+//
+// See app.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "app.h"
+#include "doc.h"
+#include "icf.h"
+
+#include "initguid.h"
+
+#ifdef WIN32
+DEFINE_GUID(GUID_SIMPLE, 0xBCF6D4A0, 0xBE8C, 0x1068, 0xB6, 0xD4, 0x00, 0xDD, 0x01, 0x0C, 0x05, 0x09);
+#else
+DEFINE_GUID(GUID_SIMPLE, 0x9fb878d0, 0x6f88, 0x101b, 0xbc, 0x65, 0x00, 0x00, 0x0b, 0x65, 0xc7, 0xa6);
+#endif
+
+
+
+//**********************************************************************
+//
+// CSimpSvrApp::CSimpSvrApp()
+//
+// Purpose:
+//
+// Constructor for CSimpSvrApp
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// SetRectEmpty Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+CSimpSvrApp::CSimpSvrApp()
+{
+ TestDebugOut("In CSimpSvrApp'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;
+
+ // used for inplace
+ SetRectEmpty(&nullRect);
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::~CSimpSvrApp()
+//
+// Purpose:
+//
+// Destructor for CSimpSvrApp Class.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// DestroyWindow Windows API
+// CSimpSvrApp::IsInitialized APP.H
+// OleUninitialize OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+CSimpSvrApp::~CSimpSvrApp()
+{
+ TestDebugOut("In CSimpSvrApp's Destructor\r\n");
+
+ // need to uninit the library...
+ if (IsInitialized())
+ OleUninitialize();
+
+ DestroyWindow(m_hAppWnd);
+}
+
+
+//**********************************************************************
+//
+// CSimpSvrApp::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.
+// E_NOINTERFACE - The interface is not supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+// IUnknown::AddRef APP.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CSimpSvrApp::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpSvrApp::QueryInterface\r\n");
+
+ SCODE sc = S_OK;
+
+ if (riid == IID_IUnknown)
+ *ppvObj = this;
+ else
+ {
+ *ppvObj = NULL;
+ sc = E_NOINTERFACE;
+ }
+
+ if (*ppvObj)
+ ((LPUNKNOWN)*ppvObj)->AddRef();
+
+ // asking for something we don't understand at this level.
+ return ResultFromScode(sc);
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::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) CSimpSvrApp::AddRef()
+{
+ TestDebugOut("In CSimpSvrApp::AddRef\r\n");
+ return ++m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::Release
+//
+// Purpose:
+//
+// Decrements the reference count at this 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) CSimpSvrApp::Release()
+{
+ TestDebugOut("In CSimpSvrApp::Release\r\n");
+
+ if (--m_nCount == 0) {
+ delete this;
+ return 0;
+ }
+
+ return m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::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
+// RegisterHatchWindowClass OUTLUI.DLL
+//
+// Comments:
+//
+//********************************************************************
+
+BOOL CSimpSvrApp::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; // Application that owns the class.
+ wc.hIcon = LoadIcon(hInstance, "SimpSvr");
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = "SimpSvrMENU"; // Name of menu resource in .RC file.
+ wc.lpszClassName = "SimpSvrWClass"; // Name used in call to CreateWindow.
+
+ if (!RegisterClass(&wc))
+ return FALSE;
+
+ wc.style = CS_VREDRAW | CS_HREDRAW; // Class style(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; // Application that owns the class.
+ wc.hIcon = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "DocWClass"; // Name used in call to CreateWindow.
+
+ // Register the window class and return success/failure code.
+
+ if (!RegisterClass(&wc))
+ return FALSE;
+
+ return (RegisterHatchWindowClass(hInstance));
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::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
+// InvalidateRect Windows API
+// ShowWindow Windows API
+// UpdateWindow Windows API
+// CoRegisterClassObject OLE API
+// OleBuildVersion OLE API
+// OleInitialize OLE API
+// CSimpSvrDoc::CreateObject DOC.CPP
+//
+// Comments:
+//
+// Note that successful Initalization of the OLE libraries
+// is remembered so the UnInit is only called if needed.
+//
+//********************************************************************
+
+BOOL CSimpSvrApp::fInitInstance (HANDLE hInstance, int nCmdShow, CClassFactory FAR * lpClassFactory)
+{
+ m_hInst = hInstance;
+
+ DWORD dwVer = OleBuildVersion();
+
+ // check to see if we are compatible with this version of the libraries
+ if (HIWORD(dwVer) != rmm || LOWORD(dwVer) < rup)
+ TestDebugOut("*** WARNING: Not compatible with current libs ***\r\n");
+
+ // initialize the libraries
+ if (OleInitialize(NULL) == NOERROR)
+ m_fInitialized = TRUE;
+
+
+ // Create the "application" windows
+ m_hAppWnd = CreateWindow ("SimpSvrWClass",
+ "Simple OLE 2.0 Server",
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ NULL,
+ NULL,
+ hInstance,
+ NULL);
+
+ if (!m_hAppWnd)
+ return FALSE;
+
+ // if not started by OLE, then show the Window, and create a "fake" object, else
+ // Register a pointer to IClassFactory so that OLE can instruct us to make an
+ // object at the appropriate time.
+ if (!m_fStartByOle)
+ {
+ ShowAppWnd(nCmdShow);
+ m_lpDoc->CreateObject(IID_IOleObject, (LPVOID FAR *)&m_OleObject);
+ InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
+ }
+ else
+ {
+ lpClassFactory = new CClassFactory(this);
+
+ // shouldn't pass an API an object with a zero ref count
+ lpClassFactory->AddRef();
+
+ CoRegisterClassObject(GUID_SIMPLE,(IUnknown FAR *)lpClassFactory, CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &m_dwRegisterClass);
+
+ // remove artificial Ref. count
+ lpClassFactory->Release();
+ }
+
+ m_hMainMenu = GetMenu(m_hAppWnd);
+ m_hColorMenu = GetSubMenu(m_hMainMenu, 1);
+ m_hHelpMenu = GetSubMenu(m_hMainMenu, 2);
+
+
+ return m_fInitialized;
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::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
+//
+// GetClientRect Windows API
+// MessageBox Windows API
+// DialogBox Windows API
+// MakeProcInstance Windows API
+// FreeProcInstance Windows API
+// SendMessage Windows API
+// DefWindowProc Windows API
+// InvalidateRect Windows API
+// CSimpSvrDoc::InsertObject DOC.CPP
+// CSimpSvrObj::SetColor OBJ.CPP
+// CSimpSvrObj::RotateColor OBJ.CPP
+//
+// Comments:
+//
+//********************************************************************
+
+long CSimpSvrApp::lCommandHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (wParam) {
+ // bring up the About box
+ case IDM_ABOUT:
+ {
+ FARPROC lpProcAbout = MakeProcInstance((FARPROC)About, m_hInst);
+
+ DialogBox(m_hInst, // current instance
+ "AboutBox", // resource to use
+ m_hAppWnd, // parent handle
+ lpProcAbout); // About() instance address
+
+ FreeProcInstance(lpProcAbout);
+ break;
+ }
+
+ // exit the application
+ case IDM_EXIT:
+ SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
+ break;
+
+ case IDM_RED:
+ m_lpDoc->GetObj()->SetColor (128, 0, 0);
+ InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
+ break;
+
+ case IDM_GREEN:
+ m_lpDoc->GetObj()->SetColor (0,128, 0);
+ InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
+ break;
+
+ case IDM_BLUE:
+ m_lpDoc->GetObj()->SetColor (0, 0, 128);
+ InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
+ break;
+
+ case IDM_ROTATE:
+ m_lpDoc->GetObj()->RotateColor();
+ InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
+ break;
+
+ default:
+ return (DefWindowProc(hWnd, message, wParam, lParam));
+ } // end of switch
+ return NULL;
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::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
+// CSimpSvrDoc::lResizeDoc DOC.CPP
+//
+// Comments:
+//
+//********************************************************************
+
+long CSimpSvrApp::lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+
+ GetClientRect(m_hAppWnd, &rect);
+ return m_lpDoc->lResizeDoc(&rect);
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::lCreateDoc
+// d
+// Purpose:
+//
+// Handles the creation of a document.
+//
+// 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
+// CSimpSvrDoc::Create DOC.CPP
+//
+// Comments:
+//
+//********************************************************************
+
+long CSimpSvrApp::lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ RECT rect;
+
+ GetClientRect(hWnd, &rect);
+
+ m_lpDoc = CSimpSvrDoc::Create(this, &rect, hWnd);
+
+ return NULL;
+}
+
+
+
+//**********************************************************************
+//
+// CSimpSvrApp::PaintApp
+//
+// Purpose:
+//
+// Handles the painting of the doc window.
+//
+//
+// Parameters:
+//
+// HDC hDC - hDC to the Doc Window.
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrDoc::PaintDoc DOC.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrApp::PaintApp (HDC hDC)
+{
+
+ // if we supported multiple documents, we would enumerate
+ // through each of the open documents and call paint.
+
+ if (m_lpDoc)
+ m_lpDoc->PaintDoc(hDC);
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::ParseCmdLine
+//
+// Purpose:
+//
+// Determines if the app was started by OLE
+//
+//
+// Parameters:
+//
+// LPSTR lpCmdLine - Pointer to the command line
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// lstrlen Windows API
+// lstrcmp Windows API
+//
+//
+// Comments:
+//
+// Parses the command line looking for the -Embedding or /Embedding
+// flag.
+//
+//********************************************************************
+
+void CSimpSvrApp::ParseCmdLine(LPSTR lpCmdLine)
+{
+ char szTemp[255];
+
+ m_fStartByOle = TRUE;
+
+ ::ParseCmdLine (lpCmdLine, &m_fStartByOle, szTemp);
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::SetStatusText
+//
+// Purpose:
+//
+// Blanks out the text in the status bar
+//
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrDoc::SetStatusText DOC.CPP
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrApp::SetStatusText()
+{
+ m_lpDoc->SetStatusText();
+}
+
+
+//**********************************************************************
+//
+// CSimpSvrApp::IsInPlaceActive
+//
+// Purpose:
+//
+// Safely determines from the app level if currently inplace active.
+//
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// TRUE - Inplace active
+// FALSE - Not Inplace active
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrDoc::GetObject OBJ.H
+// CSimpSvrObj:IsInPlaceActive OBJ.H
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+BOOL CSimpSvrApp::IsInPlaceActive()
+{
+ BOOL retval = FALSE;
+
+ if (m_lpDoc)
+ if (m_lpDoc->GetObj())
+ retval = m_lpDoc->GetObj()->IsInPlaceActive();
+
+ return retval;
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::ShowAppWnd
+//
+// Purpose:
+//
+// Shows the Application Window
+//
+// Parameters:
+//
+// int nCmdShow - Window State
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// ShowWindow Windows API
+// UpdateWindow Windows API
+// CoLockObjectExternal OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrApp::ShowAppWnd(int nCmdShow)
+{
+ CoLockObjectExternal(this, TRUE, FALSE);
+ ShowWindow (m_hAppWnd, nCmdShow);
+ UpdateWindow (m_hAppWnd);
+}
+
+//**********************************************************************
+//
+// CSimpSvrApp::ShowAppWnd
+//
+// Purpose:
+//
+// Hides the Application Window
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// ShowWindow Windows API
+// CoLockObjectExternal OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrApp::HideAppWnd()
+{
+ CoLockObjectExternal(this, FALSE, TRUE);
+ ShowWindow (m_hAppWnd, SW_HIDE);
+}
diff --git a/private/oleutest/utests16/simpsvr/app.h b/private/oleutest/utests16/simpsvr/app.h
new file mode 100644
index 000000000..2a8ecf351
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/app.h
@@ -0,0 +1,85 @@
+//**********************************************************************
+// File name: app.h
+//
+// Definition of CSimpSvrApp
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _APP_H_)
+#define _APP_H_
+
+class CSimpSvrDoc;
+interface CClassFactory;
+
+class CSimpSvrApp : public IUnknown
+{
+private:
+
+ int m_nCount; // reference count
+ HWND m_hAppWnd; // main window handle
+ HINSTANCE m_hInst; // application instance
+ BOOL m_fStartByOle; // TRUE if app started by OLE
+ DWORD m_dwRegisterClass; // returned by RegisterClassFactory
+
+ HMENU m_hMainMenu;
+ HMENU m_hColorMenu;
+ HMENU m_hHelpMenu;
+
+
+ LPOLEOBJECT m_OleObject; // pointer to "dummy" object
+
+
+ CSimpSvrDoc FAR * m_lpDoc; // pointer to document object
+ BOOL m_fInitialized; // OLE initialization flag
+
+ RECT nullRect; // used in inplace negotiation
+
+public:
+ // IUnknown Interfaces
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // Initialization methods
+
+ CSimpSvrApp(); // Constructor
+ ~CSimpSvrApp(); // Destructor
+
+
+ BOOL fInitApplication (HANDLE hInstance);
+ BOOL fInitInstance (HANDLE hInstance, int nCmdShow, CClassFactory FAR * lpClassFactory);
+
+ // 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);
+ void PaintApp(HDC hDC);
+
+ // Utility functions
+ void ParseCmdLine(LPSTR lpCmdLine);
+ void SetStatusText();
+ BOOL IsInPlaceActive();
+ void ShowAppWnd(int nCmdShow=SW_SHOWNORMAL);
+ void HideAppWnd();
+
+
+ // member variable access
+ inline HWND GethAppWnd() { return m_hAppWnd; };
+ inline HINSTANCE GethInst() { return m_hInst; };
+ inline BOOL IsStartedByOle() { return m_fStartByOle; };
+ inline BOOL IsInitialized() { return m_fInitialized; };
+ inline DWORD GetRegisterClass() { return m_dwRegisterClass; };
+ inline CSimpSvrDoc FAR * GetDoc() { return m_lpDoc; };
+ inline void ClearDoc() { m_lpDoc = NULL; };
+ inline LPOLEOBJECT GetOleObject() { return m_OleObject; };
+ inline HMENU GetMainMenu() { return m_hMainMenu; };
+ inline HMENU GetColorMenu() { return m_hColorMenu; };
+ inline HMENU GetHelpMenu() { return m_hHelpMenu; } ;
+
+
+ friend interface CClassFactory; // make the contained class a friend
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/doc.cpp b/private/oleutest/utests16/simpsvr/doc.cpp
new file mode 100644
index 000000000..eb2e4168a
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/doc.cpp
@@ -0,0 +1,693 @@
+//**********************************************************************
+// File name: DOC.CPP
+//
+// Implementation file for CSimpSvrDoc.
+//
+// Functions:
+//
+// See DOC.H for Class Definition
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "app.h"
+#include "doc.h"
+
+//**********************************************************************
+//
+// CSimpSvrDoc::Create
+//
+// Purpose:
+//
+// Creation for the CSimpSvrDoc Class
+//
+// Parameters:
+//
+// CSimpSvrApp FAR * lpApp - Pointer to the CSimpSvrApp 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
+// CreateWindow Windows API
+// ShowWindow Windows API
+// UpdateWindow Windows API
+// CSimpSvrDoc::CSimpSvrDoc DOC.CPP
+// CreateHatchWindow OLE2UI
+//
+// Comments:
+//
+// This routine was added so that failure could be returned
+// from object creation.
+//
+//********************************************************************
+
+CSimpSvrDoc FAR * CSimpSvrDoc::Create(CSimpSvrApp FAR *lpApp, LPRECT lpRect,HWND hWnd)
+{
+ CSimpSvrDoc FAR * lpTemp = new CSimpSvrDoc(lpApp, hWnd);
+
+ if (!lpTemp)
+ return NULL;
+
+ // create the document Window
+ lpTemp->m_hDocWnd = CreateWindow(
+ "DocWClass",
+ NULL,
+ WS_CHILD | WS_CLIPSIBLINGS,
+ lpRect->left,
+ lpRect->top,
+ lpRect->right,
+ lpRect->bottom,
+ hWnd,
+ NULL,
+ lpApp->GethInst(),
+ NULL);
+
+ if (!lpTemp->m_hDocWnd)
+ goto error;
+
+ lpTemp->ShowDocWnd();
+
+ lpTemp->m_hHatchWnd = CreateHatchWindow( lpTemp->m_hDocWnd, lpApp->GethInst());
+
+ lpTemp->HideHatchWnd();
+
+ return (lpTemp);
+
+error:
+ delete (lpTemp);
+ return NULL;
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::CSimpSvrDoc
+//
+// Purpose:
+//
+// Constructor for the CSimpSvrDoc Class
+//
+// Parameters:
+//
+// CSimpSvrApp FAR * lpApp - Pointer to the CSimpSvrApp Class
+//
+// HWND hWnd - Window Handle of "frame" window
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// GetMenu Windows API
+// GetSubMenu Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+CSimpSvrDoc::CSimpSvrDoc(CSimpSvrApp FAR * lpApp,HWND hWnd)
+{
+ TestDebugOut("In CSimpSvrDoc's Constructor\r\n");
+ m_lpApp = lpApp;
+ m_nCount = 0;
+ m_lpObj = NULL;
+ m_fClosing = FALSE;
+
+ // set up menu handles
+
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::~CSimpSvrDoc
+//
+// Purpose:
+//
+// Destructor for CSimpSvrDoc
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// DestroyWindow Windows API
+// CSimpSvrApp::ClearDoc APP.CPP
+//
+// Comments:
+//
+//********************************************************************
+
+CSimpSvrDoc::~CSimpSvrDoc()
+{
+ TestDebugOut("In CSimpSvrDoc's Destructor\r\n");
+ m_lpApp->ClearDoc();
+ DestroyWindow(m_hHatchWnd);
+}
+
+
+//**********************************************************************
+//
+// CSimpSvrDoc::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:
+//
+// E_NOINTERFACE - Always
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrApp::QueryInterface APP.CPP
+//
+// Comments:
+//
+// Since the document could contain multiple objects, all
+// interfaces except those associated with the document should
+// be returned. In this implementation, there are no doc level
+// interfaces.
+//
+//********************************************************************
+
+STDMETHODIMP CSimpSvrDoc::QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpSvrDoc::QueryInterface\r\n");
+
+ SCODE sc = E_NOINTERFACE;
+
+ if ( (riid == IID_IUnknown) )
+ {
+ AddRef();
+ *ppvObj = this;
+ sc = S_OK;
+ }
+
+ return ResultFromScode(sc);
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::AddRef
+//
+// Purpose:
+//
+// Increments the document level reference count
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// UINT - The current reference count on the document
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrApp::AddRef APP.CPP
+//
+// Comments:
+//
+// The reference count at this level reflects the total ref.
+// count of all interfaces on all objects contained within
+// this document. Note that it also "trickles up" the
+// ref count to the app level.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpSvrDoc::AddRef()
+{
+ TestDebugOut("In CSimpSvrDoc::AddRef\r\n");
+ // AddRef the app, but return the doc count
+ m_lpApp->AddRef();
+
+ return ++m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::Release
+//
+// Purpose:
+//
+// Decrements the document level reference count
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// UINT - The current reference count on the document
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrApp::Release APP.CPP
+//
+// Comments:
+//
+// The reference count at this level reflects the total ref.
+// count of all interfaces on all objects contained within
+// this document. Note that it also "trickles up" the
+// ref count to the app level.
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpSvrDoc::Release()
+{
+ TestDebugOut("In CSimpSvrDoc::Release\r\n");
+ // Release the app, but return the app count
+ m_lpApp->Release();
+
+ if (--m_nCount == 0) {
+ delete this;
+ return 0;
+ }
+
+ return m_nCount;
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::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
+//
+// Comments:
+//
+//********************************************************************
+
+long CSimpSvrDoc::lResizeDoc(LPRECT lpRect)
+{
+ MoveWindow(m_hDocWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, TRUE);
+ return NULL;
+}
+
+
+//**********************************************************************
+//
+// CSimpSvrDoc::PaintDoc
+//
+// Purpose:
+//
+// Paints the Document
+//
+// Parameters:
+//
+// HDC hDC - hDC of the document Window
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::Draw OBJ.CPP
+// CSimpSvrObj::GetDataAdviseHolder OBJ.H
+// CSimpSvrObj::GetDataObject OBJ.H
+// CSimpAppObj::IsStartedByOle APP.CPP
+// IDataAdviseHolder::SendOnDataChange OLE API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrDoc::PaintDoc (HDC hDC)
+{
+
+ // if the object hasn't been created yet, then don't draw
+ if (m_lpObj)
+ m_lpObj->Draw(hDC,FALSE);
+ else
+ return;
+
+ // Sending a data change every time we paint, but only if we
+ // were started by OLE
+ if (m_lpApp->IsStartedByOle())
+ m_lpObj->SendOnDataChange( );
+}
+
+
+
+//**********************************************************************
+//
+// CSimpSvrDoc::CreateObject
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+//
+// Return Value:
+//
+// NOERROR if the function succeeds, otherwise E_FAIL
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::CSimpSvrObj OBJ.CPP
+// CSimpSvrOjb::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//********************************************************************
+
+HRESULT CSimpSvrDoc::CreateObject(REFIID riid, LPVOID FAR *ppvObject)
+{
+ SCODE sc = E_FAIL;
+
+ m_lpObj = new CSimpSvrObj(this);
+
+ if (m_lpObj)
+ {
+ m_lpObj->QueryInterface(riid, ppvObject);
+ sc = S_OK;
+ }
+
+ return ResultFromScode(sc);
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::Close
+//
+// Purpose:
+//
+// Closes the object
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+// CSimpSvrObj::Release OBJ.CPP
+// CSimpSvrObj::IsInPlaceActive OBJ.H
+// CSimpSvrObj::GetOleInPlaceObject OBJ.H
+// CSimpSvrObj::ClearOleClientSite OBJ.H
+// CSimpSvrObj::GetDataAdviseHolder OBJ.H
+// CSimpSvrObj::GetOleClientSite OBJ.H
+// CSimpSvrObj::ClearDataAdviseHolder OBJ.H
+// CSimpSvrObj::GetOleAdviseHolder OBJ.H
+// CSimpSvrObj::ClearOleAdviseHolder OBJ.H
+// IOleInPlaceObject::InPlaceDeactivate Container
+// IOleClientSite::SaveObject Container
+// IOleClientSite::OnShowWindow Container
+// IOleClientSite::Release Container
+// IDataAdviseHolder::SendOnDataChange OLE
+// IDataAdviseHolder::Release OLE
+// IOleAdviseHolder::SendOnClose OLE
+// IOleAdviseHolder::Release OLE
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrDoc::Close()
+{
+ TestDebugOut("In CSimpSvrDoc::Close() \r\n");
+
+ m_lpObj->AddRef(); // hold object alive
+
+ if (m_fClosing)
+ return;
+
+ m_fClosing = TRUE;
+
+ // if the object is currently inplace active, then deactivate
+ if (m_lpObj->IsInPlaceActive())
+ m_lpObj->GetOleInPlaceObject()->InPlaceDeactivate();
+
+ // unregister from the ROT...
+ if (m_lpObj->GetRotRegister())
+ {
+ LPRUNNINGOBJECTTABLE lpRot;
+
+ if (GetRunningObjectTable (0, &lpRot) == NOERROR )
+ {
+ lpRot->Revoke(m_lpObj->GetRotRegister());
+ lpRot->Release();
+ }
+ }
+
+ // if we have a clientsite, instruct it to save the object
+ if (m_lpObj->GetOleClientSite())
+ {
+ m_lpObj->GetOleClientSite()->SaveObject();
+ m_lpObj->GetOleClientSite()->OnShowWindow(FALSE);
+ }
+
+ // Do a final SendOnDataChange for those containers that have specified the
+ // ADF_DATAONSTOP flag.
+ if (m_lpObj->GetDataAdviseHolder())
+ {
+ m_lpObj->GetDataAdviseHolder()->SendOnDataChange( m_lpObj->GetDataObject(), 0, ADVF_DATAONSTOP);
+ m_lpObj->GetDataAdviseHolder()->Release();
+ m_lpObj->ClearDataAdviseHolder();
+ }
+
+
+ // Tell the container that we are shutting down.
+ if (m_lpObj->GetOleAdviseHolder())
+ {
+ m_lpObj->GetOleAdviseHolder()->SendOnClose();
+ m_lpObj->GetOleAdviseHolder()->Release();
+ m_lpObj->ClearOleAdviseHolder();
+ }
+
+ if (m_lpObj->GetOleClientSite())
+ {
+ m_lpObj->GetOleClientSite()->Release();
+ m_lpObj->ClearOleClientSite();
+ }
+
+ // release our streams and storage
+ m_lpObj->GetPersistStorage()->ReleaseStreamsAndStorage();
+
+ // Disconnect the object. NOTE: This call should not do anything
+ // unless the container has cause a GP Fault or some other problem
+ // has occured...
+ TestDebugOut("*** Before CoDisconnectObject *** \r\n");
+ CoDisconnectObject((LPUNKNOWN)m_lpObj, 0);
+ TestDebugOut("*** After CoDisconnectObject *** \r\n");
+
+ m_lpObj->Release(); // let object close
+
+}
+
+
+//**********************************************************************
+//
+// CSimpSvrDoc::SetStatusText
+//
+// Purpose:
+//
+// Sets the Container's status bar text
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::IsInPlaceActive OBJ.CPP
+// IOleInPlaceFrame::SetStatusText Container
+//
+// Comments:
+//
+// Even though there is no status line in this sample, this
+// method must be called on WM_MENUSELECT to clear the last
+// message in the status line.
+//
+//********************************************************************
+
+void CSimpSvrDoc::SetStatusText()
+{
+ if (m_lpObj->IsInPlaceActive())
+ m_lpObj->GetInPlaceFrame()->SetStatusText("\0");
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::ShowDocWnd
+//
+// Purpose:
+//
+// Shows the Document Window
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// ShowWindow Windows API
+// UpdateWindow Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrDoc::ShowDocWnd()
+{
+ ShowWindow(m_hDocWnd, SW_SHOWNORMAL); // Show the window
+ UpdateWindow(m_hDocWnd); // Sends WM_PAINT message
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::ShowHatchWnd
+//
+// Purpose:
+//
+// Shows the hatch Window
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// ShowWindow Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrDoc::ShowHatchWnd()
+{
+ ShowWindow(m_hHatchWnd, SW_SHOW);
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::HideDocWnd
+//
+// Purpose:
+//
+// Hides the DocumentWindow
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// ShowWindow Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrDoc::HideDocWnd()
+{
+ ShowWindow(m_hDocWnd, SW_HIDE);
+}
+
+//**********************************************************************
+//
+// CSimpSvrDoc::HideHatchWnd
+//
+// Purpose:
+//
+// Hides the Hatch Window
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// ShowWindow Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+void CSimpSvrDoc::HideHatchWnd()
+{
+ ShowWindow(m_hHatchWnd, SW_HIDE);
+}
diff --git a/private/oleutest/utests16/simpsvr/doc.h b/private/oleutest/utests16/simpsvr/doc.h
new file mode 100644
index 000000000..33d18e066
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/doc.h
@@ -0,0 +1,65 @@
+//**********************************************************************
+// File name: doc.h
+//
+// Definition of CSimpSvrDoc
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _DOC_H_ )
+#define _DOC_H_
+
+class CSimpSvrApp;
+class CSimpSvrObj;
+
+class CSimpSvrDoc : IUnknown
+{
+private:
+ int m_nCount;
+
+ CSimpSvrApp FAR * m_lpApp;
+ CSimpSvrObj FAR * m_lpObj;
+
+ HWND m_hDocWnd;
+ HWND m_hHatchWnd;
+ BOOL m_fClosing;
+
+public:
+ static CSimpSvrDoc FAR * Create(CSimpSvrApp FAR *lpApp, LPRECT lpRect,HWND hWnd);
+
+ CSimpSvrDoc();
+ CSimpSvrDoc(CSimpSvrApp FAR *lpApp, HWND hWnd);
+ ~CSimpSvrDoc();
+
+// IUnknown Interfaces
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ long lResizeDoc(LPRECT lpRect);
+ long lAddVerbs();
+
+ BOOL Load(LPSTR lpszFileName);
+ void PaintDoc(HDC hDC);
+ void lButtonDown(WPARAM wParam,LPARAM lParam);
+
+ HRESULT CreateObject(REFIID riid, LPVOID FAR *ppvObject);
+
+ void Close();
+ void SetStatusText();
+ void ShowDocWnd();
+ void ShowHatchWnd();
+ void CSimpSvrDoc::HideDocWnd();
+ void CSimpSvrDoc::HideHatchWnd();
+
+// member access
+ inline HWND GethDocWnd() { return m_hDocWnd; };
+ inline HWND GethHatchWnd() { return m_hHatchWnd; };
+ inline HWND GethAppWnd() { return m_lpApp->GethAppWnd(); };
+ inline CSimpSvrApp FAR * GetApp() { return m_lpApp; };
+ inline CSimpSvrObj FAR * GetObj() { return m_lpObj; };
+ inline void ClearObj() { m_lpObj = NULL; };
+
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/icf.cpp b/private/oleutest/utests16/simpsvr/icf.cpp
new file mode 100644
index 000000000..e68575e20
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/icf.cpp
@@ -0,0 +1,235 @@
+//**********************************************************************
+// File name: ICF.CPP
+//
+// Implementation file for the CClassFactory Class
+//
+// Functions:
+//
+// See icf.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "app.h"
+#include "doc.h"
+#include "icf.h"
+
+//**********************************************************************
+//
+// CClassFactory::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrApp::QueryInterface APP.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CClassFactory::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CClassFactory::QueryInterface\r\n");
+
+ SCODE sc = S_OK;
+
+ if ( (riid == IID_IUnknown) ||
+ (riid == IID_IClassFactory) )
+ *ppvObj = this;
+ else
+ {
+ *ppvObj = NULL;
+ sc = E_NOINTERFACE;
+ }
+
+ if (*ppvObj)
+ ((LPUNKNOWN)*ppvObj)->AddRef();
+
+ // pass it on to the Application object
+ return ResultFromScode(sc);
+};
+
+//**********************************************************************
+//
+// CClassFactory::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on CClassFactory and the application
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on CClassFactory
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP_(ULONG) CClassFactory::AddRef ()
+{
+ TestDebugOut("In CClassFactory::AddRef\r\n");
+
+ return ++m_nCount;
+};
+
+//**********************************************************************
+//
+// CClassFactory::Release
+//
+// Purpose:
+//
+// Decrements the reference count of CClassFactory and the
+// application object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP_(ULONG) CClassFactory::Release ()
+{
+ TestDebugOut("In CClassFactory::Release\r\n");
+
+ if (--m_nCount == 0) {
+ delete this;
+ return 0;
+ }
+
+ return m_nCount;
+};
+
+
+//**********************************************************************
+//
+// CClassFactory::CreateInstance
+//
+// Purpose:
+//
+// Instantiates a new OLE object
+//
+// Parameters:
+//
+// LPUNKNOWN pUnkOuter - Pointer to the controlling unknown
+//
+// REFIID riid - The interface type to fill in ppvObject
+//
+// LPVOID FAR* ppvObject - Out pointer for the object
+//
+// Return Value:
+//
+// S_OK - Creation was successful
+// CLASS_E_NOAGGREGATION - Tried to be created as part of an aggregate
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrDoc::CreateObject DOC.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CClassFactory::CreateInstance ( LPUNKNOWN pUnkOuter,
+ REFIID riid,
+ LPVOID FAR* ppvObject)
+{
+ HRESULT hErr;
+
+ TestDebugOut("In CClassFactory::CreateInstance\r\n");
+
+ // need to NULL the out parameter
+ *ppvObject = NULL;
+
+ // we don't support aggregation...
+ if (pUnkOuter)
+ {
+ hErr = ResultFromScode(CLASS_E_NOAGGREGATION);
+ goto error;
+ }
+
+ hErr = m_lpApp->m_lpDoc->CreateObject(riid, ppvObject);
+
+error:
+ return hErr;
+};
+
+//**********************************************************************
+//
+// CClassFactory::LockServer
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// BOOL fLock - TRUE to lock the server, FALSE to unlock it
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CoLockObjectExternal OLE API
+// ResultFromScode OLE API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CClassFactory::LockServer ( BOOL fLock)
+{
+ TestDebugOut("In CClassFactory::LockServer\r\n");
+ CoLockObjectExternal(m_lpApp, fLock, TRUE);
+
+ return ResultFromScode( S_OK);
+};
diff --git a/private/oleutest/utests16/simpsvr/icf.h b/private/oleutest/utests16/simpsvr/icf.h
new file mode 100644
index 000000000..93aa86e72
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/icf.h
@@ -0,0 +1,45 @@
+//**********************************************************************
+// File name: icf.h
+//
+// Definition of CClassFactory
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _ICF_H_)
+#define _ICF_H_
+
+class CSimpSvrApp;
+
+interface CClassFactory : IClassFactory
+{
+private:
+ int m_nCount; // reference count
+ CSimpSvrApp FAR * m_lpApp;
+
+public:
+ CClassFactory::CClassFactory(CSimpSvrApp FAR * lpApp)
+ {
+ TestDebugOut("In CClassFactory's Constructor\r\n");
+ m_lpApp = lpApp;
+ m_nCount = 0;
+ };
+ CClassFactory::~CClassFactory()
+ {
+ TestDebugOut("In CClassFactory's Destructor\r\n");
+ };
+
+ // IUnknown Methods
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ STDMETHODIMP CreateInstance (LPUNKNOWN pUnkOuter,
+ REFIID riid,
+ LPVOID FAR* ppvObject);
+ STDMETHODIMP LockServer ( BOOL fLock);
+
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/ido.cpp b/private/oleutest/utests16/simpsvr/ido.cpp
new file mode 100644
index 000000000..1a8ce2866
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ido.cpp
@@ -0,0 +1,544 @@
+//**********************************************************************
+// File name: IDO.CPP
+//
+// Implementation file for the CDataObject Class
+//
+// Functions:
+//
+// See ido.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "ido.h"
+#include "app.h"
+#include "doc.h"
+
+//**********************************************************************
+//
+// CDataObject::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CDataObject::QueryInterface\r\n");
+
+ return m_lpObj->QueryInterface(riid, ppvObj);
+};
+
+//**********************************************************************
+//
+// CDataObject::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on CClassFactory and the application
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on CDataObject
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CDataObject::AddRef ()
+{
+ TestDebugOut("In CDataObject::AddRef\r\n");
+ ++m_nCount;
+ return m_lpObj->AddRef();
+};
+
+//**********************************************************************
+//
+// CDataObject::Release
+//
+// Purpose:
+//
+// Decrements the reference count of CDataObject
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::Release OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP_(ULONG) CDataObject::Release ()
+{
+ TestDebugOut("In CDataObject::Release\r\n");
+ --m_nCount;
+ return m_lpObj->Release();
+};
+
+//**********************************************************************
+//
+// CDataObject::QueryGetData
+//
+// Purpose:
+//
+// Called to determine if our object supports a particular
+// FORMATETC.
+//
+// Parameters:
+//
+// LPFORMATETC pformatetc - Pointer to the FORMATETC being queried for.
+//
+// Return Value:
+//
+// DATA_E_FORMATETC - The FORMATETC is not supported
+// S_OK - The FORMATETC is supported.
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC pformatetc )
+{
+ SCODE sc = DATA_E_FORMATETC;
+
+ TestDebugOut("In CDataObject::QueryGetData\r\n");
+
+ // check the validity of the formatetc.
+ if ( (pformatetc->cfFormat == CF_METAFILEPICT) &&
+ (pformatetc->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetc->tymed == TYMED_MFPICT) )
+ sc = S_OK;
+
+ return ResultFromScode(sc);
+};
+
+//**********************************************************************
+//
+// CDataObject::DAdvise
+//
+// Purpose:
+//
+// Called by the container when it would like to be notified of
+// changes in the object data.
+//
+// Parameters:
+//
+// FORMATETC FAR* pFormatetc - The format the container is interested in.
+//
+// DWORD advf - The type of advise to be set up.
+//
+// LPADVISESINK pAdvSink - Pointer to the containers IAdviseSink
+//
+// DWORD FAR* pdwConnection - Out parameter to return a unique connection id.
+//
+// Return Value:
+//
+// passed on from IDataAdviseHolder
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CreateDataAdviseHolder OLE API
+// IDataAdviseHolder::Advise OLE API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::DAdvise ( FORMATETC FAR* pFormatetc, DWORD advf,
+ LPADVISESINK pAdvSink, DWORD FAR* pdwConnection)
+{
+ TestDebugOut("In CDataObject::DAdvise\r\n");
+
+ // if no DataAdviseHolder has been created, then create one.
+ if (!m_lpObj->m_lpDataAdviseHolder)
+ CreateDataAdviseHolder(&m_lpObj->m_lpDataAdviseHolder);
+
+ // pass on to the DataAdviseHolder
+ return m_lpObj->m_lpDataAdviseHolder->Advise( this, pFormatetc, advf,
+ pAdvSink, pdwConnection);
+}
+
+//**********************************************************************
+//
+// CDataObject::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:
+//
+// DATA_E_FORMATETC - Format not supported
+// S_OK - Success
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::GetMetaFilePict() OBJ.CPP
+// ResultFromScode OLE API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::GetData ( LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium )
+{
+ SCODE sc = DATA_E_FORMATETC;
+
+ TestDebugOut("In CDataObject::GetData\r\n");
+
+ // Check to the FORMATETC and fill pmedium if valid.
+ if ( (pformatetcIn->cfFormat == CF_METAFILEPICT) &&
+ (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
+ (pformatetcIn->tymed & TYMED_MFPICT) )
+ {
+ HANDLE hmfPict = m_lpObj->GetMetaFilePict();
+ pmedium->tymed = TYMED_MFPICT;
+ pmedium->hGlobal = hmfPict;
+ pmedium->pUnkForRelease = NULL;
+ sc = S_OK;
+ }
+
+ return ResultFromScode( sc );
+};
+
+//**********************************************************************
+//
+// CDataObject::DUnadvise
+//
+// Purpose:
+//
+// Breaks down an Advise connection.
+//
+// Parameters:
+//
+// DWORD dwConnection - Advise connection ID.
+//
+// Return Value:
+//
+// Returned from the DataAdviseHolder.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IDataAdviseHolder::Unadvise OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection)
+{
+ TestDebugOut("In CDataObject::DUnadvise\r\n");
+
+ if (m_lpObj != NULL && m_lpObj->m_lpDataAdviseHolder != NULL)
+ {
+ return m_lpObj->m_lpDataAdviseHolder->Unadvise(dwConnection);
+ }
+
+ return ResultFromScode( E_UNEXPECTED);
+
+
+};
+
+//**********************************************************************
+//
+// CDataObject::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:
+//
+// DATA_E_FORMATETC - We don't support the requested format
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// In this simple implementation, we don't really support this
+// method, we just always return DATA_E_FORMATETC.
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::GetDataHere ( LPFORMATETC pformatetc,
+ LPSTGMEDIUM pmedium )
+{
+ TestDebugOut("In CDataObject::GetDataHere\r\n");
+ return ResultFromScode( DATA_E_FORMATETC);
+};
+
+//**********************************************************************
+//
+// CDataObject::GetCanonicalFormatEtc
+//
+// Purpose:
+//
+// Returns a FORMATETC that is equivalent to the one passed in.
+//
+// Parameters:
+//
+// LPFORMATETC pformatetc - FORMATETC to be tested.
+//
+// LPFORMATETC pformatetcOut - Out ptr for returned FORMATETC.
+//
+// Return Value:
+//
+// DATA_S_SAMEFORMATETC - Use the same formatetc as was passed.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CoGetMalloc OLE API
+// IMalloc::Alloc OLE
+// IMalloc::Release OLE
+// _fmemcpy C run-time
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::GetCanonicalFormatEtc ( LPFORMATETC pformatetc,
+ LPFORMATETC pformatetcOut)
+{
+ HRESULT hresult;
+ TestDebugOut("In CDataObject::GetCanonicalFormatEtc\r\n");
+
+ if (!pformatetcOut)
+ return ResultFromScode(E_INVALIDARG);
+
+ /* OLE2NOTE: we must make sure to set all out parameters to NULL. */
+ pformatetcOut->ptd = NULL;
+
+ if (!pformatetc)
+ return ResultFromScode(E_INVALIDARG);
+
+ // OLE2NOTE: we must validate that the format requested is supported
+ if ((hresult = QueryGetData(pformatetc)) != NOERROR)
+ return hresult;
+
+ /* OLE2NOTE: an app that is insensitive to target device (as
+ ** SimpSvr is) should fill in the lpformatOut parameter
+ ** but NULL out the "ptd" field; it should return NOERROR if the
+ ** input formatetc->ptd what non-NULL. this tells the caller
+ ** that it is NOT necessary to maintain a separate screen
+ ** rendering and printer rendering. if should return
+ ** DATA_S_SAMEFORMATETC if the input and output formatetc's are
+ ** identical.
+ */
+
+ *pformatetcOut = *pformatetc;
+ if (pformatetc->ptd == NULL)
+ return ResultFromScode(DATA_S_SAMEFORMATETC);
+ else
+ {
+ pformatetcOut->ptd = NULL;
+ return NOERROR;
+ }
+};
+
+//**********************************************************************
+//
+// CDataObject::SetData
+//
+// Purpose:
+//
+// Called to set the data for the object.
+//
+// Parameters:
+//
+// LPFORMATETC pformatetc - the format of the data being passed
+//
+// STGMEDIUM FAR * pmedium - the location of the data.
+//
+// BOOL fRelease - Defines the ownership of the medium
+//
+// Return Value:
+//
+// DATA_E_FORMATETC - Not a valid FORMATETC for this object
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This simple object does not support having its data set, so an
+// error value is always returned.
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::SetData ( LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
+ BOOL fRelease)
+{
+ TestDebugOut("In CDataObject::SetData\r\n");
+ return ResultFromScode( DATA_E_FORMATETC );
+};
+
+//**********************************************************************
+//
+// CDataObject::EnumFormatEtc
+//
+// Purpose:
+//
+// Enumerates the formats supported by this object.
+//
+// Parameters:
+//
+// DWORD dwDirection - Order of enumeration.
+//
+// LPENUMFORMATETC FAR* ppenumFormatEtc - Place to return a pointer
+// to the enumerator.
+//
+// Return Value:
+//
+// OLE_S_USEREG - Indicates that OLE should consult the REG DB
+// to enumerate the formats.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::EnumFormatEtc ( DWORD dwDirection,
+ LPENUMFORMATETC FAR* ppenumFormatEtc)
+{
+ TestDebugOut("In CDataObject::EnumFormatEtc\r\n");
+ // need to NULL the out parameter
+ *ppenumFormatEtc = NULL;
+ return ResultFromScode( OLE_S_USEREG );
+};
+
+//**********************************************************************
+//
+// CDataObject::EnumDAdvise
+//
+// Purpose:
+//
+// Returns an enumerator that enumerates all of the advises
+// set up on this data object.
+//
+// Parameters:
+//
+// LPENUMSTATDATA FAR* ppenumAdvise - An out ptr in which to
+// return the enumerator.
+//
+// Return Value:
+//
+// Passed back from IDataAdviseHolder::EnumAdvise
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IDAtaAdviseHolder::EnumAdvise OLE
+//
+// Comments:
+//
+// This just delegates to the DataAdviseHolder.
+//
+//********************************************************************
+
+
+STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA FAR* ppenumAdvise)
+{
+ TestDebugOut("In CDataObject::EnumDAdvise\r\n");
+ // need to NULL the out parameter
+ *ppenumAdvise = NULL;
+
+ return m_lpObj->m_lpDataAdviseHolder->EnumAdvise(ppenumAdvise);
+};
diff --git a/private/oleutest/utests16/simpsvr/ido.h b/private/oleutest/utests16/simpsvr/ido.h
new file mode 100644
index 000000000..53897310d
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ido.h
@@ -0,0 +1,53 @@
+//**********************************************************************
+// File name: ido.h
+//
+// Definition of CDataObject
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IDO_H_)
+#define _IDO_H_
+
+
+#include <ole2.h>
+#include "obj.h"
+
+class CSimpSvrObj;
+
+interface CDataObject : public IDataObject
+{
+private:
+ CSimpSvrObj FAR * m_lpObj;
+ int m_nCount;
+
+public:
+ CDataObject::CDataObject(CSimpSvrObj FAR * lpSimpSvrObj)
+ {
+ m_lpObj = lpSimpSvrObj;
+ m_nCount = 0;
+ };
+
+ CDataObject::~CDataObject() {};
+
+ 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);
+ STDMETHODIMP DUnadvise ( DWORD dwConnection);
+ STDMETHODIMP EnumDAdvise ( LPENUMSTATDATA FAR* ppenumAdvise);
+ STDMETHODIMP EnumFormatEtc ( DWORD dwDirection,
+ LPENUMFORMATETC FAR* ppenumFormatEtc);
+ STDMETHODIMP GetCanonicalFormatEtc ( LPFORMATETC pformatetc,
+ LPFORMATETC pformatetcOut);
+ 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);
+
+
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/iec.cpp b/private/oleutest/utests16/simpsvr/iec.cpp
new file mode 100644
index 000000000..c0421b767
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/iec.cpp
@@ -0,0 +1,212 @@
+//**********************************************************************
+// File name: IEC.CPP
+//
+// Implementation file for the CExternalConnection Class
+//
+// Functions:
+//
+// See iec.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "iec.h"
+#include "app.h"
+#include "doc.h"
+
+
+//**********************************************************************
+//
+// CExternalConnection::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CExternalConnection::QueryInterface (REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CExternalConnection::QueryInterface\r\n");
+
+ return m_lpObj->QueryInterface(riid, ppvObj);
+}
+
+
+//**********************************************************************
+//
+// CExternalConnection::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on CExternalConnection and the "object"
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on the Object.
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CExternalConnection::AddRef ()
+{
+ TestDebugOut("In CExternalConnection::AddRef\r\n");
+ ++m_nCount;
+ return m_lpObj->AddRef();
+};
+
+//**********************************************************************
+//
+// CExternalConnection::Release
+//
+// Purpose:
+//
+// Decrements the reference count of COleObject and the
+// "object" object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::Release OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP_(ULONG) CExternalConnection::Release ()
+{
+ TestDebugOut("In CExternalConnection::Release\r\n");
+ --m_nCount;
+ return m_lpObj->Release();
+};
+
+
+
+//**********************************************************************
+//
+// CExternalConnection::AddConnection
+//
+// Purpose:
+//
+// Called when another connection is made to the object.
+//
+// Parameters:
+//
+// DWORD extconn - Type of connection
+//
+// DWORD reserved - Reserved
+//
+// Return Value:
+//
+// Strong connection count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(DWORD) CExternalConnection::AddConnection (DWORD extconn, DWORD reserved)
+{
+ TestDebugOut("In CExternalConnection::AddConnection\r\n");
+
+ if (extconn & EXTCONN_STRONG)
+ return ++m_dwStrong;
+
+ return 0;
+}
+
+//**********************************************************************
+//
+// CExternalConnection::ReleaseConnection
+//
+// Purpose:
+//
+// Called when a connection to the object is released.
+//
+// Parameters:
+//
+// DWORD extconn - Type of Connection
+//
+// DWORD reserved - Reserved
+//
+// BOOL fLastReleaseCloses - Close flag
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// COleObject::Close IOO.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(DWORD) CExternalConnection::ReleaseConnection (DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses)
+{
+ TestDebugOut("In CExternalConnection::ReleaseConnection\r\n");
+
+ if (extconn & EXTCONN_STRONG)
+ {
+ DWORD dwSave = --m_dwStrong;
+
+ if (!m_dwStrong && fLastReleaseCloses)
+ m_lpObj->m_OleObject.Close(OLECLOSE_SAVEIFDIRTY);
+
+ return dwSave;
+ }
+ return 0;
+}
diff --git a/private/oleutest/utests16/simpsvr/iec.h b/private/oleutest/utests16/simpsvr/iec.h
new file mode 100644
index 000000000..0b65035c8
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/iec.h
@@ -0,0 +1,44 @@
+//**********************************************************************
+// File name: iec.h
+//
+// Definition of CExternalConnection
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IEC_H_)
+#define _IEC_H_
+
+
+#include <ole2.h>
+#include "obj.h"
+
+class CSimpSvrObj;
+
+interface CExternalConnection : public IExternalConnection
+{
+private:
+ CSimpSvrObj FAR * m_lpObj; // Ptr to object
+ int m_nCount; // Ref count
+ DWORD m_dwStrong; // Connection Count
+
+public:
+ CExternalConnection::CExternalConnection(CSimpSvrObj FAR * lpSimpSvrObj)
+ {
+ m_lpObj = lpSimpSvrObj;
+ m_nCount = 0;
+ m_dwStrong = 0;
+ };
+
+ CExternalConnection::~CExternalConnection() {};
+
+ // *** IUnknown methods ***
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ // *** IExternalConnection methods ***
+ STDMETHODIMP_(DWORD) AddConnection (DWORD extconn, DWORD reserved);
+ STDMETHODIMP_(DWORD) ReleaseConnection (DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses);
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/ioipao.cpp b/private/oleutest/utests16/simpsvr/ioipao.cpp
new file mode 100644
index 000000000..0a85da592
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ioipao.cpp
@@ -0,0 +1,400 @@
+//**********************************************************************
+// File name: IOIPAO.CPP
+//
+// Implementation file for the CClassFactory Class
+//
+// Functions:
+//
+// See ioipao.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "ioipao.h"
+#include "app.h"
+#include "doc.h"
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In COleInPlaceActiveObject::QueryInterface\r\n");
+ // need to NULL the out parameter
+ return m_lpObj->QueryInterface(riid, ppvObj);
+}
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on COleInPlaceActiveObject and the
+// "object" object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on the "object" object.
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleInPlaceActiveObject::AddRef ()
+{
+ TestDebugOut("In COleInPlaceActiveObject::AddRef\r\n");
+
+ ++m_nCount;
+
+ return m_lpObj->AddRef();
+}
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::Release
+//
+// Purpose:
+//
+// Decrements the reference count of COleInPlaceActiveObject.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::Release OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleInPlaceActiveObject::Release ()
+{
+ TestDebugOut("In COleInPlaceActiveObject::Release\r\n");
+
+ --m_nCount;
+
+ return m_lpObj->Release();
+}
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::OnDocWindowActivate
+//
+// Purpose:
+//
+// Called when the doc window (in an MDI App) is (de)activated.
+//
+// Parameters:
+//
+// BOOL fActivate - TRUE if activating, FALSE if deactivating
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleInPlaceFrame::SetActiveObject Container
+// CSimpSvrObject::AddFrameLevelUI OBJ.CPP
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::OnDocWindowActivate ( BOOL fActivate )
+{
+ TestDebugOut("In COleInPlaceActiveObject::OnDocWindowActivate\r\n");
+
+ // Activating?
+ if (fActivate)
+ m_lpObj->AddFrameLevelUI();
+
+ // No frame level tools to remove...
+
+ return ResultFromScode(S_OK);
+};
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::OnFrameWindowActivate
+//
+// Purpose:
+//
+// Called when the Frame window is (de)activating
+//
+// Parameters:
+//
+// BOOL fActivate - TRUE if activating, FALSE if Deactivating
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// SetFocus Windows API
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::OnFrameWindowActivate ( BOOL fActivate)
+{
+ TestDebugOut("In COleInPlaceActiveObject::OnFrameWindowActivate\r\n");
+
+ // set the focus to the object window if we are activating.
+/* if (fActivate)
+ SetFocus(m_lpObj->m_lpDoc->GethDocWnd()); */
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::GetWindow
+//
+// Purpose:
+//
+// Gets the objects Window Handle.
+//
+// Parameters:
+//
+// HWND FAR* lphwnd - Location to return the window handle.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrDoc::GethDocWnd DOC.H
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::GetWindow ( HWND FAR* lphwnd)
+{
+ TestDebugOut("In COleInPlaceActiveObject::GetWindow\r\n");
+ // need to NULL the out parameter
+ *lphwnd = m_lpObj->m_lpDoc->GethDocWnd();
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::ContextSensitiveHelp
+//
+// Purpose:
+//
+// Used to implement Context Sensitive help
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// E_NOTIMPL
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+// See TECHNOTES.WRI include with the OLE SDK for proper
+// implementation of this function.
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::ContextSensitiveHelp ( BOOL fEnterMode )
+{
+ TestDebugOut("In COleInPlaceActiveObject::ContextSensitiveHelp\r\n");
+ return ResultFromScode( E_NOTIMPL);
+};
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::TranslateAccelerator
+//
+// Purpose:
+//
+// Used for translating accelerators in .DLL objects.
+//
+// Parameters:
+//
+// LPMSG lpmsg - Pointer to a message
+//
+// Return Value:
+//
+// S_FALSE
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+// This method should never be called since we are implemented
+// in an executable.
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::TranslateAccelerator ( LPMSG lpmsg)
+{
+ TestDebugOut("In COleInPlaceActiveObject::TranslateAccelerator\r\n");
+ // no accelerator table, return FALSE
+ return ResultFromScode( S_FALSE );
+};
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::ResizeBorder
+//
+// Purpose:
+//
+// Called when the border changes size.
+//
+// Parameters:
+//
+// LPCRECT lprectBorder - New Border
+//
+// LPOLEINPLACEUIWINDOW lpUIWindow - Pointer to UIWindow
+//
+// BOOL fFrameWindow - True if lpUIWindow is the
+// frame window.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+// Need to call SetBorderSpace again...
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::ResizeBorder ( LPCRECT lprectBorder,
+ LPOLEINPLACEUIWINDOW lpUIWindow,
+ BOOL fFrameWindow)
+{
+ TestDebugOut("In COleInPlaceActiveObject::ResizeBorder\r\n");
+
+ // should always have an inplace frame...
+ m_lpObj->GetInPlaceFrame()->SetBorderSpace(NULL);
+
+ // There will only be a UIWindow if in an MDI container
+ if (m_lpObj->GetUIWindow())
+ m_lpObj->GetUIWindow()->SetBorderSpace(NULL);
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleInPlaceActiveObject::EnableModeless
+//
+// Purpose:
+//
+// Called to enable/disable modeless dialogs.
+//
+// Parameters:
+//
+// BOOL fEnable - TRUE to enable, FALSE to disable
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+// Called by the container when a model dialog box is added/removed
+// from the screen. The appropriate action for a server application
+// is to disable/enable any modeless dialogs currently being displayed.
+// Since this application doesn't display any modeless dialogs,
+// this method is essentially ignored.
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceActiveObject::EnableModeless ( BOOL fEnable)
+{
+ TestDebugOut("In COleInPlaceActiveObject::EnableModeless\r\n");
+ return ResultFromScode( S_OK );
+};
diff --git a/private/oleutest/utests16/simpsvr/ioipao.h b/private/oleutest/utests16/simpsvr/ioipao.h
new file mode 100644
index 000000000..05a5c51c7
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ioipao.h
@@ -0,0 +1,50 @@
+//**********************************************************************
+// File name: IOIPAO.H
+//
+// Definition of COleInPlaceActiveObject
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _IOIPAO_H_)
+#define _IOIPAO_H_
+
+
+#include <ole2.h>
+#include "obj.h"
+
+class CSimpSvrObj;
+
+interface COleInPlaceActiveObject : public IOleInPlaceActiveObject
+{
+private:
+ CSimpSvrObj FAR * m_lpObj;
+ int m_nCount;
+
+public:
+ COleInPlaceActiveObject::COleInPlaceActiveObject(CSimpSvrObj FAR * lpSimpSvrObj)
+ {
+ m_lpObj = lpSimpSvrObj; // set up the back ptr
+ m_nCount = 0; // clear the ref count.
+ };
+ COleInPlaceActiveObject::~COleInPlaceActiveObject() {}; // destructor
+
+// IUnknown Methods
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ STDMETHODIMP OnDocWindowActivate ( BOOL fActivate) ;
+ STDMETHODIMP OnFrameWindowActivate ( BOOL fActivate) ;
+ STDMETHODIMP GetWindow ( HWND FAR* lphwnd);
+ STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode);
+ STDMETHODIMP TranslateAccelerator ( LPMSG lpmsg);
+ STDMETHODIMP ResizeBorder ( LPCRECT lprectBorder,
+ LPOLEINPLACEUIWINDOW lpUIWindow,
+ BOOL fFrameWindow);
+ STDMETHODIMP EnableModeless ( BOOL fEnable);
+
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/ioipo.cpp b/private/oleutest/utests16/simpsvr/ioipo.cpp
new file mode 100644
index 000000000..310c945c6
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ioipo.cpp
@@ -0,0 +1,413 @@
+//**********************************************************************
+// File name: IOIPO.CPP
+//
+// Implementation file for the CClassFactory Class
+//
+// Functions:
+//
+// See ioipo.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "ioipo.h"
+#include "app.h"
+#include "doc.h"
+#include "math.h"
+
+//**********************************************************************
+//
+// COleInPlaceObject::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In COleInPlaceObject::QueryInterface\r\n");
+ // need to NULL the out parameter
+ *ppvObj = NULL;
+ return m_lpObj->QueryInterface(riid, ppvObj);
+}
+
+//**********************************************************************
+//
+// COleInPlaceObject::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on COleInPlaceObject and the "object"
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on the Object
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleInPlaceObject::AddRef ()
+{
+ TestDebugOut("In COleInPlaceObject::AddRef\r\n");
+ ++m_nCount;
+ return m_lpObj->AddRef();
+}
+
+//**********************************************************************
+//
+// COleInPlaceObject::Release
+//
+// Purpose:
+//
+// Decrements the reference count of COleInPlaceObject and the
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::Release OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleInPlaceObject::Release ()
+{
+ TestDebugOut("In COleInPlaceObject::Release\r\n");
+ --m_nCount;
+ return m_lpObj->Release();
+}
+
+//**********************************************************************
+//
+// COleInPlaceObject::InPlaceDeactivate
+//
+// Purpose:
+//
+// Called to deactivat the object
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleClientSite::QueryInterface Container
+// IOleInPlaceSite::OnInPlaceDeactivate Container
+// IOleInPlaceSite::Release Container
+//
+// Comments:
+//
+//
+//********************************************************************
+
+
+STDMETHODIMP COleInPlaceObject::InPlaceDeactivate()
+{
+ TestDebugOut("In COleInPlaceObject::InPlaceDeactivate\r\n");
+
+ // if not inplace active, return NOERROR
+ if (!m_lpObj->m_fInPlaceActive)
+ return NOERROR;
+
+ // clear inplace flag
+ m_lpObj->m_fInPlaceActive = FALSE;
+
+ // deactivate the UI
+ m_lpObj->DeactivateUI();
+ m_lpObj->DoInPlaceHide();
+
+ // tell the container that we are deactivating.
+ if (m_lpObj->m_lpIPSite)
+ {
+ m_lpObj->m_lpIPSite->OnInPlaceDeactivate();
+ m_lpObj->m_lpIPSite->Release();
+ m_lpObj->m_lpIPSite =NULL;
+ }
+
+ return ResultFromScode(S_OK);
+}
+
+//**********************************************************************
+//
+// COleInPlaceObject::UIDeactivate
+//
+// Purpose:
+//
+// Instructs us to remove our UI.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// NOERROR
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleInPlaceUIWindow::SetActiveObject Container
+// IOleInPlaceFrame::SetActiveObject Container
+// IOleClientSite::QueryInterface Container
+// IOleInPlaceSite::OnUIDeactivate Container
+// IOleInPlaceSite::Release Container
+// CSimpSvrObj::DoInPlaceHide OBJ.H
+// IDataAdviseHolder::SendOnDataChange OLE
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceObject::UIDeactivate()
+{
+ TestDebugOut("In COleInPlaceObject::UIDeactivate\r\n");
+
+ m_lpObj->DeactivateUI();
+
+ return ResultFromScode (S_OK);
+}
+
+//**********************************************************************
+//
+// COleInPlaceObject::SetObjectRects
+//
+// Purpose:
+//
+// Called when the container clipping region or the object position
+// changes.
+//
+// Parameters:
+//
+// LPCRECT lprcPosRect - New Position Rect.
+//
+// LPCRECT lprcClipRect - New Clipping Rect.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IntersectRect Windows API
+// OffsetRect Windows API
+// CopyRect Windows API
+// MoveWindow Windows API
+// CSimpSvrDoc::GethHatchWnd DOC.H
+// CSimpSvrDoc::gethDocWnd DOC.h
+// SetHatchWindowSize OLE2UI
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceObject::SetObjectRects ( LPCRECT lprcPosRect, LPCRECT lprcClipRect)
+{
+ TestDebugOut("In COleInPlaceObject::SetObjectRects\r\n");
+
+ RECT resRect;
+ POINT pt;
+
+ // Get the intersection of the clipping rect and the position rect.
+ IntersectRect(&resRect, lprcPosRect, lprcClipRect);
+
+ m_lpObj->m_xOffset = abs (resRect.left - lprcPosRect->left);
+ m_lpObj->m_yOffset = abs (resRect.top - lprcPosRect->top);
+
+ m_lpObj->m_scale = (float)(lprcPosRect->right - lprcPosRect->left)/m_lpObj->m_size.x;
+
+ if (m_lpObj->m_scale == 0)
+ m_lpObj->m_scale = 1;
+
+ char szBuffer[255];
+ wsprintf(szBuffer,"New Scale %3d\r\n",m_lpObj->m_scale);
+ TestDebugOut(szBuffer);
+
+ // Adjust the size of the Hatch Window.
+ SetHatchWindowSize(m_lpObj->m_lpDoc->GethHatchWnd(),(LPRECT) lprcPosRect, (LPRECT) lprcClipRect, &pt);
+
+ // offset the rect
+ OffsetRect(&resRect, pt.x, pt.y);
+
+ CopyRect(&m_lpObj->m_posRect, lprcPosRect);
+
+ // Move the actual object window
+ MoveWindow(m_lpObj->m_lpDoc->GethDocWnd(),
+ resRect.left,
+ resRect.top,
+ resRect.right - resRect.left,
+ resRect.bottom - resRect.top,
+ TRUE);
+
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleInPlaceObject::GetWindow
+//
+// Purpose:
+//
+// Returns the Window handle of the inplace object
+//
+// Parameters:
+//
+// HWND FAR* lphwnd - Out pointer in which to return the window
+// Handle.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpleDoc::GethDocWnd DOC.H
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceObject::GetWindow ( HWND FAR* lphwnd)
+{
+ TestDebugOut("In COleInPlaceObject::GetWindow\r\n");
+ *lphwnd = m_lpObj->m_lpDoc->GethDocWnd();
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleInPlaceObject::ContextSensitiveHelp
+//
+// Purpose:
+//
+// Used in performing Context Sensitive Help
+//
+// Parameters:
+//
+// BOOL fEnterMode - Flag to determine if enter or exiting
+// Context Sensitive Help.
+//
+// Return Value:
+//
+// E_NOTIMPL
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This function is not implemented due to the fact that it is
+// beyond the scope of a simple object. All *real* applications
+// are going to want to implement this function, otherwise any
+// container that supports context sensitive help will not work
+// properly while the object is in place.
+//
+// See TECHNOTES.WRI include with the OLE SDK for details on
+// Implementing this method.
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceObject::ContextSensitiveHelp ( BOOL fEnterMode)
+{
+ TestDebugOut("In COleInPlaceObject::ContextSensitiveHelp\r\n");
+ return ResultFromScode( E_NOTIMPL);
+};
+
+//**********************************************************************
+//
+// COleInPlaceObject::ReactivateAndUndo
+//
+// Purpose:
+//
+// Called when the container wants to undo the last edit made in
+// the object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// INPLACE_E_NOTUNDOABLE
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Since this server does not support undo, the value
+// INPLACE_E_NOTUNDOABLE is always returned.
+//
+//********************************************************************
+
+STDMETHODIMP COleInPlaceObject::ReactivateAndUndo ()
+{
+ TestDebugOut("In COleInPlaceObject::ReactivateAndUndo\r\n");
+ return ResultFromScode( INPLACE_E_NOTUNDOABLE );
+};
diff --git a/private/oleutest/utests16/simpsvr/ioipo.h b/private/oleutest/utests16/simpsvr/ioipo.h
new file mode 100644
index 000000000..a30ebd171
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ioipo.h
@@ -0,0 +1,45 @@
+//**********************************************************************
+// File name: ioipo.h
+//
+// Definition of COleInPlaceObject
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _IOIPO_H_)
+#define _IOIPO_H_
+
+
+#include <ole2.h>
+#include "obj.h"
+
+class CSimpSvrObj;
+
+interface COleInPlaceObject : public IOleInPlaceObject
+{
+private:
+ CSimpSvrObj FAR * m_lpObj;
+ int m_nCount;
+
+public:
+ COleInPlaceObject::COleInPlaceObject(CSimpSvrObj FAR * lpSimpSvrObj)
+ {
+ m_lpObj = lpSimpSvrObj;
+ m_nCount = 0;
+ };
+ COleInPlaceObject::~COleInPlaceObject() {};
+
+// IUnknown Methods
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ STDMETHODIMP InPlaceDeactivate ();
+ STDMETHODIMP UIDeactivate () ;
+ STDMETHODIMP SetObjectRects ( LPCRECT lprcPosRect, LPCRECT lprcClipRect);
+ STDMETHODIMP GetWindow ( HWND FAR* lphwnd) ;
+ STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode);
+ STDMETHODIMP ReactivateAndUndo ();
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/ioo.cpp b/private/oleutest/utests16/simpsvr/ioo.cpp
new file mode 100644
index 000000000..b8cfb1ffa
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ioo.cpp
@@ -0,0 +1,1082 @@
+//**********************************************************************
+// File name: IOO.CPP
+//
+// Implementation file for the COleObject Class
+//
+// Functions:
+//
+// See ioo.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "ioo.h"
+#include "app.h"
+#include "doc.h"
+
+#define VERB_OPEN 1
+
+//**********************************************************************
+//
+// COleObject::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In COleObject::QueryInterface\r\n");
+ return m_lpObj->QueryInterface(riid, ppvObj);
+}
+
+//**********************************************************************
+//
+// COleObject::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on COleObject and the "object"
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on the Object.
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleObject::AddRef ()
+{
+ TestDebugOut("In COleObject::AddRef\r\n");
+ ++m_nCount;
+ return m_lpObj->AddRef();
+}
+
+//**********************************************************************
+//
+// COleObject::Release
+//
+// Purpose:
+//
+// Decrements the reference count of COleObject and the
+// "object" object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::Release OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) COleObject::Release ()
+{
+ TestDebugOut("In COleObject::Release\r\n");
+ --m_nCount;
+ return m_lpObj->Release();
+}
+
+//**********************************************************************
+//
+// COleObject::SetClientSite
+//
+// Purpose:
+//
+// Called to notify the object of it's client site.
+//
+// Parameters:
+//
+// LPOLECLIENTSITE pClientSite - ptr to new client site
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleClientSite::Release Container
+// IOleClientSite::AddRef Container
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::SetClientSite ( LPOLECLIENTSITE pClientSite)
+{
+ TestDebugOut("In COleObject::SetClientSite\r\n");
+
+ // if we already have a client site, release it.
+ if (m_lpObj->m_lpOleClientSite)
+ {
+ m_lpObj->m_lpOleClientSite->Release();
+ m_lpObj->m_lpOleClientSite = NULL;
+ }
+
+ // store copy of the client site.
+ m_lpObj->m_lpOleClientSite = pClientSite;
+
+ // AddRef it so it doesn't go away.
+ if (m_lpObj->m_lpOleClientSite)
+ m_lpObj->m_lpOleClientSite->AddRef();
+
+ return ResultFromScode(S_OK);
+}
+
+//**********************************************************************
+//
+// COleObject::Advise
+//
+// Purpose:
+//
+// Called to set up an advise on the OLE object.
+//
+// Parameters:
+//
+// LPADVISESINK pAdvSink - ptr to the Advise Sink for notification
+//
+// DWORD FAR* pdwConnection - place to return the connection ID.
+//
+// Return Value:
+//
+// Passed back from IOleAdviseHolder::Advise.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CreateOleAdviseHolder OLE API
+// IOleAdviseHolder::Advise OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::Advise ( LPADVISESINK pAdvSink, DWORD FAR* pdwConnection)
+{
+ TestDebugOut("In COleObject::Advise\r\n");
+
+ // if we haven't made an OleAdviseHolder yet, make one.
+ if (!m_lpObj->m_lpOleAdviseHolder)
+ CreateOleAdviseHolder(&m_lpObj->m_lpOleAdviseHolder);
+
+ // pass this call onto the OleAdviseHolder.
+ return m_lpObj->m_lpOleAdviseHolder->Advise(pAdvSink, pdwConnection);
+}
+
+//**********************************************************************
+//
+// COleObject::SetHostNames
+//
+// Purpose:
+//
+// Called to pass strings for Window titles.
+//
+// Parameters:
+//
+// LPCSTR szContainerApp - ptr to string describing Container App
+//
+// LPCSTR szContainerObj - ptr to string describing Object
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This routine is called so that the server application can
+// set the window title appropriately.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::SetHostNames ( LPCSTR szContainerApp, LPCSTR szContainerObj)
+{
+ TestDebugOut("In COleObject::SetHostNames\r\n");
+
+ return ResultFromScode( S_OK);
+};
+
+//**********************************************************************
+//
+// COleObject::DoVerb
+//
+// Purpose:
+//
+// Called by the container application to invoke a verb.
+//
+// Parameters:
+//
+// LONG iVerb - The value of the verb to be
+// invoked.
+//
+// LPMSG lpmsg - The message that caused the
+// verb to be invoked.
+//
+// LPOLECLIENTSITE pActiveSite - Ptr to the active client site.
+//
+// LONG lindex - Used in extended layout
+//
+// HWND hwndParent - This should be the window handle of
+// the window in which we are contained.
+// This value could be used to "fake"
+// inplace activation in a manner similar
+// to Video for Windows in OLE 1.0.
+//
+// LPCRECT lprcPosRect - The rectangle that contains the object
+// within hwndParent. Also used to
+// "fake" inplace activation.
+//
+// Return Value:
+//
+// OLE_E_NOTINPLACEACTIVE - Returned if attempted to undo while not
+// inplace active.
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ShowWindow Windows API
+// CSimpSvrObj::DoInPlaceActivate OBJ.CPP
+// CSimpSvrObj::DoInPlaceHide OBJ.CPP
+// COleObject::OpenEdit IOO.CPP
+// CSimpSvrDoc::GethDocWnd DOC.H
+// COleInPlaceObj::InPlaceDeactivate IOIPO.CPP
+//
+// Comments:
+//
+// Be sure to look at TECHNOTES.WRI included with the OLE
+// SDK for a description of handling the inplace verbs
+// properly.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::DoVerb ( LONG iVerb,
+ LPMSG lpmsg,
+ LPOLECLIENTSITE pActiveSite,
+ LONG lindex,
+ HWND hwndParent,
+ LPCRECT lprcPosRect)
+{
+ TestDebugOut("In COleObject::DoVerb\r\n");
+
+ switch (iVerb)
+ {
+ case OLEIVERB_SHOW:
+ case OLEIVERB_PRIMARY:
+ if (m_fOpen)
+ SetFocus(m_lpObj->m_lpDoc->GethAppWnd());
+ else if (m_lpObj->DoInPlaceActivate(iVerb) == FALSE)
+ OpenEdit(pActiveSite);
+ break;
+
+ case OLEIVERB_UIACTIVATE:
+ if (m_fOpen)
+ return ResultFromScode (E_FAIL);
+
+ // inplace activate
+ if (!m_lpObj->DoInPlaceActivate(iVerb))
+ return ResultFromScode (E_FAIL);
+ break;
+
+ case OLEIVERB_DISCARDUNDOSTATE:
+ // don't have to worry about this situation as we don't
+ // support an undo state.
+ if (!m_lpObj->m_fInPlaceActive)
+ return ResultFromScode(OLE_E_NOT_INPLACEACTIVE);
+ break;
+
+ case OLEIVERB_HIDE:
+ // if inplace active, do an "inplace" hide, otherwise
+ // just hide the app window.
+ if (m_lpObj->m_fInPlaceActive)
+ {
+ m_lpObj->DeactivateUI();
+ m_lpObj->DoInPlaceHide();
+ }
+ else
+ m_lpObj->m_lpDoc->GetApp()->HideAppWnd();
+ break;
+
+ case OLEIVERB_OPEN:
+ case VERB_OPEN:
+ // if inplace active, deactivate
+ if (m_lpObj->m_fInPlaceActive)
+ m_lpObj->m_OleInPlaceObject.InPlaceDeactivate();
+
+ // open into another window.
+ OpenEdit(pActiveSite);
+ break;
+
+ default:
+ if (iVerb < 0)
+ return ResultFromScode(E_FAIL);
+ }
+
+ return ResultFromScode( S_OK);
+};
+
+//**********************************************************************
+//
+// COleObject::GetExtent
+//
+// Purpose:
+//
+// Returns the extent of the object.
+//
+// Parameters:
+//
+// DWORD dwDrawAspect - The aspect in which to get the size.
+//
+// LPSIZEL lpsizel - Out ptr to return the size.
+//
+// Return Value:
+//
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// XformWidthInPixelsToHimetric OLE2UI
+// XformHeightInPixelsToHimetric OLE2UI
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel)
+{
+ TestDebugOut("In COleObject::GetExtent\r\n");
+
+ SCODE sc = E_FAIL;
+
+ // Only DVASPECT_CONTENT is supported....
+ if (dwDrawAspect == DVASPECT_CONTENT)
+ {
+ sc = S_OK;
+
+ // return the correct size in HIMETRIC...
+ lpsizel->cx = XformWidthInPixelsToHimetric(NULL, m_lpObj->m_size.x);
+ lpsizel->cy = XformHeightInPixelsToHimetric(NULL, m_lpObj->m_size.y);
+ }
+
+ return ResultFromScode( sc );
+};
+
+//**********************************************************************
+//
+// COleObject::Update
+//
+// Purpose:
+//
+// Called to get the most up to date data
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IDataAdviseHolder::SendOnDataChange OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::Update()
+{
+ TestDebugOut("In COleObject::Update\r\n");
+
+ // force an update
+ m_lpObj->SendOnDataChange();
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleObject::Close
+//
+// Purpose:
+//
+// Called when the OLE object needs to be closed
+//
+// Parameters:
+//
+// DWORD dwSaveOption - Flags to instruct the server how to prompt
+// the user.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrDoc::Close DOC.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::Close ( DWORD dwSaveOption)
+{
+ TestDebugOut("In COleObject::Close\r\n");
+
+ // delegate to the document object.
+ m_lpObj->m_lpDoc->Close();
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleObject::Unadvise
+//
+// Purpose:
+//
+// Breaks down an OLE advise that has been set up on this object.
+//
+// Parameters:
+//
+// DWORD dwConnection - Connection that needs to be broken down
+//
+// Return Value:
+//
+// Passed back from IOleAdviseHolder::Unadvise
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleAdviseHolder::Unadvise OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::Unadvise ( DWORD dwConnection)
+{
+ TestDebugOut("In COleObject::Unadvise\r\n");
+
+ // pass on to OleAdviseHolder.
+ return m_lpObj->m_lpOleAdviseHolder->Unadvise(dwConnection);
+};
+
+//**********************************************************************
+//
+// COleObject::EnumVerbs
+//
+// Purpose:
+//
+// Enumerates the verbs associated with this object.
+//
+// Parameters:
+//
+// LPENUMOLEVERB FAR* ppenumOleVerb - Out ptr in which to return
+// the enumerator
+//
+// Return Value:
+//
+// OLE_S_USEREG - Instructs OLE to use the verbs found in the
+// REG DB for this server.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// In a .DLL, an application cannot return OLE_S_USEREG. This is
+// due to the fact that the default object handler is not being
+// used, and the container is really making direct function calls
+// into the server .DLL.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::EnumVerbs ( LPENUMOLEVERB FAR* ppenumOleVerb)
+{
+ TestDebugOut("In COleObject::EnumVerbs\r\n");
+
+ return ResultFromScode( OLE_S_USEREG );
+};
+
+//**********************************************************************
+//
+// COleObject::GetClientSite
+//
+// Purpose:
+//
+// Called to get the current client site of the object.
+//
+// Parameters:
+//
+// LPOLECLIENTSITE FAR* ppClientSite - Out ptr in which to return the
+// client site.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetClientSite ( LPOLECLIENTSITE FAR* ppClientSite)
+{
+ TestDebugOut("In COleObject::GetClientSite\r\n");
+ *ppClientSite = m_lpObj->m_lpOleClientSite;
+ return ResultFromScode( S_OK );
+}
+
+//**********************************************************************
+//
+// COleObject::SetMoniker
+//
+// Purpose:
+//
+// Used to set the objects moniker
+//
+// Parameters:
+//
+// DWORD dwWhichMoniker - Type of moniker being set
+//
+// LPMONIKER pmk - Pointer to the moniker
+//
+// Return Value:
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::SetMoniker ( DWORD dwWhichMoniker, LPMONIKER pmk)
+{
+ TestDebugOut("In COleObject::SetMoniker\r\n");
+
+ LPMONIKER lpmk;
+
+ if (! m_lpObj->GetOleClientSite())
+ return ResultFromScode (E_FAIL);
+
+ if (m_lpObj->GetOleClientSite()->GetMoniker (OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, &lpmk) != NOERROR)
+ return ResultFromScode (E_FAIL);
+
+
+ if (m_lpObj->GetOleAdviseHolder())
+ m_lpObj->GetOleAdviseHolder()->SendOnRename(lpmk);
+
+ LPRUNNINGOBJECTTABLE lpRot;
+
+ if (GetRunningObjectTable(0, &lpRot) == NOERROR)
+ {
+ if (m_lpObj->m_dwRegister)
+ lpRot->Revoke(m_lpObj->m_dwRegister);
+
+ lpRot->Register(0, m_lpObj, lpmk, &m_lpObj->m_dwRegister);
+
+ lpRot->Release();
+ }
+
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleObject::GetMoniker
+//
+// Purpose:
+//
+////
+// Parameters:
+//
+// DWORD dwAssign - Assignment for the moniker
+//
+// DWORD dwWhichMoniker - Which moniker to return
+//
+// LPMONIKER FAR* ppmk - An out ptr to return the moniker
+//
+// Return Value:
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetMoniker ( DWORD dwAssign, DWORD dwWhichMoniker,
+ LPMONIKER FAR* ppmk)
+{
+ TestDebugOut("In COleObject::GetMoniker\r\n");
+ // need to NULL the out parameter
+ *ppmk = NULL;
+
+ return m_lpObj->GetOleClientSite()->GetMoniker (OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, ppmk);
+};
+
+//**********************************************************************
+//
+// COleObject::InitFromData
+//
+// Purpose:
+//
+// Initialize the object from the passed pDataObject.
+//
+// Parameters:
+//
+// LPDATAOBJECT pDataObject - Pointer to data transfer object
+// to be used in the initialization
+//
+// BOOL fCreation - TRUE if the object is currently being
+// created.
+//
+// DWORD dwReserved - Reserved
+//
+// Return Value:
+//
+// S_FALSE
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// We don't support this functionality, so we will always return
+// error.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::InitFromData ( LPDATAOBJECT pDataObject,
+ BOOL fCreation,
+ DWORD dwReserved)
+{
+ TestDebugOut("In COleObject::InitFromData\r\n");
+
+ return ResultFromScode( S_FALSE );
+};
+
+//**********************************************************************
+//
+// COleObject::GetClipboardData
+//
+// Purpose:
+//
+// Returns an IDataObject that is the same as doing an OleSetClipboard
+//
+// Parameters:
+//
+// DWORD dwReserved - Reserved
+//
+// LPDATAOBJECT FAR* ppDataObject - Out ptr for the Data Object.
+//
+// Return Value:
+//
+// OLE_E_NOTSUPPORTED
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Support of this method is optional.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetClipboardData ( DWORD dwReserved,
+ LPDATAOBJECT FAR* ppDataObject)
+{
+ TestDebugOut("In COleObject::GetClipboardData\r\n");
+ // NULL the out ptr
+ *ppDataObject = NULL;
+ return ResultFromScode( E_NOTIMPL );
+};
+
+//**********************************************************************
+//
+// COleObject::IsUpToDate
+//
+// Purpose:
+//
+// Determines if an object is up to date
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// Our embedded object is always up to date. This function is
+// particularly useful in linking situations.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::IsUpToDate()
+{
+ TestDebugOut("In COleObject::IsUpToDate\r\n");
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleObject::GetUserClassID
+//
+// Purpose:
+//
+// Returns the applications CLSID
+//
+// Parameters:
+//
+// CLSID FAR* pClsid - Out ptr to return the CLSID
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CPersistStorage::GetClassID IPS.CPP
+//
+// Comments:
+//
+// This function is just delegated to IPS::GetClassID.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetUserClassID ( CLSID FAR* pClsid)
+{
+ TestDebugOut("In COleObject::GetUserClassID\r\n");
+
+ m_lpObj->m_PersistStorage.GetClassID(pClsid);
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleObject::GetUserType
+//
+// Purpose:
+//
+// Used to get a user presentable id for this object
+//
+// Parameters:
+//
+// DWORD dwFormOfType - The ID requested
+//
+// LPSTR FAR* pszUserType - Out ptr to return the string
+//
+// Return Value:
+//
+// OLE_S_USEREG - Use the reg db to get these entries.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetUserType ( DWORD dwFormOfType, LPSTR FAR* pszUserType)
+{
+ TestDebugOut("In COleObject::GetUserType\r\n");
+
+ return ResultFromScode( OLE_S_USEREG );
+};
+
+//**********************************************************************
+//
+// COleObject::SetExtent
+//
+// Purpose:
+//
+// Called to set the extent of the object.
+//
+// Parameters:
+//
+// DWORD dwDrawAspect - Aspect to have its size set
+//
+// LPSIZEL lpsizel - New size of the object.
+//
+// Return Value:
+//
+// E_NOTIMPL - This function is not curently implemented.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::SetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel)
+{
+ TestDebugOut("In COleObject::SetExtent\r\n");
+ return ResultFromScode( E_NOTIMPL);
+};
+
+//**********************************************************************
+//
+// COleObject::EnumAdvise
+//
+// Purpose:
+//
+// Returns an enumerate which enumerates the outstanding advises
+// associated with this OLE object.
+//
+// Parameters:
+//
+// LPENUMSTATDATA FAR* ppenumAdvise - Out ptr in which to return
+// the enumerator.
+//
+// Return Value:
+//
+// Passed on from IOleAdviseHolder::EnumAdvise.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleAdviseHolder::EnumAdvise OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::EnumAdvise ( LPENUMSTATDATA FAR* ppenumAdvise)
+{
+ TestDebugOut("In COleObject::EnumAdvise\r\n");
+ // need to NULL the out parameter
+ *ppenumAdvise = NULL;
+
+ // pass on to the OLE Advise holder.
+ return m_lpObj->m_lpOleAdviseHolder->EnumAdvise(ppenumAdvise);
+};
+
+//**********************************************************************
+//
+// COleObject::GetMiscStatus
+//
+// Purpose:
+//
+// Return status information about the object
+//
+// Parameters:
+//
+// DWORD dwAspect - Aspect interested in.
+//
+// DWORD FAR* pdwStatus - Out ptr in which to return the bits.
+//
+// Return Value:
+//
+// CO_E_READREGDB - Tell the library to use the reg DB.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::GetMiscStatus ( DWORD dwAspect, DWORD FAR* pdwStatus)
+{
+ TestDebugOut("In COleObject::GetMiscStatus\r\n");
+ // need to NULL the out parameter
+ *pdwStatus = NULL;
+ return ResultFromScode( OLE_S_USEREG );
+};
+
+//**********************************************************************
+//
+// COleObject::SetColorScheme
+//
+// Purpose:
+//
+// Used to set the palette for the object to use.
+//
+// Parameters:
+//
+// LPLOGPALETTE lpLogpal - Pointer to the LOGPALETTE to be used.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+// Comments:
+//
+// This server ignores this method.
+//
+//********************************************************************
+
+STDMETHODIMP COleObject::SetColorScheme ( LPLOGPALETTE lpLogpal)
+{
+ TestDebugOut("In COleObject::SetColorScheme\r\n");
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// COleObject::OpenEdit
+//
+// Purpose:
+//
+// Used to Open the object into a seperate window.
+//
+// Parameters:
+//
+// LPOLECLIENTSITE pActiveSite - Pointer to the Active clientsite.
+//
+// Return Value:
+//
+// None.
+//
+// Function Calls:
+// Function Location
+//
+// IOleClientSite::OnShowWindow Container
+// ShowWindow Windows API
+// UpdateWindow Windows API
+// TestDebugOut Windows API
+// CSimpSvrDoc::GethAppWnd DOC.H
+// CSimpSvrDoc::GethHatchWnd DOC.H
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void COleObject::OpenEdit(LPOLECLIENTSITE pActiveSite)
+{
+ if (m_lpObj->GetOleClientSite())
+ m_lpObj->GetOleClientSite()->ShowObject();
+
+
+ m_fOpen = TRUE;
+
+ // tell the site we are opening so the object can be hatched out.
+ if (m_lpObj->GetOleClientSite())
+ m_lpObj->GetOleClientSite()->OnShowWindow(TRUE);
+
+
+ m_lpObj->m_lpDoc->ShowDocWnd();
+
+ m_lpObj->m_lpDoc->HideHatchWnd();
+
+ // Show app window.
+ m_lpObj->m_lpDoc->GetApp()->ShowAppWnd();
+
+ SetFocus(m_lpObj->m_lpDoc->GethAppWnd());
+}
diff --git a/private/oleutest/utests16/simpsvr/ioo.h b/private/oleutest/utests16/simpsvr/ioo.h
new file mode 100644
index 000000000..89856b104
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ioo.h
@@ -0,0 +1,73 @@
+//**********************************************************************
+// File name: ioo.h
+//
+// Definition of COleObject
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#if !defined( _IOO_H_)
+#define _IOO_H_
+
+
+#include <ole2.h>
+#include "obj.h"
+
+class CSimpSvrObj;
+
+interface COleObject : public IOleObject
+{
+private:
+ CSimpSvrObj FAR * m_lpObj;
+ int m_nCount;
+ BOOL m_fOpen;
+
+public:
+ COleObject::COleObject(CSimpSvrObj FAR * lpSimpSvrObj)
+ {
+ m_lpObj = lpSimpSvrObj;
+ m_nCount = 0;
+ m_fOpen = FALSE;
+ };
+ COleObject::~COleObject()
+ {
+ };
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ STDMETHODIMP SetClientSite (LPOLECLIENTSITE pClientSite);
+ STDMETHODIMP Advise (LPADVISESINK pAdvSink, DWORD FAR* pdwConnection);
+ STDMETHODIMP SetHostNames ( LPCSTR szContainerApp, LPCSTR szContainerObj);
+ STDMETHODIMP DoVerb ( LONG iVerb,
+ LPMSG lpmsg,
+ LPOLECLIENTSITE pActiveSite,
+ LONG lindex,
+ HWND hwndParent,
+ LPCRECT lprcPosRect);
+ STDMETHODIMP GetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel);
+ STDMETHODIMP Update () ;
+ STDMETHODIMP Close ( DWORD dwSaveOption) ;
+ STDMETHODIMP Unadvise ( DWORD dwConnection);
+ STDMETHODIMP EnumVerbs ( LPENUMOLEVERB FAR* ppenumOleVerb) ;
+ STDMETHODIMP GetClientSite ( LPOLECLIENTSITE FAR* ppClientSite);
+ STDMETHODIMP SetMoniker ( DWORD dwWhichMoniker, LPMONIKER pmk);
+ STDMETHODIMP GetMoniker ( DWORD dwAssign, DWORD dwWhichMoniker,
+ LPMONIKER FAR* ppmk);
+ STDMETHODIMP InitFromData ( LPDATAOBJECT pDataObject,
+ BOOL fCreation,
+ DWORD dwReserved);
+ STDMETHODIMP GetClipboardData ( DWORD dwReserved,
+ LPDATAOBJECT FAR* ppDataObject);
+ STDMETHODIMP IsUpToDate ();
+ STDMETHODIMP GetUserClassID ( CLSID FAR* pClsid);
+ STDMETHODIMP GetUserType ( DWORD dwFormOfType, LPSTR FAR* pszUserType);
+ STDMETHODIMP SetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel);
+ STDMETHODIMP EnumAdvise ( LPENUMSTATDATA FAR* ppenumAdvise);
+ STDMETHODIMP GetMiscStatus ( DWORD dwAspect, DWORD FAR* pdwStatus);
+ STDMETHODIMP SetColorScheme ( LPLOGPALETTE lpLogpal);
+
+ void OpenEdit(LPOLECLIENTSITE pActiveSite);
+
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/ips.cpp b/private/oleutest/utests16/simpsvr/ips.cpp
new file mode 100644
index 000000000..fe695cb18
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ips.cpp
@@ -0,0 +1,651 @@
+//**********************************************************************
+// File name: ips.cpp
+//
+// Implementation file for the CSimpSvrApp Class
+//
+// Functions:
+//
+// See ips.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "ips.h"
+#include "app.h"
+#include "doc.h"
+
+#include <storage.h>
+
+#ifdef WIN32
+DEFINE_GUID(GUID_SIMPLE, 0xBCF6D4A0, 0xBE8C, 0x1068, 0xB6, 0xD4, 0x00, 0xDD, 0x01, 0x0C, 0x05, 0x09);
+#else
+DEFINE_GUID(GUID_SIMPLE, 0x9fb878d0, 0x6f88, 0x101b, 0xbc, 0x65, 0x00, 0x00, 0x0b, 0x65, 0xc7, 0xa6);
+#endif
+
+//**********************************************************************
+//
+// CPersistStorage::QueryInterface
+//
+// Purpose:
+//
+//
+// Parameters:
+//
+// REFIID riid - Interface being queried for.
+//
+// LPVOID FAR *ppvObj - Out pointer for the interface.
+//
+// Return Value:
+//
+// S_OK - Success
+// E_NOINTERFACE - Failure
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrObj::QueryInterface OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CPersistStorage::QueryInterface\r\n");
+ // need to NULL the out parameter
+ return m_lpObj->QueryInterface(riid, ppvObj);
+};
+
+//**********************************************************************
+//
+// CPersistStorage::AddRef
+//
+// Purpose:
+//
+// Increments the reference count on CPersistStorage and the "object"
+// object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The Reference count on the Object.
+//
+// Function Calls:
+// Function Location
+//
+// OuputDebugString Windows API
+// CSimpSvrObj::AddRef OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CPersistStorage::AddRef ()
+{
+ TestDebugOut("In CPersistStorage::AddRef\r\n");
+ ++m_nCount;
+ return m_lpObj->AddRef();
+};
+
+//**********************************************************************
+//
+// CPersistStorage::Release
+//
+// Purpose:
+//
+// Decrements the reference count of CPersistStorage and the
+// "object" object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// The new reference count
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::Release OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CPersistStorage::Release ()
+{
+ TestDebugOut("In CPersistStorage::Release\r\n");
+ --m_nCount;
+ return m_lpObj->Release();
+};
+
+//**********************************************************************
+//
+// CPersistStorage::InitNew
+//
+// Purpose:
+//
+// Used to give a new OLE object a ptr to its storage.
+//
+// Parameters:
+//
+// LPSTORAGE pStg - Pointer to the storage
+//
+// Return Value:
+//
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::Release OLE
+// IStorage::AddRef OLE
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::InitNew (LPSTORAGE pStg)
+{
+ TestDebugOut("In CPersistStorage::InitNew\r\n");
+
+ // release any streams and storages that may be open
+ ReleaseStreamsAndStorage();
+
+ m_lpObj->m_lpStorage = pStg;
+
+ // AddRef the new Storage
+ if (m_lpObj->m_lpStorage)
+ m_lpObj->m_lpStorage->AddRef();
+
+ CreateStreams(m_lpObj->m_lpStorage);
+
+ return ResultFromScode(S_OK);
+}
+
+//**********************************************************************
+//
+// CPersistStorage::GetClassID
+//
+// Purpose:
+//
+// Returns the CLSID of this object.
+//
+// Parameters:
+//
+// LPCLSID lpClassID - Out ptr in which to return the CLSID
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::GetClassID ( LPCLSID lpClassID)
+{
+ TestDebugOut("In CPersistStorage::GetClassID\r\n");
+
+ *lpClassID = GUID_SIMPLE;
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// CPersistStorage::Save
+//
+// Purpose:
+//
+// Instructs the object to save itself into the storage.
+//
+// Parameters:
+//
+// LPSTORAGE pStgSave - Storage in which the object should be saved
+//
+// BOOL fSameAsLoad - TRUE if pStgSave is the same as the storage
+// that the object was originally created with.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CPersistStorage::InitNew IPS.CPP
+// CSimpSvrObj::SaveToStorage OBJ.CPP
+//
+//
+// Comments:
+//
+// A real app will want better error checking in this method.
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::Save ( LPSTORAGE pStgSave, BOOL fSameAsLoad)
+{
+ TestDebugOut("In CPersistStorage::Save\r\n");
+
+ // save the data
+ m_lpObj->SaveToStorage (pStgSave, fSameAsLoad);
+
+ m_lpObj->m_fSaveWithSameAsLoad = fSameAsLoad;
+ m_lpObj->m_fNoScribbleMode = TRUE;
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// CPersistStorage::SaveCompleted
+//
+// Purpose:
+//
+// Called when the container is finished saving the object
+//
+// Parameters:
+//
+// LPSTORAGE pStgNew - ptr to the new storage
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::SaveCompleted ( LPSTORAGE pStgNew)
+{
+ TestDebugOut("In CPersistStorage::SaveCompleted\r\n");
+
+ if (pStgNew)
+ {
+ ReleaseStreamsAndStorage();
+ m_lpObj->m_lpStorage = pStgNew;
+ m_lpObj->m_lpStorage->AddRef();
+ OpenStreams(pStgNew);
+ }
+
+
+ /* OLE2NOTE: it is only legal to perform a Save or SaveAs operation
+ ** on an embedded object. if the document is a file-based document
+ ** then we can not be changed to a IStorage-base object.
+ **
+ ** fSameAsLoad lpStgNew Type of Save Send OnSave
+ ** ---------------------------------------------------------
+ ** TRUE NULL SAVE YES
+ ** TRUE ! NULL SAVE * YES
+ ** FALSE ! NULL SAVE AS YES
+ ** FALSE NULL SAVE COPY AS NO
+ **
+ ** * this is a strange case that is possible. it is inefficient
+ ** for the caller; it would be better to pass lpStgNew==NULL for
+ ** the Save operation.
+ */
+
+ if ( pStgNew || m_lpObj->m_fSaveWithSameAsLoad)
+ {
+ if (m_lpObj->m_fNoScribbleMode)
+ m_lpObj->GetOleAdviseHolder()->SendOnSave(); // normally would clear a
+ // dirty bit
+ m_lpObj->m_fSaveWithSameAsLoad = FALSE;
+ }
+
+ m_lpObj->m_fNoScribbleMode = FALSE;
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// CPersistStorage::Load
+//
+// Purpose:
+//
+// Instructs the object to be loaded from storage.
+//
+// Parameters:
+//
+// LPSTORAGE pStg - Ptr to the storage in which to be loaded
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CSimpSvrObj::LoadFromStorage OBJ.CPP
+//
+//
+// Comments:
+//
+// A real app will want better error checking in this method.
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::Load ( LPSTORAGE pStg)
+{
+ TestDebugOut("In CPersistStorage::Load\r\n");
+
+ // remember the storage
+ if (m_lpObj->m_lpStorage)
+ {
+ m_lpObj->m_lpStorage->Release();
+ m_lpObj->m_lpStorage = NULL;
+ }
+
+ m_lpObj->m_lpStorage = pStg;
+
+ m_lpObj->m_lpStorage->AddRef();
+
+ OpenStreams(m_lpObj->m_lpStorage);
+
+ m_lpObj->LoadFromStorage();
+
+
+ return ResultFromScode( S_OK );
+};
+
+
+//**********************************************************************
+//
+// CPersistStorage::IsDirty
+//
+// Purpose:
+//
+// Returns whether or not the object is dirty w/respect to its
+// Storage
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+//
+//
+// Comments:
+//
+// This sample does not implement this function, although a
+// real application should.
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::IsDirty()
+{
+ TestDebugOut("In CPersistStorage::IsDirty\r\n");
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// CPersistStorage::HandsOffStorage
+//
+// Purpose:
+//
+// Forces the object to release its handle to its storage.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::Release OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CPersistStorage::HandsOffStorage ()
+{
+ TestDebugOut("In CPersistStorage::HandsOffStorage\r\n");
+
+ ReleaseStreamsAndStorage();
+
+ return ResultFromScode( S_OK );
+};
+
+//**********************************************************************
+//
+// CPersistStorage::CreateStreams
+//
+// Purpose:
+//
+// Creates the streams that are held open for the object's lifetime.
+//
+// Parameters:
+//
+// LPSTORAGE lpStg - Storage in which to create the streams
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::Release OLE
+// IStream::Release OLE
+// IStorage::CreateStream OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CPersistStorage::CreateStreams(LPSTORAGE lpStg)
+{
+ if (m_lpObj->m_lpColorStm)
+ m_lpObj->m_lpColorStm->Release();
+
+ if (m_lpObj->m_lpSizeStm)
+ m_lpObj->m_lpSizeStm->Release();
+
+ // create a stream to save the colors
+ lpStg->CreateStream ( "RGB",
+ STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
+ 0,
+ 0,
+ &m_lpObj->m_lpColorStm);
+
+ // create a stream to save the size
+ lpStg->CreateStream ( "size",
+ STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
+ 0,
+ 0,
+ &m_lpObj->m_lpSizeStm);
+}
+
+//**********************************************************************
+//
+// CPersistStorage::OpenStreams
+//
+// Purpose:
+//
+// Opens the streams in a storage.
+//
+// Parameters:
+//
+// LPSTORAGE lpStg - Storage in which to open the streams.
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::Release OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CPersistStorage::OpenStreams(LPSTORAGE lpStg)
+{
+ if (m_lpObj->m_lpColorStm)
+ m_lpObj->m_lpColorStm->Release();
+
+ if (m_lpObj->m_lpSizeStm)
+ m_lpObj->m_lpSizeStm->Release();
+
+ // open the color stream
+ lpStg->OpenStream ( "RGB",
+ 0,
+ STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
+ 0,
+ &m_lpObj->m_lpColorStm);
+
+ // open the color stream
+ lpStg->OpenStream ( "size",
+ 0,
+ STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
+ 0,
+ &m_lpObj->m_lpSizeStm);
+}
+
+//**********************************************************************
+//
+// CPersistStorage::ReleaseStreamsAndStorage
+//
+// Purpose:
+//
+// Releases the stream and storage ptrs
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::Release OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CPersistStorage::ReleaseStreamsAndStorage()
+{
+ if (m_lpObj->m_lpColorStm)
+ {
+ m_lpObj->m_lpColorStm->Release();
+ m_lpObj->m_lpColorStm = NULL;
+ }
+
+ if (m_lpObj->m_lpSizeStm)
+ {
+ m_lpObj->m_lpSizeStm->Release();
+ m_lpObj->m_lpSizeStm = NULL;
+ }
+
+ if (m_lpObj->m_lpStorage)
+ {
+ m_lpObj->m_lpStorage->Release();
+ m_lpObj->m_lpStorage = NULL;
+ }
+}
+
+//**********************************************************************
+//
+// CPersistStorage::CreateStreams
+//
+// Purpose:
+//
+// Creates temporary streams in a storage.
+//
+// Parameters:
+//
+// LPSTORAGE lpStg - Pointer to the storage
+//
+// LPSTREAM FAR* lplpTempColor - Color Stream
+//
+// LPSTREAM FAR* lplpTempSize - Size Stream
+//
+// Return Value:
+//
+// S_OK
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::Release OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CPersistStorage::CreateStreams(LPSTORAGE lpStg, LPSTREAM FAR* lplpTempColor,LPSTREAM FAR* lplpTempSize)
+{
+ // create a stream to save the colors
+ lpStg->CreateStream ( "RGB",
+ STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
+ 0,
+ 0,
+ lplpTempColor);
+
+ // create a stream to save the size
+ lpStg->CreateStream ( "size",
+ STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
+ 0,
+ 0,
+ lplpTempSize);
+
+}
diff --git a/private/oleutest/utests16/simpsvr/ips.h b/private/oleutest/utests16/simpsvr/ips.h
new file mode 100644
index 000000000..20f543ab5
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/ips.h
@@ -0,0 +1,53 @@
+//**********************************************************************
+// File name: ips.h
+//
+// Definition of CPersistStorage
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _IPS_H_)
+#define _IPS_H_
+
+
+#include <ole2.h>
+#include <storage.h>
+#include "obj.h"
+
+class CSimpSvrObj;
+
+interface CPersistStorage : IPersistStorage
+{
+private:
+ CSimpSvrObj FAR * m_lpObj;
+ int m_nCount;
+ BOOL m_fSameAsLoad;
+
+public:
+ CPersistStorage::CPersistStorage(CSimpSvrObj FAR * lpSimpSvrObj)
+ {
+ m_lpObj = lpSimpSvrObj;
+ m_nCount = 0;
+ };
+ CPersistStorage::~CPersistStorage() {};
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+ STDMETHODIMP InitNew (LPSTORAGE pStg);
+ STDMETHODIMP GetClassID ( LPCLSID lpClassID) ;
+ STDMETHODIMP Save ( LPSTORAGE pStgSave, BOOL fSameAsLoad) ;
+ STDMETHODIMP SaveCompleted ( LPSTORAGE pStgNew);
+ STDMETHODIMP Load ( LPSTORAGE pStg);
+ STDMETHODIMP IsDirty ();
+ STDMETHODIMP HandsOffStorage ();
+
+ void ReleaseStreamsAndStorage();
+ void OpenStreams(LPSTORAGE lpStg);
+ void CreateStreams(LPSTORAGE lpStg);
+ void CreateStreams(LPSTORAGE lpStg, LPSTREAM FAR *lpTempColor, LPSTREAM FAR *lpTempSize);
+
+};
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/makefile b/private/oleutest/utests16/simpsvr/makefile
new file mode 100644
index 000000000..62ed10bc3
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/makefile
@@ -0,0 +1,98 @@
+#//+---------------------------------------------------------------------------
+#//
+#// Microsoft Windows
+#// Copyright (C) Microsoft Corporation, 1992 - 1994.
+#//
+#// File: makefile
+#// Contents: makefile for 16 bit spsvr16 for OLETHUNK unit test.
+#//
+#// History: 06-16-94 terryru Created
+#//
+#//----------------------------------------------------------------------------
+
+
+!IFDEF USEBUILD
+
+# If using BUILD.EXE, 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
+
+!ELSE
+
+default: copy_bin
+
+TARGET = spsvr16.exe
+TARGETTYPE = EXE
+OLETHUNK = $(_NTDRIVE)$(_NTROOT)\private\cairole\olethunk
+
+RCINC=$(RCINC) -i..\ole2ui -i..\ole2ui\res\usa
+
+CDEFINES= -I..\ole2ui /GEs
+
+LFLAGS=/STACK:16384
+
+CPPFILES = \
+ .\app.cpp \
+ .\doc.cpp \
+ .\icf.cpp \
+ .\ido.cpp \
+ .\iec.cpp \
+ .\ioipao.cpp \
+ .\ioipo.cpp \
+ .\ioo.cpp \
+ .\ips.cpp \
+ .\obj.cpp \
+ .\pre.cpp \
+ .\simpsvr.cpp
+
+
+
+
+
+
+
+
+RCFILES = \
+ .\spsvr16.rc
+
+
+
+LIBS = $(LIBS)\
+ $(OLE16)\lib\ole2.lib \
+ $(OLE16)\lib\storage.lib \
+ $(OLE16)\lib\loleuic.lib \
+ $(OLE16)\lib\compobj.lib \
+ $(OLE16)\lib\shell.lib
+
+!include ..\makefile.inc
+
+
+!if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
+LIBS = $(LIBS) $(OLETHUNK)\debnot\$(OBJDIR)\debnot.lib
+!endif
+
+
+copy_bin: all
+ binplace $(OBJDIR)\spsvr16.exe
+ binplace $(OBJDIR)\spsvr16.sym
+ binplace $(OBJDIR)\spsvr16.map
+
+
+
+app.obj: app.cpp
+doc.obj: doc.cpp
+icf.obj: icf.cpp
+ido.obj: ido.cpp
+iec.obj: iec.cpp
+ioipao.obj: ioipao.cpp
+ioipo.obj: ioipo.cpp
+ioo.obj: ioo.cpp
+ips.obj: ips.cpp
+obj.obj: obj.cpp
+pre.obj: pre.cpp
+simpsvr.obj: simpsvr.cpp
+
+
+!ENDIF
diff --git a/private/oleutest/utests16/simpsvr/obj.cpp b/private/oleutest/utests16/simpsvr/obj.cpp
new file mode 100644
index 000000000..6125baee3
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/obj.cpp
@@ -0,0 +1,1057 @@
+//**********************************************************************
+// File name: obj.cpp
+//
+// Implementation file for the CSimpSvrApp Class
+//
+// Functions:
+//
+// See obj.h for a list of member functions.
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "ioo.h"
+#include "ido.h"
+#include "ips.h"
+#include "icf.h"
+#include "ioipao.h"
+#include "ioipo.h"
+#include "app.h"
+#include "doc.h"
+
+//**********************************************************************
+//
+// CSimpSvrObj::QueryInterface
+//
+// Purpose:
+//
+// Used for interface negotiation at the "Object" 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.
+// E_NOINTERFACE - The interface is not supported
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// ResultFromScode OLE API
+// IUnknown::AddRef OBJ.CPP, IOO.CPP, IDO.CPP, IPS.CPP
+// IOIPO.CPP, IOIPAO.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+STDMETHODIMP CSimpSvrObj::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj)
+{
+ TestDebugOut("In CSimpSvrObj::QueryInterface\r\n");
+
+ SCODE sc = S_OK;
+
+ if (riid == IID_IUnknown)
+ *ppvObj = this;
+ else if (riid == IID_IOleObject)
+ *ppvObj = &m_OleObject;
+ else if (riid == IID_IDataObject)
+ *ppvObj = &m_DataObject;
+ else if ( (riid == IID_IPersistStorage) || (riid == IID_IPersist) )
+ *ppvObj = &m_PersistStorage;
+ else if (riid == IID_IOleInPlaceObject)
+ *ppvObj = &m_OleInPlaceObject;
+ else if (riid == IID_IOleInPlaceActiveObject)
+ *ppvObj = &m_OleInPlaceActiveObject;
+ else if (riid == IID_IExternalConnection)
+ *ppvObj = &m_ExternalConnection;
+ else
+ {
+ *ppvObj = NULL;
+ sc = E_NOINTERFACE;
+ }
+
+ if (*ppvObj)
+ ((LPUNKNOWN)*ppvObj)->AddRef();
+
+ return ResultFromScode( sc );
+};
+
+//**********************************************************************
+//
+// CSimpSvrObj::AddRef
+//
+// Purpose:
+//
+// Adds to the reference count at the Object level.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the Object.
+//
+// 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
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpSvrObj::AddRef ()
+{
+ TestDebugOut("In CSimpSvrObj::AddRef\r\n");
+
+ m_lpDoc->AddRef();
+
+ return ++m_nCount;
+};
+
+//**********************************************************************
+//
+// CSimpSvrObj::Release
+//
+// Purpose:
+//
+// Decrements the reference count at this level
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// ULONG - The new reference count of the object.
+//
+// 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
+//
+//********************************************************************
+
+STDMETHODIMP_(ULONG) CSimpSvrObj::Release ()
+{
+ TestDebugOut("In CSimpSvrObj::Release\r\n");
+
+ m_lpDoc->Release();
+
+ if (--m_nCount == 0) {
+ delete this;
+ return 0;
+ }
+
+ return m_nCount;
+};
+
+//**********************************************************************
+//
+// CSimpSvrObj::CSimpSvrObj
+//
+// Purpose:
+//
+// Constructor for CSimpSvrObj
+//
+// Parameters:
+//
+// CSimpSvrDoc FAR * lpSimpSvrDoc - ptr to the doc object
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+//
+// Comments:
+//
+//
+//********************************************************************
+#pragma warning (disable : 4355) // "this" used in base initializer list warning. This
+ // can be disabled because we are not using "this" in
+ // the constructor for these objects, rather we are
+ // just storing it for future use...
+CSimpSvrObj::CSimpSvrObj(CSimpSvrDoc FAR * lpSimpSvrDoc) : m_OleObject(this),
+ m_DataObject(this),
+ m_PersistStorage(this),
+ m_OleInPlaceActiveObject(this),
+ m_OleInPlaceObject(this),
+ m_ExternalConnection(this)
+#pragma warning (default : 4355) // Turn the warning back on
+
+{
+ m_lpDoc = lpSimpSvrDoc;
+ m_nCount = 0;
+ m_fInPlaceActive = FALSE;
+ m_fInPlaceVisible = FALSE;
+ m_fUIActive = FALSE;
+ m_hmenuShared = NULL;
+ m_hOleMenu = NULL;
+
+ m_dwRegister = 0;
+
+ m_lpFrame = NULL;
+ m_lpCntrDoc = NULL;
+
+ m_lpStorage = NULL;
+ m_lpColorStm = NULL;
+ m_lpSizeStm = NULL;
+ m_lpOleClientSite = NULL;
+ m_lpOleAdviseHolder = NULL;
+ m_lpDataAdviseHolder = NULL;
+ m_lpIPSite = NULL;
+
+ m_red = 128;
+ m_green = 0;
+ m_blue = 0;
+
+ m_size.x = 100;
+ m_size.y = 100;
+
+ m_xOffset = 0;
+ m_yOffset = 0;
+
+ m_scale = 1;
+
+ m_fSaveWithSameAsLoad = FALSE;
+ m_fNoScribbleMode = FALSE;
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::~CSimpSvrObj
+//
+// Purpose:
+//
+// Destructor for CSimpSvrObj
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+//
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// PostMessage Windows API
+// CSimpSvrDoc::GetApp DOC.H
+// CSimpSvrDoc::GethAppWnd DOC.H
+// CSimpSvrDoc::ClearObj DOC.H
+// CSimpSvrApp::IsStartedByOle APP.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+CSimpSvrObj::~CSimpSvrObj()
+{
+ TestDebugOut("In CSimpSvrObj's Destructor \r\n");
+
+ // if we were started by ole, post ourselves a close message
+ if (m_lpDoc->GetApp()->IsStartedByOle())
+ PostMessage(m_lpDoc->GethAppWnd(), WM_SYSCOMMAND, SC_CLOSE, 0L);
+
+ // clear the OBJ ptr in the doc class
+ m_lpDoc->ClearObj();
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::Draw
+//
+// Purpose:
+//
+// Draws the object into an arbitrary DC
+//
+// Parameters:
+//
+// HDC hDC - DC to draw into
+//
+// Return Value:
+//
+// NONE
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CreateBrushIndirect Windows API
+// SelectObject Windows API
+// Rectangle Windows API
+// DeleteObject Windows API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrObj::Draw (HDC hDC, BOOL m_fMeta)
+{
+ LOGBRUSH lb;
+
+ TestDebugOut("In CSimpSvrObj::Draw\r\n");
+
+ char szBuffer[255];
+ wsprintf(szBuffer,"Drawing Scale %3d\r\n",m_scale);
+ TestDebugOut(szBuffer);
+
+ if (!m_fMeta)
+ {
+ SetMapMode(hDC, MM_ANISOTROPIC);
+ SetWindowOrg(hDC, (int)(m_xOffset/m_scale), (int)(m_yOffset/m_scale));
+ SetWindowExt(hDC, m_size.x, m_size.y);
+ SetViewportExt(hDC, (int)(m_size.x*m_scale), (int)(m_size.y*m_scale));
+ }
+
+ // fill out a LOGBRUSH
+ lb.lbStyle = BS_SOLID;
+ lb.lbColor = RGB(m_red, m_green, m_blue);
+ lb.lbHatch = 0;
+
+ // create the brush
+ HBRUSH hBrush = CreateBrushIndirect(&lb);
+
+ // select the brush
+ HBRUSH hOldBrush = SelectObject(hDC, hBrush);
+ HPEN hPen = CreatePen(PS_INSIDEFRAME, 6, RGB(0, 0, 0));
+
+ HPEN hOldPen = SelectObject(hDC, hPen);
+
+ // draw the rectangle
+ Rectangle (hDC, 0, 0, m_size.x, m_size.y);
+
+ // restore the pen
+ hPen = SelectObject(hDC, hOldPen);
+
+ // free the pen
+ DeleteObject(hPen);
+
+ // restore the old brush
+ hBrush = SelectObject(hDC, hOldBrush);
+
+ // free the brush
+ DeleteObject(hBrush);
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::GetMetaFilePict
+//
+// Purpose:
+//
+// Returns a handle to a metafile representation of the object.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// Handle to the metafile.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// GlobalAlloc Windows API
+// GlobalLock Windows API
+// SetWindowOrg Windows API
+// SetWindowExt Windows API
+// CreateMetaFile Windows API
+// CloseMetaFile Windows API
+// GlobalUnlock Windows API
+// XformWidthInPixelsToHimetric OLE2UI
+// XformHeightInPixelsToHimetric OLE2UI
+// CSimpSvrObj::Draw OBJ.CPP
+//
+// Comments:
+//
+//
+//********************************************************************
+
+HANDLE CSimpSvrObj::GetMetaFilePict()
+{
+ HANDLE hMFP;
+ METAFILEPICT FAR * lpMFP;
+ POINT pt;
+
+ TestDebugOut("In CSimpSvrObj::GetMetaFilePict\r\n");
+
+ // allocate the memory for the METAFILEPICT structure
+ hMFP = GlobalAlloc (GMEM_SHARE | GHND, sizeof (METAFILEPICT) );
+ lpMFP = (METAFILEPICT FAR*) GlobalLock(hMFP);
+
+ // get the size of the object in HIMETRIC
+ pt.x = XformWidthInPixelsToHimetric(NULL, m_size.x);
+ pt.y = XformHeightInPixelsToHimetric(NULL, m_size.y);
+
+ // fill out the METAFILEPICT structure
+ lpMFP->mm = MM_ANISOTROPIC;
+ lpMFP->xExt = pt.x;
+ lpMFP->yExt = pt.y;
+
+ // Create the metafile
+ HDC hDC = CreateMetaFile(NULL);
+
+ SetWindowOrg (hDC, 0, 0);
+ SetWindowExt (hDC, m_size.x,
+ m_size.y);
+
+ Draw(hDC);
+
+ lpMFP->hMF = CloseMetaFile(hDC);
+
+ // unlock the metafilepict
+ GlobalUnlock(hMFP);
+
+ return hMFP;
+}
+
+
+//**********************************************************************
+//
+// CSimpSvrObj::SaveToStorage
+//
+// Purpose:
+//
+// Saves the object to the passed storage
+//
+// Parameters:
+//
+// LPSTORAGE lpStg - Storage in which to save the object
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::CreateStream OLE
+// IStream::Write OLE
+// IStream::Release OLE
+//
+// Comments:
+//
+// A real app will want to do better error checking / returning
+//
+//********************************************************************
+
+void CSimpSvrObj::SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad)
+{
+ TestDebugOut("In CSimpSvrObj::SaveToStorage\r\n");
+
+ LPSTREAM lpTempColor, lpTempSize;
+
+ if (!fSameAsLoad)
+ m_PersistStorage.CreateStreams( lpStg, &lpTempColor, &lpTempSize);
+ else
+ {
+ lpTempColor = m_lpColorStm;
+ lpTempColor->AddRef();
+ lpTempSize = m_lpSizeStm;
+ lpTempSize->AddRef();
+ }
+
+ ULARGE_INTEGER uli;
+
+ uli.LowPart = 0;
+ uli.HighPart = 0;
+
+ lpTempColor->SetSize(uli);
+ lpTempSize->SetSize(uli);
+
+ LARGE_INTEGER li;
+
+ li.LowPart = 0;
+ li.HighPart = 0;
+
+ lpTempColor->Seek(li, STREAM_SEEK_SET, NULL);
+ lpTempSize->Seek(li, STREAM_SEEK_SET, NULL);
+
+ // write the colors to the stream
+ lpTempColor->Write(&m_red, sizeof(m_red), NULL);
+ lpTempColor->Write(&m_green, sizeof(m_green), NULL);
+ lpTempColor->Write(&m_blue, sizeof(m_blue), NULL);
+
+ // write the size to the stream
+ lpTempSize->Write(&m_size, sizeof(m_size), NULL);
+
+ lpTempColor->Release();
+ lpTempSize->Release();
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::LoadFromStorage
+//
+// Purpose:
+//
+// Loads the object from the passed storage
+//
+// Parameters:
+//
+// LPSTORAGE lpStg - Storage in which to load the object from
+//
+// Return Value:
+//
+// None.
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IStorage::OpenStream OLE
+// IStream::Read OLE
+// IStream::Release OLE
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrObj::LoadFromStorage ()
+{
+ TestDebugOut("In CSimpSvrObj::LoadFromStorage\r\n");
+
+ // Read the colors
+ m_lpColorStm->Read(&m_red, sizeof(m_red), NULL);
+ m_lpColorStm->Read(&m_green, sizeof(m_green), NULL);
+ m_lpColorStm->Read(&m_blue, sizeof(m_blue), NULL);
+
+ // read the size
+ m_lpSizeStm->Read(&m_size, sizeof(m_size), NULL);
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::DoInPlaceActivate
+//
+// Purpose:
+//
+// Does the inplace activation for the object
+//
+// Parameters:
+//
+// LONG lVerb - Verb that caused this function to be called
+//
+// Return Value:
+//
+// TRUE/FALSE depending on success or failure.
+//
+// Function Calls:
+// Function Location
+//
+// IOleClientSite::QueryInterface Container
+// IOleClientSite::ShowObject Container
+// IOleInPlaceSite::CanInPlaceActivate Container
+// IOleInPlaceSite::Release Container
+// IOleInPlaceSite::OnInPlaceActivate Container
+// IOleInPlaceSite::GetWindow Container
+// IOleInPlaceSite::GetWindowContext Container
+// IOleInPlaceSite::OnUIActivate Container
+// IOleInPlaceSite::Release Container
+// IOleInPlaceFrame::SetActiveObject Container
+// IOleInPlaceUIWindow::SetActiveObject Container
+// TestDebugOut Windows API
+// ShowWindow Windows API
+// SetParent Windows API
+// IntersectRect Windows API
+// OffsetRect Windows API
+// MoveWindow Windows API
+// CopyRect Windows API
+// SetFocus Windows API
+// SetHatchWindowSize OLE2UI
+// CSimpSvrObj::AssembleMenus OBJ.CPP
+// CSimpSvrObj::AddFrameLevelUI OBJ.CPP
+//
+//
+// Comments:
+//
+// Be sure to read TECHNOTES.WRI included with the OLE SDK
+// for details on implementing inplace activation.
+//
+//********************************************************************
+
+BOOL CSimpSvrObj::DoInPlaceActivate (LONG lVerb)
+{
+ BOOL retval = FALSE;
+ RECT posRect, clipRect;
+
+
+ TestDebugOut("In CSimpSvrObj::DoInPlaceActivate\r\n");
+
+ // if not currently in place active
+ if (!m_fInPlaceActive)
+ {
+ // get the inplace site
+ if (m_lpOleClientSite->QueryInterface(IID_IOleInPlaceSite,
+ (LPVOID FAR *)&m_lpIPSite) != NOERROR)
+ goto error;
+
+
+ // if the inplace site could not be obtained, or refuses to inplace
+ // activate then goto error.
+ if (m_lpIPSite == NULL || m_lpIPSite->CanInPlaceActivate() != NOERROR)
+ {
+ if (m_lpIPSite)
+ m_lpIPSite->Release();
+ m_lpIPSite = NULL;
+ goto error;
+ }
+
+ // tell the site that we are activating.
+ m_lpIPSite->OnInPlaceActivate();
+ m_fInPlaceActive = TRUE;
+ }
+
+ // if not currently inplace visibl
+ if (!m_fInPlaceVisible)
+ {
+ m_fInPlaceVisible = TRUE;
+
+ // get the window handle of the site
+ m_lpIPSite->GetWindow(&m_hWndParent);
+
+ // get window context from the container
+ m_lpIPSite->GetWindowContext ( &m_lpFrame,
+ &m_lpCntrDoc,
+ &posRect,
+ &clipRect,
+ &m_FrameInfo);
+
+ // show the hatch window
+ m_lpDoc->ShowHatchWnd();
+
+ // Set the parenting
+ SetParent (m_lpDoc->GethHatchWnd(), m_hWndParent);
+ SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethHatchWnd());
+
+ // tell the client site to show the object
+ m_lpOleClientSite->ShowObject();
+
+ RECT resRect;
+
+ // figure out the "real" size of the object
+ IntersectRect(&resRect, &posRect, &clipRect);
+ CopyRect(&m_posRect, &posRect);
+
+ POINT pt;
+
+ // adjust our hatch window size
+ SetHatchWindowSize ( m_lpDoc->GethHatchWnd(),
+ &resRect,
+ &posRect,
+ &pt);
+
+ // calculate the actual object rect inside the hatchwnd.
+ OffsetRect (&resRect, pt.x, pt.y);
+
+ // move the object window
+ MoveWindow(m_lpDoc->GethDocWnd(),
+ resRect.left,
+ resRect.top,
+ resRect.right - resRect.left,
+ resRect.bottom - resRect.top,
+ FALSE);
+
+ // create the combined window
+ AssembleMenus();
+ }
+
+ // if not UIActive
+ if (!m_fUIActive)
+ {
+ m_fUIActive = TRUE;
+
+ // tell the inplace site that we are activating
+ m_lpIPSite->OnUIActivate();
+
+ // set the focus to our object window
+ SetFocus(m_lpDoc->GethDocWnd());
+
+ // set the active object on the frame
+ m_lpFrame->SetActiveObject(&m_OleInPlaceActiveObject, "Simple OLE 2.0 Server");
+
+ // set the active object on the Doc, if available.
+ if (m_lpCntrDoc)
+ m_lpCntrDoc->SetActiveObject(&m_OleInPlaceActiveObject, "Simple OLE 2.0 Server");
+
+ // add the frame level UI.
+ AddFrameLevelUI();
+ }
+
+ retval = TRUE;
+error:
+ return retval;
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::AssembleMenus
+//
+// Purpose:
+//
+// Creates the combined menus used during inplace activation.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// CreateMenu Windows API
+// IOleInPlaceFrame::InsertMenus Container
+// InsertMenu Windows API
+// DestroyMenu Windows API
+// OleCreateMenuDescriptor OLE API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrObj::AssembleMenus()
+{
+ TestDebugOut("In CSimpSvrObj::AssembleMenus\r\n");
+ OLEMENUGROUPWIDTHS menugroupwidths;
+
+ m_hmenuShared = NULL;
+
+ // Create the menu resource
+ m_hmenuShared = CreateMenu();
+
+ // have the contaner insert its menus
+ if (m_lpFrame->InsertMenus (m_hmenuShared, &menugroupwidths) == NOERROR)
+ {
+ int nFirstGroup = (int) menugroupwidths.width[0];
+
+ // insert the server menus
+ InsertMenu( m_hmenuShared, nFirstGroup, MF_BYPOSITION | MF_POPUP, m_lpDoc->GetApp()->GetColorMenu(), "&Color");
+ menugroupwidths.width[1] = 1;
+ menugroupwidths.width[3] = 0;
+ menugroupwidths.width[5] = 0;
+ }
+ else
+ {
+ // Destroy the menu resource
+ DestroyMenu(m_hmenuShared);
+ m_hmenuShared = NULL;
+ }
+
+ // tell OLE to create the menu descriptor
+ m_hOleMenu = OleCreateMenuDescriptor(m_hmenuShared, &menugroupwidths);
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::AddFrameLevelUI
+//
+// Purpose:
+//
+// Adds the Frame level user interface
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// IOleInPlaceFrame::SetMenu Container
+// IOleInPlaceFrame::SetBorderSpace Container
+// IOleInPlaceUIWindow::SetBorderSpace Container
+// CSimpSvrDoc::GethDocWnd DOC.H
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrObj::AddFrameLevelUI()
+{
+ TestDebugOut("In CSimpSvrObj::AddFrameLevelUI\r\n");
+
+ // add the combined menu
+ m_lpFrame->SetMenu(m_hmenuShared, m_hOleMenu, m_lpDoc->GethDocWnd());
+
+ // do hatched border
+ SetParent (m_lpDoc->GethHatchWnd(), m_hWndParent);
+ SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethHatchWnd());
+
+ // set the border space. Normally we would negotiate for toolbar
+ // space at this point. Since this server doesn't have a toolbar,
+ // this isn't needed...
+ if (m_lpFrame)
+ m_lpFrame->SetBorderSpace(NULL);
+
+ if (m_lpCntrDoc)
+ m_lpCntrDoc->SetBorderSpace(NULL);
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::DoInPlaceHide
+//
+// Purpose:
+//
+// Hides the object while inplace actvie
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// SetParent Windows API
+// CSimpSvrDoc::GethDocWnd DOC.H
+// CSimpSvrDoc::GethAppWnd DOC.H
+// CSimpSvrDoc::GethHatchWnd DOC.H
+// CSimpSvrObj::DisassembleMenus OBJ.CPP
+// IOleInPlaceFrame::Release Container
+// IOleInPlaceUIWindow::Release Container
+//
+//
+// Comments:
+//
+// Be sure to read TECHNOTES.WRI included with the OLE SDK
+// for details on implementing inplace activation.
+//
+//********************************************************************
+
+void CSimpSvrObj::DoInPlaceHide()
+{
+ TestDebugOut("In CSimpSvrObj::DoInPlaceHide\r\n");
+
+ // if we aren't inplace visible, then this routine is a NOP,
+ if (!m_fInPlaceVisible)
+ return;
+
+ m_fInPlaceVisible = FALSE;
+
+ // change the parenting
+ SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethAppWnd());
+ SetParent (m_lpDoc->GethHatchWnd(),m_lpDoc->GethDocWnd());
+
+ // rip down the combined menus
+ DisassembleMenus();
+
+ // release the inplace frame
+ m_lpFrame->Release();
+
+ m_lpFrame = NULL; // only holding one ref. to frame.
+
+ // release the UIWindow if it is there.
+ if (m_lpCntrDoc)
+ m_lpCntrDoc->Release();
+
+ m_lpCntrDoc = NULL;
+
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::DisassembleMenus
+//
+// Purpose:
+//
+// Disassembles the combined menus used in inplace activation
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// TestDebugOut Windows API
+// OleDestroyMenuDescriptor OLE API
+// RemoveMenu Windows API
+// IOleInPlaceFrame::RemoveMenus Container
+// DestroyMenu Windows API
+//
+// Comments:
+//
+// Be sure to read TECHNOTES.WRI included with the OLE SDK
+// for details on implementing inplace activation.
+//
+//********************************************************************
+
+void CSimpSvrObj::DisassembleMenus()
+{
+ // destroy the menu descriptor
+ OleDestroyMenuDescriptor(m_hOleMenu);
+
+ if (m_hmenuShared)
+ {
+ // remove the menus that we added
+ RemoveMenu( m_hmenuShared, 1, MF_BYPOSITION);
+
+ // have the container remove its menus
+ m_lpFrame->RemoveMenus(m_hmenuShared);
+
+ // Destroy the menu resource
+ DestroyMenu(m_hmenuShared);
+
+ m_hmenuShared = NULL;
+ }
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::SendOnDataChange
+//
+// Purpose:
+//
+// Uses the data advise holder to send a data change, then updates
+// the ROT to note the time of change.
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// IDataAdviseHolder::SendOnDataChange OLE API
+// GetRunningObjectTable OLE API
+// CoFileTimeNow OLE API
+// IRunningObjectTable::NoteChangeTime OLE API
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrObj::SendOnDataChange()
+{
+ if (m_lpDataAdviseHolder)
+ m_lpDataAdviseHolder->SendOnDataChange( (LPDATAOBJECT)&m_DataObject, 0, 0);
+
+ LPRUNNINGOBJECTTABLE lpRot;
+
+ GetRunningObjectTable(0, &lpRot);
+
+ if ( lpRot && m_dwRegister)
+ {
+ FILETIME ft;
+ CoFileTimeNow(&ft);
+
+ lpRot->NoteChangeTime(m_dwRegister, &ft);
+ lpRot->Release();
+ }
+}
+
+//**********************************************************************
+//
+// CSimpSvrObj::DeactivateUI
+//
+// Purpose:
+//
+// Breaks down the inplace ui
+//
+// Parameters:
+//
+// None
+//
+// Return Value:
+//
+// None
+//
+// Function Calls:
+// Function Location
+//
+// SetParent Windows API
+// IOleInPlaceUIWindow::SetActiveObject Container
+// IOleInPlaceFrame::SetActiveObject Container
+// IOleInPlaceSite::UIDeactivate Container
+//
+// Comments:
+//
+//
+//********************************************************************
+
+void CSimpSvrObj::DeactivateUI()
+{
+ // if not UI active, or no pointer to IOleInPlaceFrame, then
+ // return NOERROR
+ if (!(m_fUIActive || m_lpFrame))
+ return;
+ else
+ {
+ m_fUIActive = FALSE;
+
+ // remove hatching
+ SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethAppWnd());
+ SetParent (m_lpDoc->GethHatchWnd(),m_lpDoc->GethDocWnd());
+
+ // if in an MDI container, call SetActiveObject on the DOC.
+ if (m_lpCntrDoc)
+ m_lpCntrDoc->SetActiveObject(NULL, NULL);
+
+ m_lpFrame->SetActiveObject(NULL, NULL);
+
+ // tell the container that our UI is going away.
+ if (m_lpIPSite)
+ m_lpIPSite->OnUIDeactivate(FALSE);
+ }
+}
diff --git a/private/oleutest/utests16/simpsvr/obj.h b/private/oleutest/utests16/simpsvr/obj.h
new file mode 100644
index 000000000..c8b4019ea
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/obj.h
@@ -0,0 +1,141 @@
+//**********************************************************************
+// File name: obj.h
+//
+// Definition of CSimpSvrObj
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#if !defined( _OBJ_H_)
+#define _OBJ_H_
+
+#include "ioipao.h"
+#include "ioipo.h"
+#include "ioo.h"
+#include "ips.h"
+#include "ido.h"
+#include "iec.h"
+
+class CSimpSvrDoc;
+interface COleObject;
+interface CPersistStorage;
+interface CDataObject;
+interface COleInPlaceActiveObject;
+interface COleInPlaceObject;
+interface CExternalConnection;
+
+class CSimpSvrObj : public IUnknown
+{
+private:
+ CSimpSvrDoc FAR * m_lpDoc; // Back pointer
+ int m_nCount; // reference count
+ BOOL m_fInPlaceActive; // Used during InPlace Negotiation
+ BOOL m_fInPlaceVisible; // " " " " " " " " "
+ BOOL m_fUIActive; // " " " " " " " " "
+ HMENU m_hmenuShared; // " " " " " " " " "
+ HOLEMENU m_hOleMenu; // " " " " " " " " "
+ RECT m_posRect; // " " " " " " " " "
+ OLEINPLACEFRAMEINFO m_FrameInfo;
+ BOOL m_fSaveWithSameAsLoad;
+ BOOL m_fNoScribbleMode;
+
+ DWORD m_dwRegister; // Registered in ROT
+
+ int m_red, m_green, m_blue; // current color
+ POINT m_size; // current size
+ int m_xOffset;
+ int m_yOffset;
+ float m_scale;
+
+ HWND m_hWndParent; // parent window handle
+
+ // interfaces used
+ LPSTORAGE m_lpStorage;
+ LPSTREAM m_lpColorStm, m_lpSizeStm;
+ LPOLECLIENTSITE m_lpOleClientSite; // IOleClientSite
+ LPOLEADVISEHOLDER m_lpOleAdviseHolder; // IOleAdviseHolder
+ LPDATAADVISEHOLDER m_lpDataAdviseHolder; // IDataAdviseHolder
+ LPOLEINPLACEFRAME m_lpFrame; // IOleInPlaceFrame
+ LPOLEINPLACEUIWINDOW m_lpCntrDoc; // IOleInPlaceUIWindow
+ LPOLEINPLACESITE m_lpIPSite; // IOleInPlaceSite
+
+ // interface implemented
+ COleObject m_OleObject; // IOleObject
+ CPersistStorage m_PersistStorage; // IPersistStorage
+ CDataObject m_DataObject; // IDataObject
+ COleInPlaceActiveObject m_OleInPlaceActiveObject; // IOleInPlaceActiveObject
+ COleInPlaceObject m_OleInPlaceObject; // IOleInPlaceObject
+ CExternalConnection m_ExternalConnection;
+
+public:
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
+ STDMETHODIMP_(ULONG) AddRef ();
+ STDMETHODIMP_(ULONG) Release ();
+
+// construction/destruction
+ CSimpSvrObj(CSimpSvrDoc FAR * lpSimpSvrDoc);
+ ~CSimpSvrObj();
+
+// utility functions
+ void Draw(HDC hDC, BOOL fMetaDC = TRUE);
+ void PaintObj(HDC hDC);
+ void lButtonDown(WPARAM wParam,LPARAM lParam);
+ HANDLE GetMetaFilePict();
+ void SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad);
+ void LoadFromStorage ();
+
+// visual editing helper functions
+ BOOL DoInPlaceActivate (LONG lVerb);
+ void AssembleMenus();
+ void AddFrameLevelUI();
+ void DoInPlaceHide();
+ void DisassembleMenus();
+ void SendOnDataChange();
+ void DeactivateUI();
+
+// member variable access
+ inline BOOL IsInPlaceActive() { return m_fInPlaceActive; };
+ inline BOOL IsInPlaceVisible() { return m_fInPlaceVisible; };
+ inline BOOL IsUIActive() { return m_fUIActive; };
+ inline HWND GetParent() { return m_hWndParent; };
+ inline LPSTORAGE GetStorage() { return m_lpStorage; };
+ inline LPOLECLIENTSITE GetOleClientSite() { return m_lpOleClientSite; };
+ inline LPDATAADVISEHOLDER GetDataAdviseHolder() { return m_lpDataAdviseHolder; };
+ inline LPOLEADVISEHOLDER GetOleAdviseHolder() { return m_lpOleAdviseHolder; };
+ inline LPOLEINPLACEFRAME GetInPlaceFrame() { return m_lpFrame; };
+ inline LPOLEINPLACEUIWINDOW GetUIWindow() { return m_lpCntrDoc; };
+ inline LPOLEINPLACESITE GetInPlaceSite() { return m_lpIPSite; };
+ inline COleObject FAR * GetOleObject() { return &m_OleObject; };
+ inline CPersistStorage FAR * GetPersistStorage() { return &m_PersistStorage; };
+ inline CDataObject FAR * GetDataObject() { return &m_DataObject; };
+ inline COleInPlaceActiveObject FAR * GetOleInPlaceActiveObject() { return &m_OleInPlaceActiveObject; };
+ inline COleInPlaceObject FAR * GetOleInPlaceObject() { return &m_OleInPlaceObject; };
+ inline void ClearOleClientSite() { m_lpOleClientSite = NULL; };
+ inline void ClearDataAdviseHolder() { m_lpDataAdviseHolder = NULL; };
+ inline void ClearOleAdviseHolder() { m_lpOleAdviseHolder = NULL; };
+ inline LPRECT GetPosRect() { return &m_posRect; };
+ inline LPPOINT GetSize() { return &m_size; };
+ inline LPOLEINPLACEFRAMEINFO GetFrameInfo() {return &m_FrameInfo;};
+ inline DWORD GetRotRegister() { return m_dwRegister; };
+
+
+
+ // member manipulation
+ inline void SetColor (int nRed, int nGreen, int nBlue)
+ { m_red = nRed; m_green = nGreen; m_blue = nBlue; };
+
+ inline void RotateColor()
+ { m_red+=10; m_green+=10; m_blue+=10;};
+
+
+// all of the interface implementations should be friends of this
+// class
+friend interface COleObject;
+friend interface CPersistStorage;
+friend interface CDataObject;
+friend interface COleInPlaceActiveObject;
+friend interface COleInPlaceObject;
+friend interface CExternalConnection;
+
+};
+#endif
diff --git a/private/oleutest/utests16/simpsvr/pre.cpp b/private/oleutest/utests16/simpsvr/pre.cpp
new file mode 100644
index 000000000..9603f4089
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/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/utests16/simpsvr/pre.h b/private/oleutest/utests16/simpsvr/pre.h
new file mode 100644
index 000000000..f52d44910
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/pre.h
@@ -0,0 +1,22 @@
+//**********************************************************************
+// 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 "simpsvr.h"
+#include "resource.h"
+#include <ole2ver.h>
+extern "C" void TestDebugOut(LPSTR psz);
+
+#endif
diff --git a/private/oleutest/utests16/simpsvr/readme.txt b/private/oleutest/utests16/simpsvr/readme.txt
new file mode 100644
index 000000000..10fdbd35f
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/readme.txt
@@ -0,0 +1,7 @@
+Simpsvr
+--------
+This sample is the simplest OLE 2.0 object that can be written and
+still support the visual editing feature. The object that this server
+supports is a colored square with a black border.
+
+See the MAKEFILE for compilation instructions.
diff --git a/private/oleutest/utests16/simpsvr/resource.h b/private/oleutest/utests16/simpsvr/resource.h
new file mode 100644
index 000000000..be152d1ac
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/resource.h
@@ -0,0 +1,32 @@
+//{{NO_DEPENDENCIES}}
+// App Studio generated include file.
+// Used by SIMPSVR.RC
+//
+#define IDM_OPEN 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_RED 113
+#define IDM_GREEN 114
+#define IDM_BLUE 115
+#define IDM_ROTATE 116
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_COMMAND_VALUE 117
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/private/oleutest/utests16/simpsvr/simpsvr.cpp b/private/oleutest/utests16/simpsvr/simpsvr.cpp
new file mode 100644
index 000000000..54066982b
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/simpsvr.cpp
@@ -0,0 +1,357 @@
+//**********************************************************************
+// File name: simpsvr.cpp
+//
+// Main source file for the simple OLE 2.0 server
+//
+// 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) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+
+#include "pre.h"
+#include "obj.h"
+#include "app.h"
+#include "doc.h"
+#include "icf.h"
+
+// This line is needed for the debug utilities in OLE2UI
+extern "C" {
+ OLEDBGDATA_MAIN("SIMPSVR")
+}
+
+CSimpSvrApp FAR * lpCSimpSvrApp;
+CClassFactory FAR * lpClassFactory;
+BOOL fBeVerbose = FALSE;
+extern "C"
+void TestDebugOut(LPSTR psz)
+{
+ if (fBeVerbose)
+ {
+ OutputDebugString(psz);
+ }
+}
+
+//**********************************************************************
+//
+// 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
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrApp::CSimpSvrApp APP.CPP
+// CSimpSvrApp::fInitApplication APP.CPP
+// CSimpSvrApp::fInitInstance APP.CPP
+// CSimpSvrApp::HandleAccelerators APP.CPP
+// CSimpSvrApp::~CSimpSvrApp APP.CPP
+// OleUIInitialize OLE2UI
+// OleUIUninitialize OLE2UI
+// GetMessage Windows API
+// TranslateMessage Windows API
+// DispatchMessage Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
+
+{
+ MSG msg;
+ fBeVerbose = GetProfileInt("OLEUTEST","BeVerbose",0);
+
+ if(fBeVerbose == 0)
+ {
+ fBeVerbose = GetProfileInt("OLEUTEST","spsvr16",0);
+ }
+
+ // recommended size for OLE apps
+ SetMessageQueue(96);
+
+ lpCSimpSvrApp = new CSimpSvrApp;
+
+ lpCSimpSvrApp->AddRef(); // need the app ref. count at 1 to hold the
+ // app alive.
+
+ lpCSimpSvrApp->ParseCmdLine(lpCmdLine);
+
+ // app initialization
+ if (!hPrevInstance)
+ if (!lpCSimpSvrApp->fInitApplication(hInstance))
+ return (FALSE);
+
+ // instance initialization
+ if (!lpCSimpSvrApp->fInitInstance(hInstance, nCmdShow, lpClassFactory))
+ return (FALSE);
+
+ /* 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))
+ {
+ OleDbgOut("Could not initialize OLEUI library\n");
+ return FALSE;
+ }
+
+ // message loop
+ while (GetMessage(&msg, NULL, NULL, NULL))
+ {
+ if (lpCSimpSvrApp->IsInPlaceActive())
+
+ // Only key messages need to be sent to OleTranslateAccelerator. Any other message
+ // would result in an extra FAR call to occur for that message processing...
+
+ if ( (msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST) )
+
+ // OleTranslateAccelerator MUST be called, even though this application does
+ // not have an accelerator table. This has to be done in order for the
+ // mneumonics for the top level menu items to work properly.
+
+ if ( OleTranslateAccelerator ( lpCSimpSvrApp->GetDoc()->GetObj()->GetInPlaceFrame(),
+ lpCSimpSvrApp->GetDoc()->GetObj()->GetFrameInfo(),
+ &msg) == NOERROR)
+ continue;
+
+ TranslateMessage(&msg); /* Translates virtual key codes */
+ DispatchMessage(&msg); /* Dispatches message to window */
+ }
+
+ // 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();
+
+ 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
+//
+// CSimpSvrApp::lCommandHandler APP.CPP
+// CSimpSvrApp::DestroyDocs APP.CPP
+// CSimpSvrApp::lCreateDoc APP.CPP
+// CSimpSvrApp::lSizeHandler APP.CPP
+// CGameDoc::lAddVerbs DOC.CPP
+// PostQuitMessage Windows API
+// DefWindowProc Windows API
+//
+// Comments:
+//
+//********************************************************************
+
+long FAR PASCAL _export MainWndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
+
+{
+
+ switch (message)
+ {
+ case WM_CLOSE:
+ TestDebugOut("*** In WM_CLOSE *** \r\n");
+
+ // if there is still a document
+ if (lpCSimpSvrApp->GetDoc())
+
+ // if there is still an object within a document
+ if (lpCSimpSvrApp->GetDoc()->GetObj()) // this case occurs if there is still
+ // an outstanding Ref count on the object
+ // when the app is trying to go away.
+ // typically this case will occur in
+ // the "open" editing mode.
+ // Close the document
+ lpCSimpSvrApp->GetDoc()->Close();
+
+ // hide the app window
+ lpCSimpSvrApp->HideAppWnd();
+
+ // if we were started by ole, unregister the class factory, otherwise
+ // remove the ref count on our dummy OLE object
+ if (lpCSimpSvrApp->IsStartedByOle())
+ CoRevokeClassObject(lpCSimpSvrApp->GetRegisterClass());
+ else
+ lpCSimpSvrApp->GetOleObject()->Release();
+
+ lpCSimpSvrApp->Release(); // This should close the app.
+
+ break;
+
+ case WM_COMMAND: // message: command from application menu
+ return lpCSimpSvrApp->lCommandHandler(hWnd, message, wParam, lParam);
+ break;
+
+ case WM_CREATE:
+ return lpCSimpSvrApp->lCreateDoc(hWnd, message, wParam, lParam);
+ break;
+
+ case WM_DESTROY: // message: window being destroyed
+ PostQuitMessage(0);
+ break;
+
+ case WM_SIZE:
+ return lpCSimpSvrApp->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
+//
+// Comments:
+//
+//********************************************************************
+
+BOOL FAR PASCAL _export About(HWND hDlg,unsigned message,WORD wParam,LONG 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:
+//
+// Function Calls:
+// Function Location
+//
+// CSimpSvrApp::PaintApp APP.CPP
+// BeginPaint Windows API
+// EndPaint Windows API
+// DefWindowProc Windows API
+// IOleObject::QueryInterface Object
+// IOleInPlaceObject::UIDeactivate Object
+// IOleObject::DoVerb Object
+// IOleInPlaceObject::Release Object
+//
+// Comments:
+//
+//********************************************************************
+
+long FAR PASCAL _export DocWndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
+{
+ HDC hDC;
+ PAINTSTRUCT ps;
+
+ switch (message) {
+ case WM_COMMAND: // message: command from application menu
+ return lpCSimpSvrApp->lCommandHandler(hWnd, message, wParam, lParam);
+ break;
+
+ case WM_PAINT:
+ hDC = BeginPaint(hWnd, &ps);
+
+ // tell the app class to paint itself
+ if (lpCSimpSvrApp)
+ lpCSimpSvrApp->PaintApp (hDC);
+
+ EndPaint(hWnd, &ps);
+ break;
+
+ case WM_MENUSELECT:
+ lpCSimpSvrApp->SetStatusText();
+ break;
+
+ default: /* Passes it on if unproccessed */
+ return (DefWindowProc(hWnd, message, wParam, lParam));
+ }
+ return (NULL);
+}
diff --git a/private/oleutest/utests16/simpsvr/simpsvr.h b/private/oleutest/utests16/simpsvr/simpsvr.h
new file mode 100644
index 000000000..840ef8860
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/simpsvr.h
@@ -0,0 +1,16 @@
+//**********************************************************************
+// File name: simpsvr.h
+//
+// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
+//**********************************************************************
+#define IDM_ABOUT 100
+#define IDM_INSERT 101
+#define IDM_VERB0 1000
+
+
+int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,LPSTR lpCmdLine,int nCmdShow);
+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);
+BOOL FAR PASCAL _export About(HWND hDlg, unsigned message, WORD wParam, LONG lParam);
diff --git a/private/oleutest/utests16/simpsvr/simpsvr.ico b/private/oleutest/utests16/simpsvr/simpsvr.ico
new file mode 100644
index 000000000..f351bc754
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/simpsvr.ico
Binary files differ
diff --git a/private/oleutest/utests16/simpsvr/simpsvr.reg b/private/oleutest/utests16/simpsvr/simpsvr.reg
new file mode 100644
index 000000000..78768f1ee
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/simpsvr.reg
@@ -0,0 +1,21 @@
+REGEDIT
+HKEY_CLASSES_ROOT\SIMPSVR = Simple OLE 2.0 Server
+HKEY_CLASSES_ROOT\SIMPSVR\protocol\StdFileEditing\server = simpsvr.exe
+HKEY_CLASSES_ROOT\SIMPSVR\protocol\StdFileEditing\verb\0 = &Edit
+HKEY_CLASSES_ROOT\SIMPSVR\protocol\StdFileEditing\verb\1 = &Open
+HKEY_CLASSES_ROOT\SIMPSVR\Insertable
+HKEY_CLASSES_ROOT\SIMPSVR\CLSID = {BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509} = Simple OLE 2.0 Server
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\Insertable
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\MiscStatus = 0
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\DefaultIcon = simpsvr.exe,0
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\AuxUserType\2 = Simple Server
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\AuxUserType\3 = Simple OLE 2.0 Server
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\Verb\0 = &Play,0,2
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\Verb\1 = &Open,0,2
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\LocalServer = simpsvr.exe
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\InprocHandler = ole2.dll
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\ProgID = SIMPSVR
+HKEY_CLASSES_ROOT\CLSID\{BCF6D4A0-BE8C-1068-B6D4-00DD010C0509}\DataFormats\GetSet\0 = 3,1,32,1
+HKEY_CLASSES_ROOT\.svr = SIMPSVR
+
diff --git a/private/oleutest/utests16/simpsvr/spsvr16.def b/private/oleutest/utests16/simpsvr/spsvr16.def
new file mode 100644
index 000000000..cfff029d6
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/spsvr16.def
@@ -0,0 +1,22 @@
+; module-definition file for generic -- used by LINK.EXE
+
+NAME SPSVR16 ; application's module name
+
+DESCRIPTION 'Sample Microsoft Windows Application'
+
+EXETYPE WINDOWS ; required for all Windows applications
+
+STUB 'WINSTUB.EXE' ; Generates error message if application
+ ; is run without Windows
+
+;CODE can be moved in memory and discarded/reloaded
+CODE PRELOAD MOVEABLE DISCARDABLE
+
+;DATA must be MULTIPLE if program can be invoked more than once
+DATA PRELOAD MOVEABLE MULTIPLE
+
+
+HEAPSIZE 1024
+
+; All functions that will be called by any Windows routine
+; MUST be exported.
diff --git a/private/oleutest/utests16/simpsvr/spsvr16.rc b/private/oleutest/utests16/simpsvr/spsvr16.rc
new file mode 100644
index 000000000..190867d41
--- /dev/null
+++ b/private/oleutest/utests16/simpsvr/spsvr16.rc
@@ -0,0 +1,107 @@
+//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 "simpsvr.h"
+
+/////////////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+SIMPSVR ICON DISCARDABLE "SIMPSVR.ICO"
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+SIMPSVRMENU MENU DISCARDABLE
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "E&xit", IDM_EXIT
+ END
+ POPUP "&Color"
+ BEGIN
+ MENUITEM "&Red", IDM_RED
+ MENUITEM "&Green", IDM_GREEN
+ MENUITEM "&Blue", IDM_BLUE
+ MENUITEM SEPARATOR
+ MENUITEM "&Rotate", IDM_ROTATE
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&About Simpsvr...", IDM_ABOUT
+ END
+END
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+ABOUTBOX DIALOG DISCARDABLE 22, 17, 144, 75
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Simple OLE 2.0 Server"
+FONT 8, "System"
+BEGIN
+ CTEXT "Microsoft Windows",-1,0,5,144,8
+ CTEXT "Simple OLE 2.0 Server",-1,0,14,144,8
+ CTEXT "Version 1.0",-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 ""simpsvr.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""..\\ole2ui\\ole2ui.rc""\r\n"
+ "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef APSTUDIO_INVOKED
+////////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#include "..\ole2ui\ole2ui.rc"
+
+/////////////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+