diff --git a/Makefile.in b/Makefile.in
index 9c7dba311e..23920bc53b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2210,6 +2210,7 @@ COND_PLATFORM_WIN32_1_GTK_PLATFORM_HDR = \
wx/generic/caret.h \
wx/generic/imaglist.h \
wx/msw/ole/automtn.h \
+ wx/msw/ole/comimpl.h \
wx/msw/ole/oleutils.h \
wx/msw/ole/safearray.h \
wx/msw/ole/uuid.h \
@@ -3132,6 +3133,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \
wx/msw/msvcrt.h \
wx/msw/notebook.h \
wx/msw/ole/access.h \
+ wx/msw/ole/comimpl.h \
wx/msw/ole/dataform.h \
wx/msw/ole/dataobj.h \
wx/msw/ole/dataobj2.h \
@@ -4943,6 +4945,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \
monodll_msw_imaglist.o \
monodll_msw_minifram.o \
monodll_msw_nonownedwnd.o \
+ monodll_comimpl.o \
monodll_ole_dataobj.o \
monodll_dropsrc.o \
monodll_droptgt.o \
@@ -5649,6 +5652,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \
monodll_msw_imaglist.o \
monodll_msw_minifram.o \
monodll_msw_nonownedwnd.o \
+ monodll_comimpl.o \
monodll_ole_dataobj.o \
monodll_dropsrc.o \
monodll_droptgt.o \
@@ -6966,6 +6970,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \
monolib_msw_imaglist.o \
monolib_msw_minifram.o \
monolib_msw_nonownedwnd.o \
+ monolib_comimpl.o \
monolib_ole_dataobj.o \
monolib_dropsrc.o \
monolib_droptgt.o \
@@ -7672,6 +7677,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \
monolib_msw_imaglist.o \
monolib_msw_minifram.o \
monolib_msw_nonownedwnd.o \
+ monolib_comimpl.o \
monolib_ole_dataobj.o \
monolib_dropsrc.o \
monolib_droptgt.o \
@@ -9133,6 +9139,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \
coredll_msw_imaglist.o \
coredll_msw_minifram.o \
coredll_msw_nonownedwnd.o \
+ coredll_comimpl.o \
coredll_ole_dataobj.o \
coredll_dropsrc.o \
coredll_droptgt.o \
@@ -9839,6 +9846,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \
coredll_msw_imaglist.o \
coredll_msw_minifram.o \
coredll_msw_nonownedwnd.o \
+ coredll_comimpl.o \
coredll_ole_dataobj.o \
coredll_dropsrc.o \
coredll_droptgt.o \
@@ -10606,6 +10614,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \
corelib_msw_imaglist.o \
corelib_msw_minifram.o \
corelib_msw_nonownedwnd.o \
+ corelib_comimpl.o \
corelib_ole_dataobj.o \
corelib_dropsrc.o \
corelib_droptgt.o \
@@ -11312,6 +11321,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \
corelib_msw_imaglist.o \
corelib_msw_minifram.o \
corelib_msw_nonownedwnd.o \
+ corelib_comimpl.o \
corelib_ole_dataobj.o \
corelib_dropsrc.o \
corelib_droptgt.o \
@@ -13355,6 +13365,7 @@ COND_PLATFORM_WIN32_1___GTK_PLATFORM_SRC_OBJECTS = \
monodll_generic_caret.o \
monodll_generic_imaglist.o \
monodll_automtn.o \
+ monodll_comimpl.o \
monodll_oleutils.o \
monodll_safearray.o \
monodll_uuid.o \
@@ -13499,6 +13510,7 @@ COND_PLATFORM_WIN32_1___GTK_PLATFORM_SRC_OBJECTS_17 = \
monolib_generic_caret.o \
monolib_generic_imaglist.o \
monolib_automtn.o \
+ monolib_comimpl.o \
monolib_oleutils.o \
monolib_safearray.o \
monolib_uuid.o \
@@ -13643,6 +13655,7 @@ COND_PLATFORM_WIN32_1___GTK_PLATFORM_SRC_OBJECTS_1_1 = \
coredll_generic_caret.o \
coredll_generic_imaglist.o \
coredll_automtn.o \
+ coredll_comimpl.o \
coredll_oleutils.o \
coredll_safearray.o \
coredll_uuid.o \
@@ -13772,6 +13785,7 @@ COND_PLATFORM_WIN32_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \
corelib_generic_caret.o \
corelib_generic_imaglist.o \
corelib_automtn.o \
+ corelib_comimpl.o \
corelib_oleutils.o \
corelib_safearray.o \
corelib_uuid.o \
@@ -17607,6 +17621,15 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONODLL_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@monodll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONODLL_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_TOOLKIT_MSW_USE_GUI_1@monodll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONODLL_ODEP)
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp
@@ -22458,6 +22481,15 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONOLIB_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@monolib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONOLIB_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_TOOLKIT_MSW_USE_GUI_1@monolib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp
@@ -27378,6 +27410,15 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(COREDLL_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@coredll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(COREDLL_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_TOOLKIT_MSW_USE_GUI_1@coredll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(COREDLL_ODEP)
+@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(COREDLL_ODEP)
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp
@@ -30771,6 +30812,15 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(CORELIB_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@corelib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(CORELIB_ODEP)
+@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
+@COND_TOOLKIT_MSW_USE_GUI_1@corelib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(CORELIB_ODEP)
+@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp
+
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(CORELIB_ODEP)
@COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp
@@ -35259,7 +35309,6 @@ sound_sdl_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp
webkit2_ext_webview_webkit2_extension.o: $(srcdir)/src/gtk/webview_webkit2_extension.cpp
$(CXXC) -c -o $@ $(WEBKIT2_EXT_CXXFLAGS) $(srcdir)/src/gtk/webview_webkit2_extension.cpp
-
@COND_PYTHON@@COND_USE_STC_1@$(srcdir)/include/wx/stc/stc.h: \
@COND_PYTHON@@COND_USE_STC_1@$(srcdir)/src/stc/scintilla/include/Scintilla.iface \
@COND_PYTHON@@COND_USE_STC_1@$(srcdir)/src/stc/stc.cpp.in \
diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
index 3c65762618..c78e437847 100644
--- a/build/bakefiles/files.bkl
+++ b/build/bakefiles/files.bkl
@@ -1228,6 +1228,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/caret.cpp
src/generic/imaglist.cpp
src/msw/ole/automtn.cpp
+ src/msw/ole/comimpl.cpp
src/msw/ole/oleutils.cpp
src/msw/ole/safearray.cpp
src/msw/ole/uuid.cpp
@@ -1242,6 +1243,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/generic/caret.h
wx/generic/imaglist.h
wx/msw/ole/automtn.h
+ wx/msw/ole/comimpl.h
wx/msw/ole/oleutils.h
wx/msw/ole/safearray.h
wx/msw/ole/uuid.h
@@ -1885,6 +1887,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/imaglist.cpp
src/msw/minifram.cpp
src/msw/nonownedwnd.cpp
+ src/msw/ole/comimpl.cpp
src/msw/ole/dataobj.cpp
src/msw/ole/dropsrc.cpp
src/msw/ole/droptgt.cpp
@@ -2050,6 +2053,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/msw/msvcrt.h
wx/msw/notebook.h
wx/msw/ole/access.h
+ wx/msw/ole/comimpl.h
wx/msw/ole/dataform.h
wx/msw/ole/dataobj.h
wx/msw/ole/dataobj2.h
diff --git a/build/files b/build/files
index 2473d9dc50..ce0f95922a 100644
--- a/build/files
+++ b/build/files
@@ -1127,6 +1127,7 @@ GTK_WIN32_SRC =
src/generic/caret.cpp
src/generic/imaglist.cpp
src/msw/ole/automtn.cpp
+ src/msw/ole/comimpl.cpp
src/msw/ole/oleutils.cpp
src/msw/ole/safearray.cpp
src/msw/ole/uuid.cpp
@@ -1140,6 +1141,7 @@ GTK_WIN32_HDR =
wx/generic/caret.h
wx/generic/imaglist.h
wx/msw/ole/automtn.h
+ wx/msw/ole/comimpl.h
wx/msw/ole/oleutils.h
wx/msw/ole/safearray.h
wx/msw/ole/uuid.h
@@ -1747,6 +1749,7 @@ MSW_LOWLEVEL_SRC =
src/msw/imaglist.cpp
src/msw/minifram.cpp
src/msw/nonownedwnd.cpp
+ src/msw/ole/comimpl.cpp
src/msw/ole/dataobj.cpp
src/msw/ole/dropsrc.cpp
src/msw/ole/droptgt.cpp
@@ -1906,6 +1909,7 @@ MSW_HDR =
wx/msw/msvcrt.h
wx/msw/notebook.h
wx/msw/ole/access.h
+ wx/msw/ole/comimpl.h
wx/msw/ole/dataform.h
wx/msw/ole/dataobj.h
wx/msw/ole/dataobj2.h
diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc
index 450b5da195..89b0b12388 100644
--- a/build/msw/makefile.bcc
+++ b/build/msw/makefile.bcc
@@ -1822,6 +1822,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_imaglist.obj \
$(OBJS)\monodll_minifram.obj \
$(OBJS)\monodll_nonownedwnd.obj \
+ $(OBJS)\monodll_comimpl.obj \
$(OBJS)\monodll_dataobj.obj \
$(OBJS)\monodll_dropsrc.obj \
$(OBJS)\monodll_droptgt.obj \
@@ -2109,6 +2110,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_imaglist.obj \
$(OBJS)\monodll_minifram.obj \
$(OBJS)\monodll_nonownedwnd.obj \
+ $(OBJS)\monodll_comimpl.obj \
$(OBJS)\monodll_dataobj.obj \
$(OBJS)\monodll_dropsrc.obj \
$(OBJS)\monodll_droptgt.obj \
@@ -2653,6 +2655,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_imaglist.obj \
$(OBJS)\monolib_minifram.obj \
$(OBJS)\monolib_nonownedwnd.obj \
+ $(OBJS)\monolib_comimpl.obj \
$(OBJS)\monolib_dataobj.obj \
$(OBJS)\monolib_dropsrc.obj \
$(OBJS)\monolib_droptgt.obj \
@@ -2940,6 +2943,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_imaglist.obj \
$(OBJS)\monolib_minifram.obj \
$(OBJS)\monolib_nonownedwnd.obj \
+ $(OBJS)\monolib_comimpl.obj \
$(OBJS)\monolib_dataobj.obj \
$(OBJS)\monolib_dropsrc.obj \
$(OBJS)\monolib_droptgt.obj \
@@ -3356,6 +3360,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_imaglist.obj \
$(OBJS)\coredll_minifram.obj \
$(OBJS)\coredll_nonownedwnd.obj \
+ $(OBJS)\coredll_comimpl.obj \
$(OBJS)\coredll_dataobj.obj \
$(OBJS)\coredll_dropsrc.obj \
$(OBJS)\coredll_droptgt.obj \
@@ -3643,6 +3648,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_imaglist.obj \
$(OBJS)\coredll_minifram.obj \
$(OBJS)\coredll_nonownedwnd.obj \
+ $(OBJS)\coredll_comimpl.obj \
$(OBJS)\coredll_dataobj.obj \
$(OBJS)\coredll_dropsrc.obj \
$(OBJS)\coredll_droptgt.obj \
@@ -3927,6 +3933,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_imaglist.obj \
$(OBJS)\corelib_minifram.obj \
$(OBJS)\corelib_nonownedwnd.obj \
+ $(OBJS)\corelib_comimpl.obj \
$(OBJS)\corelib_dataobj.obj \
$(OBJS)\corelib_dropsrc.obj \
$(OBJS)\corelib_droptgt.obj \
@@ -4214,6 +4221,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_imaglist.obj \
$(OBJS)\corelib_minifram.obj \
$(OBJS)\corelib_nonownedwnd.obj \
+ $(OBJS)\corelib_comimpl.obj \
$(OBJS)\corelib_dataobj.obj \
$(OBJS)\corelib_dropsrc.obj \
$(OBJS)\corelib_droptgt.obj \
@@ -7726,6 +7734,11 @@ $(OBJS)\monodll_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
@@ -10267,6 +10280,11 @@ $(OBJS)\monolib_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
@@ -12751,6 +12769,11 @@ $(OBJS)\coredll_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
@@ -14228,6 +14251,11 @@ $(OBJS)\corelib_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc
index 8ab514c0bc..a600ff79d2 100644
--- a/build/msw/makefile.gcc
+++ b/build/msw/makefile.gcc
@@ -1842,6 +1842,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_imaglist.o \
$(OBJS)\monodll_minifram.o \
$(OBJS)\monodll_nonownedwnd.o \
+ $(OBJS)\monodll_comimpl.o \
$(OBJS)\monodll_dataobj.o \
$(OBJS)\monodll_dropsrc.o \
$(OBJS)\monodll_droptgt.o \
@@ -2131,6 +2132,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_imaglist.o \
$(OBJS)\monodll_minifram.o \
$(OBJS)\monodll_nonownedwnd.o \
+ $(OBJS)\monodll_comimpl.o \
$(OBJS)\monodll_dataobj.o \
$(OBJS)\monodll_dropsrc.o \
$(OBJS)\monodll_droptgt.o \
@@ -2679,6 +2681,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_imaglist.o \
$(OBJS)\monolib_minifram.o \
$(OBJS)\monolib_nonownedwnd.o \
+ $(OBJS)\monolib_comimpl.o \
$(OBJS)\monolib_dataobj.o \
$(OBJS)\monolib_dropsrc.o \
$(OBJS)\monolib_droptgt.o \
@@ -2968,6 +2971,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_imaglist.o \
$(OBJS)\monolib_minifram.o \
$(OBJS)\monolib_nonownedwnd.o \
+ $(OBJS)\monolib_comimpl.o \
$(OBJS)\monolib_dataobj.o \
$(OBJS)\monolib_dropsrc.o \
$(OBJS)\monolib_droptgt.o \
@@ -3398,6 +3402,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_imaglist.o \
$(OBJS)\coredll_minifram.o \
$(OBJS)\coredll_nonownedwnd.o \
+ $(OBJS)\coredll_comimpl.o \
$(OBJS)\coredll_dataobj.o \
$(OBJS)\coredll_dropsrc.o \
$(OBJS)\coredll_droptgt.o \
@@ -3687,6 +3692,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_imaglist.o \
$(OBJS)\coredll_minifram.o \
$(OBJS)\coredll_nonownedwnd.o \
+ $(OBJS)\coredll_comimpl.o \
$(OBJS)\coredll_dataobj.o \
$(OBJS)\coredll_dropsrc.o \
$(OBJS)\coredll_droptgt.o \
@@ -3977,6 +3983,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_imaglist.o \
$(OBJS)\corelib_minifram.o \
$(OBJS)\corelib_nonownedwnd.o \
+ $(OBJS)\corelib_comimpl.o \
$(OBJS)\corelib_dataobj.o \
$(OBJS)\corelib_dropsrc.o \
$(OBJS)\corelib_droptgt.o \
@@ -4266,6 +4273,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_imaglist.o \
$(OBJS)\corelib_minifram.o \
$(OBJS)\corelib_nonownedwnd.o \
+ $(OBJS)\corelib_comimpl.o \
$(OBJS)\corelib_dataobj.o \
$(OBJS)\corelib_dropsrc.o \
$(OBJS)\corelib_droptgt.o \
@@ -7902,6 +7910,11 @@ $(OBJS)\monodll_nonownedwnd.o: ../../src/msw/nonownedwnd.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\monodll_comimpl.o: ../../src/msw/ole/comimpl.cpp
+ $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_dataobj.o: ../../src/msw/ole/dataobj.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -10445,6 +10458,11 @@ $(OBJS)\monolib_nonownedwnd.o: ../../src/msw/nonownedwnd.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\monolib_comimpl.o: ../../src/msw/ole/comimpl.cpp
+ $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_dataobj.o: ../../src/msw/ole/dataobj.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -12931,6 +12949,11 @@ $(OBJS)\coredll_nonownedwnd.o: ../../src/msw/nonownedwnd.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\coredll_comimpl.o: ../../src/msw/ole/comimpl.cpp
+ $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_dataobj.o: ../../src/msw/ole/dataobj.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -14408,6 +14431,11 @@ $(OBJS)\corelib_nonownedwnd.o: ../../src/msw/nonownedwnd.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\corelib_comimpl.o: ../../src/msw/ole/comimpl.cpp
+ $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_dataobj.o: ../../src/msw/ole/dataobj.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc
index 9629977d8b..033cb759f8 100644
--- a/build/msw/makefile.vc
+++ b/build/msw/makefile.vc
@@ -2123,6 +2123,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_imaglist.obj \
$(OBJS)\monodll_minifram.obj \
$(OBJS)\monodll_nonownedwnd.obj \
+ $(OBJS)\monodll_comimpl.obj \
$(OBJS)\monodll_dataobj.obj \
$(OBJS)\monodll_dropsrc.obj \
$(OBJS)\monodll_droptgt.obj \
@@ -2410,6 +2411,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_imaglist.obj \
$(OBJS)\monodll_minifram.obj \
$(OBJS)\monodll_nonownedwnd.obj \
+ $(OBJS)\monodll_comimpl.obj \
$(OBJS)\monodll_dataobj.obj \
$(OBJS)\monodll_dropsrc.obj \
$(OBJS)\monodll_droptgt.obj \
@@ -2960,6 +2962,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_imaglist.obj \
$(OBJS)\monolib_minifram.obj \
$(OBJS)\monolib_nonownedwnd.obj \
+ $(OBJS)\monolib_comimpl.obj \
$(OBJS)\monolib_dataobj.obj \
$(OBJS)\monolib_dropsrc.obj \
$(OBJS)\monolib_droptgt.obj \
@@ -3247,6 +3250,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_imaglist.obj \
$(OBJS)\monolib_minifram.obj \
$(OBJS)\monolib_nonownedwnd.obj \
+ $(OBJS)\monolib_comimpl.obj \
$(OBJS)\monolib_dataobj.obj \
$(OBJS)\monolib_dropsrc.obj \
$(OBJS)\monolib_droptgt.obj \
@@ -3729,6 +3733,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_imaglist.obj \
$(OBJS)\coredll_minifram.obj \
$(OBJS)\coredll_nonownedwnd.obj \
+ $(OBJS)\coredll_comimpl.obj \
$(OBJS)\coredll_dataobj.obj \
$(OBJS)\coredll_dropsrc.obj \
$(OBJS)\coredll_droptgt.obj \
@@ -4016,6 +4021,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_imaglist.obj \
$(OBJS)\coredll_minifram.obj \
$(OBJS)\coredll_nonownedwnd.obj \
+ $(OBJS)\coredll_comimpl.obj \
$(OBJS)\coredll_dataobj.obj \
$(OBJS)\coredll_dropsrc.obj \
$(OBJS)\coredll_droptgt.obj \
@@ -4306,6 +4312,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_imaglist.obj \
$(OBJS)\corelib_minifram.obj \
$(OBJS)\corelib_nonownedwnd.obj \
+ $(OBJS)\corelib_comimpl.obj \
$(OBJS)\corelib_dataobj.obj \
$(OBJS)\corelib_dropsrc.obj \
$(OBJS)\corelib_droptgt.obj \
@@ -4593,6 +4600,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_imaglist.obj \
$(OBJS)\corelib_minifram.obj \
$(OBJS)\corelib_nonownedwnd.obj \
+ $(OBJS)\corelib_comimpl.obj \
$(OBJS)\corelib_dataobj.obj \
$(OBJS)\corelib_dropsrc.obj \
$(OBJS)\corelib_droptgt.obj \
@@ -8419,6 +8427,11 @@ $(OBJS)\monodll_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
@@ -10960,6 +10973,11 @@ $(OBJS)\monolib_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
@@ -13444,6 +13462,11 @@ $(OBJS)\coredll_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
@@ -14921,6 +14944,11 @@ $(OBJS)\corelib_nonownedwnd.obj: ..\..\src\msw\nonownedwnd.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\nonownedwnd.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_comimpl.obj: ..\..\src\msw\ole\comimpl.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\comimpl.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_dataobj.obj: ..\..\src\msw\ole\dataobj.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\dataobj.cpp
diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj
index 0f76d002f1..7c52eeda3a 100644
--- a/build/msw/wx_core.vcxproj
+++ b/build/msw/wx_core.vcxproj
@@ -685,6 +685,7 @@
+
@@ -1051,6 +1052,7 @@
+
diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters
index 38eb2f2785..d4418f6617 100644
--- a/build/msw/wx_core.vcxproj.filters
+++ b/build/msw/wx_core.vcxproj.filters
@@ -762,6 +762,9 @@
MSW Sources
+
+ MSW Sources
+
MSW Sources
@@ -1549,6 +1552,9 @@
MSW Headers
+
+ MSW Headers
+
MSW Headers
diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj
index 37d66fa9fd..9b9fd90ae9 100644
--- a/build/msw/wx_vc7_core.vcproj
+++ b/build/msw/wx_vc7_core.vcproj
@@ -763,6 +763,9 @@
+
+
@@ -1307,6 +1310,9 @@
+
+
diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj
index ced19bd2c1..c8d45bf837 100644
--- a/build/msw/wx_vc8_core.vcproj
+++ b/build/msw/wx_vc8_core.vcproj
@@ -1422,6 +1422,10 @@
RelativePath="..\..\src\msw\combobox.cpp"
>
+
+
@@ -2205,6 +2209,10 @@
RelativePath="..\..\include\wx\msw\combobox.h"
>
+
+
diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj
index 098745f91a..e81eaeafc6 100644
--- a/build/msw/wx_vc9_core.vcproj
+++ b/build/msw/wx_vc9_core.vcproj
@@ -1418,6 +1418,10 @@
RelativePath="..\..\src\msw\combobox.cpp"
>
+
+
@@ -2201,6 +2205,10 @@
RelativePath="..\..\include\wx\msw\combobox.h"
>
+
+
diff --git a/include/wx/msw/ole/comimpl.h b/include/wx/msw/ole/comimpl.h
new file mode 100644
index 0000000000..f688b70d02
--- /dev/null
+++ b/include/wx/msw/ole/comimpl.h
@@ -0,0 +1,163 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/msw/ole/comimpl.h
+// Purpose: COM helper routines, COM debugging support &c
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.02.1998
+// Copyright: (c) 1998 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef WX_COMIMPL_H
+#define WX_COMIMPL_H
+
+#include "wx/defs.h"
+
+#include "wx/msw/wrapwin.h"
+// get IUnknown, REFIID &c
+#include
+
+// ============================================================================
+// General purpose functions and macros
+// ============================================================================
+
+// release the interface pointer (if !NULL)
+inline void ReleaseInterface(IUnknown *pIUnk)
+{
+ if ( pIUnk != NULL )
+ pIUnk->Release();
+}
+
+// release the interface pointer (if !NULL) and make it NULL
+#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; };
+
+// return true if the iid is in the array
+extern WXDLLIMPEXP_CORE bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount);
+
+// ============================================================================
+// IUnknown implementation helpers
+// ============================================================================
+
+/*
+ The most dumb implementation of IUnknown methods. We don't support
+ aggregation nor containment, but for 99% of cases this simple
+ implementation is quite enough.
+
+ Usage is trivial: here is all you should have
+ 1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration
+ 2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you
+ support (at least all for which you intent to return 'this' from QI,
+ i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else
+ 3) IMPLEMENT_IUNKNOWN_METHODS somewhere also
+
+ These macros are quite simple: AddRef and Release are trivial and QI does
+ lookup in a static member array of IIDs and returns 'this' if it founds
+ the requested interface in it or E_NOINTERFACE if not.
+ */
+
+/*
+ wxAutoULong: this class is used for automatically initalising m_cRef to 0
+*/
+class wxAutoULong
+{
+public:
+ wxAutoULong(ULONG value = 0) : m_Value(value) { }
+
+ operator ULONG&() { return m_Value; }
+ ULONG& operator=(ULONG value) { m_Value = value; return m_Value; }
+
+ wxAutoULong& operator++() { ++m_Value; return *this; }
+ const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; }
+
+ wxAutoULong& operator--() { --m_Value; return *this; }
+ const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; }
+
+private:
+ ULONG m_Value;
+};
+
+// declare the methods and the member variable containing reference count
+// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE
+// and friends (see below)
+
+#define DECLARE_IUNKNOWN_METHODS \
+ public: \
+ STDMETHODIMP QueryInterface(REFIID, void **) wxOVERRIDE; \
+ STDMETHODIMP_(ULONG) AddRef() wxOVERRIDE; \
+ STDMETHODIMP_(ULONG) Release() wxOVERRIDE; \
+ private: \
+ static const IID *ms_aIids[]; \
+ wxAutoULong m_cRef
+
+// macros for declaring supported interfaces
+// NB: ADD_IID prepends IID_I whereas ADD_RAW_IID does not
+#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = {
+#define ADD_IID(iid) &IID_I##iid,
+#define ADD_RAW_IID(iid) &iid,
+#define END_IID_TABLE }
+
+// implementation is as straightforward as possible
+// Parameter: classname - the name of the class
+#define IMPLEMENT_IUNKNOWN_METHODS(classname) \
+ STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \
+ { \
+ wxLogQueryInterface(wxT(#classname), riid); \
+ \
+ if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \
+ *ppv = this; \
+ AddRef(); \
+ \
+ return S_OK; \
+ } \
+ else { \
+ *ppv = NULL; \
+ \
+ return (HRESULT) E_NOINTERFACE; \
+ } \
+ } \
+ \
+ STDMETHODIMP_(ULONG) classname::AddRef() \
+ { \
+ wxLogAddRef(wxT(#classname), m_cRef); \
+ \
+ return ++m_cRef; \
+ } \
+ \
+ STDMETHODIMP_(ULONG) classname::Release() \
+ { \
+ wxLogRelease(wxT(#classname), m_cRef); \
+ \
+ if ( --m_cRef == wxAutoULong(0) ) { \
+ delete this; \
+ return 0; \
+ } \
+ else \
+ return m_cRef; \
+ }
+
+// ============================================================================
+// Debugging support
+// ============================================================================
+
+// VZ: I don't know it's not done for compilers other than VC++ but I leave it
+// as is. Please note, though, that tracing COM interface calls may be
+// incredibly useful when debugging COM programs.
+#if defined(__WXDEBUG__) && defined(__VISUALC__)
+// ----------------------------------------------------------------------------
+// All COM specific log functions have DebugTrace level (as LogTrace)
+// ----------------------------------------------------------------------------
+
+// tries to translate riid into a symbolic name, if possible
+WXDLLIMPEXP_CORE void wxLogQueryInterface(const wxChar *szInterface, REFIID riid);
+
+// these functions print out the new value of reference counter
+WXDLLIMPEXP_CORE void wxLogAddRef (const wxChar *szInterface, ULONG cRef);
+WXDLLIMPEXP_CORE void wxLogRelease(const wxChar *szInterface, ULONG cRef);
+
+#else //!__WXDEBUG__
+ #define wxLogQueryInterface(szInterface, riid)
+ #define wxLogAddRef(szInterface, cRef)
+ #define wxLogRelease(szInterface, cRef)
+#endif //__WXDEBUG__
+
+#endif // WX_COMIMPL_H
diff --git a/include/wx/msw/ole/oleutils.h b/include/wx/msw/ole/oleutils.h
index f8707df516..1dab81b18a 100644
--- a/include/wx/msw/ole/oleutils.h
+++ b/include/wx/msw/ole/oleutils.h
@@ -23,6 +23,8 @@
#include "wx/log.h"
#include "wx/variant.h"
+#include "wx/msw/ole/comimpl.h"
+
// ============================================================================
// General purpose functions and macros
// ============================================================================
@@ -59,149 +61,6 @@ inline void wxOleUninitialize()
::OleUninitialize();
}
-// ----------------------------------------------------------------------------
-// misc helper functions/macros
-// ----------------------------------------------------------------------------
-
-// release the interface pointer (if !NULL)
-inline void ReleaseInterface(IUnknown *pIUnk)
-{
- if ( pIUnk != NULL )
- pIUnk->Release();
-}
-
-// release the interface pointer (if !NULL) and make it NULL
-#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; };
-
-// return true if the iid is in the array
-extern WXDLLIMPEXP_CORE bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount);
-
-// ============================================================================
-// IUnknown implementation helpers
-// ============================================================================
-
-/*
- The most dumb implementation of IUnknown methods. We don't support
- aggregation nor containment, but for 99% of cases this simple
- implementation is quite enough.
-
- Usage is trivial: here is all you should have
- 1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration
- 2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you
- support (at least all for which you intent to return 'this' from QI,
- i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else
- 3) IMPLEMENT_IUNKNOWN_METHODS somewhere also
-
- These macros are quite simple: AddRef and Release are trivial and QI does
- lookup in a static member array of IIDs and returns 'this' if it founds
- the requested interface in it or E_NOINTERFACE if not.
- */
-
-/*
- wxAutoULong: this class is used for automatically initalising m_cRef to 0
-*/
-class wxAutoULong
-{
-public:
- wxAutoULong(ULONG value = 0) : m_Value(value) { }
-
- operator ULONG&() { return m_Value; }
- ULONG& operator=(ULONG value) { m_Value = value; return m_Value; }
-
- wxAutoULong& operator++() { ++m_Value; return *this; }
- const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; }
-
- wxAutoULong& operator--() { --m_Value; return *this; }
- const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; }
-
-private:
- ULONG m_Value;
-};
-
-// declare the methods and the member variable containing reference count
-// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE
-// and friends (see below)
-
-#define DECLARE_IUNKNOWN_METHODS \
- public: \
- STDMETHODIMP QueryInterface(REFIID, void **) wxOVERRIDE; \
- STDMETHODIMP_(ULONG) AddRef() wxOVERRIDE; \
- STDMETHODIMP_(ULONG) Release() wxOVERRIDE; \
- private: \
- static const IID *ms_aIids[]; \
- wxAutoULong m_cRef
-
-// macros for declaring supported interfaces
-// NB: ADD_IID prepends IID_I whereas ADD_RAW_IID does not
-#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = {
-#define ADD_IID(iid) &IID_I##iid,
-#define ADD_RAW_IID(iid) &iid,
-#define END_IID_TABLE }
-
-// implementation is as straightforward as possible
-// Parameter: classname - the name of the class
-#define IMPLEMENT_IUNKNOWN_METHODS(classname) \
- STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \
- { \
- wxLogQueryInterface(wxT(#classname), riid); \
- \
- if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \
- *ppv = this; \
- AddRef(); \
- \
- return S_OK; \
- } \
- else { \
- *ppv = NULL; \
- \
- return (HRESULT) E_NOINTERFACE; \
- } \
- } \
- \
- STDMETHODIMP_(ULONG) classname::AddRef() \
- { \
- wxLogAddRef(wxT(#classname), m_cRef); \
- \
- return ++m_cRef; \
- } \
- \
- STDMETHODIMP_(ULONG) classname::Release() \
- { \
- wxLogRelease(wxT(#classname), m_cRef); \
- \
- if ( --m_cRef == wxAutoULong(0) ) { \
- delete this; \
- return 0; \
- } \
- else \
- return m_cRef; \
- }
-
-// ============================================================================
-// Debugging support
-// ============================================================================
-
-// VZ: I don't know it's not done for compilers other than VC++ but I leave it
-// as is. Please note, though, that tracing OLE interface calls may be
-// incredibly useful when debugging OLE programs.
-#if defined(__WXDEBUG__) && defined(__VISUALC__)
-// ----------------------------------------------------------------------------
-// All OLE specific log functions have DebugTrace level (as LogTrace)
-// ----------------------------------------------------------------------------
-
-// tries to translate riid into a symbolic name, if possible
-WXDLLIMPEXP_CORE void wxLogQueryInterface(const wxChar *szInterface, REFIID riid);
-
-// these functions print out the new value of reference counter
-WXDLLIMPEXP_CORE void wxLogAddRef (const wxChar *szInterface, ULONG cRef);
-WXDLLIMPEXP_CORE void wxLogRelease(const wxChar *szInterface, ULONG cRef);
-
-#else //!__WXDEBUG__
- #define wxLogQueryInterface(szInterface, riid)
- #define wxLogAddRef(szInterface, cRef)
- #define wxLogRelease(szInterface, cRef)
-#endif //__WXDEBUG__
-
// wrapper around BSTR type (by Vadim Zeitlin)
class WXDLLIMPEXP_CORE wxBasicString
diff --git a/src/msw/ole/comimpl.cpp b/src/msw/ole/comimpl.cpp
new file mode 100644
index 0000000000..464384a792
--- /dev/null
+++ b/src/msw/ole/comimpl.cpp
@@ -0,0 +1,178 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/msw/ole/oleutils.cpp
+// Purpose: implementation of OLE helper functions
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 19.02.98
+// Copyright: (c) 1998 Vadim Zeitlin
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// Declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+ #pragma hdrstop
+#endif
+
+#ifndef __CYGWIN10__
+
+#include "wx/msw/ole/comimpl.h"
+
+// ============================================================================
+// Implementation
+// ============================================================================
+
+// return true if the iid is in the array
+WXDLLEXPORT bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount)
+{
+ for ( size_t i = 0; i < nCount; i++ ) {
+ if ( riid == *aIids[i] )
+ return true;
+ }
+
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// Debug support
+// ----------------------------------------------------------------------------
+
+#if defined(__WXDEBUG__) && defined(__VISUALC__)
+
+#include "wx/log.h"
+#include "wx/msw/ole/uuid.h"
+#include
+
+static wxString GetIidName(REFIID riid)
+{
+ // an association between symbolic name and numeric value of an IID
+ struct KNOWN_IID {
+ const IID *pIid;
+ const wxChar *szName;
+ };
+
+ // construct the table containing all known interfaces
+ #define ADD_KNOWN_IID(name) { &IID_I##name, wxT(#name) }
+
+ static const KNOWN_IID aKnownIids[] = {
+ ADD_KNOWN_IID(AdviseSink),
+ ADD_KNOWN_IID(AdviseSink2),
+ ADD_KNOWN_IID(BindCtx),
+ ADD_KNOWN_IID(ClassFactory),
+ ADD_KNOWN_IID(ContinueCallback),
+ ADD_KNOWN_IID(EnumOleDocumentViews),
+ ADD_KNOWN_IID(OleCommandTarget),
+ ADD_KNOWN_IID(OleDocument),
+ ADD_KNOWN_IID(OleDocumentSite),
+ ADD_KNOWN_IID(OleDocumentView),
+ ADD_KNOWN_IID(Print),
+ ADD_KNOWN_IID(DataAdviseHolder),
+ ADD_KNOWN_IID(DataObject),
+ ADD_KNOWN_IID(Debug),
+ ADD_KNOWN_IID(DebugStream),
+ ADD_KNOWN_IID(DfReserved1),
+ ADD_KNOWN_IID(DfReserved2),
+ ADD_KNOWN_IID(DfReserved3),
+ ADD_KNOWN_IID(Dispatch),
+ ADD_KNOWN_IID(DropSource),
+ ADD_KNOWN_IID(DropTarget),
+ ADD_KNOWN_IID(EnumCallback),
+ ADD_KNOWN_IID(EnumFORMATETC),
+ ADD_KNOWN_IID(EnumGeneric),
+ ADD_KNOWN_IID(EnumHolder),
+ ADD_KNOWN_IID(EnumMoniker),
+ ADD_KNOWN_IID(EnumOLEVERB),
+ ADD_KNOWN_IID(EnumSTATDATA),
+ ADD_KNOWN_IID(EnumSTATSTG),
+ ADD_KNOWN_IID(EnumString),
+ ADD_KNOWN_IID(EnumUnknown),
+ ADD_KNOWN_IID(EnumVARIANT),
+ ADD_KNOWN_IID(ExternalConnection),
+ ADD_KNOWN_IID(InternalMoniker),
+ ADD_KNOWN_IID(LockBytes),
+ ADD_KNOWN_IID(Malloc),
+ ADD_KNOWN_IID(Marshal),
+ ADD_KNOWN_IID(MessageFilter),
+ ADD_KNOWN_IID(Moniker),
+ ADD_KNOWN_IID(OleAdviseHolder),
+ ADD_KNOWN_IID(OleCache),
+ ADD_KNOWN_IID(OleCache2),
+ ADD_KNOWN_IID(OleCacheControl),
+ ADD_KNOWN_IID(OleClientSite),
+ ADD_KNOWN_IID(OleContainer),
+ ADD_KNOWN_IID(OleInPlaceActiveObject),
+ ADD_KNOWN_IID(OleInPlaceFrame),
+ ADD_KNOWN_IID(OleInPlaceObject),
+ ADD_KNOWN_IID(OleInPlaceSite),
+ ADD_KNOWN_IID(OleInPlaceUIWindow),
+ ADD_KNOWN_IID(OleItemContainer),
+ ADD_KNOWN_IID(OleLink),
+ ADD_KNOWN_IID(OleManager),
+ ADD_KNOWN_IID(OleObject),
+ ADD_KNOWN_IID(OlePresObj),
+ ADD_KNOWN_IID(OleWindow),
+ ADD_KNOWN_IID(PSFactory),
+ ADD_KNOWN_IID(ParseDisplayName),
+ ADD_KNOWN_IID(Persist),
+ ADD_KNOWN_IID(PersistFile),
+ ADD_KNOWN_IID(PersistStorage),
+ ADD_KNOWN_IID(PersistStream),
+ ADD_KNOWN_IID(ProxyManager),
+ ADD_KNOWN_IID(RootStorage),
+ ADD_KNOWN_IID(RpcChannel),
+ ADD_KNOWN_IID(RpcProxy),
+ ADD_KNOWN_IID(RpcStub),
+ ADD_KNOWN_IID(RunnableObject),
+ ADD_KNOWN_IID(RunningObjectTable),
+ ADD_KNOWN_IID(StdMarshalInfo),
+ ADD_KNOWN_IID(Storage),
+ ADD_KNOWN_IID(Stream),
+ ADD_KNOWN_IID(StubManager),
+ ADD_KNOWN_IID(Unknown),
+ ADD_KNOWN_IID(ViewObject),
+ ADD_KNOWN_IID(ViewObject2),
+ };
+
+ // don't clobber preprocessor name space
+ #undef ADD_KNOWN_IID
+
+ // try to find the interface in the table
+ for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ ) {
+ if ( riid == *aKnownIids[ui].pIid ) {
+ return aKnownIids[ui].szName;
+ }
+ }
+
+ // unknown IID, just transform to string
+ Uuid uuid(riid);
+ return wxString((const wxChar *)uuid);
+}
+
+WXDLLEXPORT void wxLogQueryInterface(const wxChar *szInterface, REFIID riid)
+{
+ wxLogTrace(wxTRACE_OleCalls, wxT("%s::QueryInterface (iid = %s)"),
+ szInterface, GetIidName(riid).c_str());
+}
+
+WXDLLEXPORT void wxLogAddRef(const wxChar *szInterface, ULONG cRef)
+{
+ wxLogTrace(wxTRACE_OleCalls, wxT("After %s::AddRef: m_cRef = %d"), szInterface, cRef + 1);
+}
+
+WXDLLEXPORT void wxLogRelease(const wxChar *szInterface, ULONG cRef)
+{
+ wxLogTrace(wxTRACE_OleCalls, wxT("After %s::Release: m_cRef = %d"), szInterface, cRef - 1);
+}
+
+#endif // __WXDEBUG__ && __VISUALC__
+
+#endif // __CYGWIN10__
diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp
index 57a19fc1a4..67c1477753 100644
--- a/src/msw/ole/oleutils.cpp
+++ b/src/msw/ole/oleutils.cpp
@@ -25,39 +25,17 @@
#if wxUSE_OLE
-#ifndef WX_PRECOMP
- #include "wx/log.h"
-#endif
-
#ifndef __CYGWIN10__
#include "wx/msw/private.h"
-// OLE
-#include "wx/msw/ole/uuid.h"
-
#include "wx/msw/ole/oleutils.h"
#include "wx/msw/ole/safearray.h"
-#if defined(__VISUALC__)
- #include
-#endif
-
// ============================================================================
// Implementation
// ============================================================================
-// return true if the iid is in the array
-WXDLLEXPORT bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount)
-{
- for ( size_t i = 0; i < nCount; i++ ) {
- if ( riid == *aIids[i] )
- return true;
- }
-
- return false;
-}
-
WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str)
{
return wxBasicString(str).Get();
@@ -540,141 +518,6 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, long fla
#endif // wxUSE_VARIANT
-
-// ----------------------------------------------------------------------------
-// Debug support
-// ----------------------------------------------------------------------------
-
-#if wxUSE_DATAOBJ
-
-#if wxDEBUG_LEVEL && defined(__VISUALC__)
-static wxString GetIidName(REFIID riid)
-{
- // an association between symbolic name and numeric value of an IID
- struct KNOWN_IID {
- const IID *pIid;
- const wxChar *szName;
- };
-
- // construct the table containing all known interfaces
- #define ADD_KNOWN_IID(name) { &IID_I##name, wxT(#name) }
-
- static const KNOWN_IID aKnownIids[] = {
- ADD_KNOWN_IID(AdviseSink),
- ADD_KNOWN_IID(AdviseSink2),
- ADD_KNOWN_IID(BindCtx),
- ADD_KNOWN_IID(ClassFactory),
-#if ( !defined( __VISUALC__) || (__VISUALC__!=1010) )
- ADD_KNOWN_IID(ContinueCallback),
- ADD_KNOWN_IID(EnumOleDocumentViews),
- ADD_KNOWN_IID(OleCommandTarget),
- ADD_KNOWN_IID(OleDocument),
- ADD_KNOWN_IID(OleDocumentSite),
- ADD_KNOWN_IID(OleDocumentView),
- ADD_KNOWN_IID(Print),
-#endif
- ADD_KNOWN_IID(DataAdviseHolder),
- ADD_KNOWN_IID(DataObject),
- ADD_KNOWN_IID(Debug),
- ADD_KNOWN_IID(DebugStream),
- ADD_KNOWN_IID(DfReserved1),
- ADD_KNOWN_IID(DfReserved2),
- ADD_KNOWN_IID(DfReserved3),
- ADD_KNOWN_IID(Dispatch),
- ADD_KNOWN_IID(DropSource),
- ADD_KNOWN_IID(DropTarget),
- ADD_KNOWN_IID(EnumCallback),
- ADD_KNOWN_IID(EnumFORMATETC),
- ADD_KNOWN_IID(EnumGeneric),
- ADD_KNOWN_IID(EnumHolder),
- ADD_KNOWN_IID(EnumMoniker),
- ADD_KNOWN_IID(EnumOLEVERB),
- ADD_KNOWN_IID(EnumSTATDATA),
- ADD_KNOWN_IID(EnumSTATSTG),
- ADD_KNOWN_IID(EnumString),
- ADD_KNOWN_IID(EnumUnknown),
- ADD_KNOWN_IID(EnumVARIANT),
- ADD_KNOWN_IID(ExternalConnection),
- ADD_KNOWN_IID(InternalMoniker),
- ADD_KNOWN_IID(LockBytes),
- ADD_KNOWN_IID(Malloc),
- ADD_KNOWN_IID(Marshal),
- ADD_KNOWN_IID(MessageFilter),
- ADD_KNOWN_IID(Moniker),
- ADD_KNOWN_IID(OleAdviseHolder),
- ADD_KNOWN_IID(OleCache),
- ADD_KNOWN_IID(OleCache2),
- ADD_KNOWN_IID(OleCacheControl),
- ADD_KNOWN_IID(OleClientSite),
- ADD_KNOWN_IID(OleContainer),
- ADD_KNOWN_IID(OleInPlaceActiveObject),
- ADD_KNOWN_IID(OleInPlaceFrame),
- ADD_KNOWN_IID(OleInPlaceObject),
- ADD_KNOWN_IID(OleInPlaceSite),
- ADD_KNOWN_IID(OleInPlaceUIWindow),
- ADD_KNOWN_IID(OleItemContainer),
- ADD_KNOWN_IID(OleLink),
- ADD_KNOWN_IID(OleManager),
- ADD_KNOWN_IID(OleObject),
- ADD_KNOWN_IID(OlePresObj),
- ADD_KNOWN_IID(OleWindow),
- ADD_KNOWN_IID(PSFactory),
- ADD_KNOWN_IID(ParseDisplayName),
- ADD_KNOWN_IID(Persist),
- ADD_KNOWN_IID(PersistFile),
- ADD_KNOWN_IID(PersistStorage),
- ADD_KNOWN_IID(PersistStream),
- ADD_KNOWN_IID(ProxyManager),
- ADD_KNOWN_IID(RootStorage),
- ADD_KNOWN_IID(RpcChannel),
- ADD_KNOWN_IID(RpcProxy),
- ADD_KNOWN_IID(RpcStub),
- ADD_KNOWN_IID(RunnableObject),
- ADD_KNOWN_IID(RunningObjectTable),
- ADD_KNOWN_IID(StdMarshalInfo),
- ADD_KNOWN_IID(Storage),
- ADD_KNOWN_IID(Stream),
- ADD_KNOWN_IID(StubManager),
- ADD_KNOWN_IID(Unknown),
- ADD_KNOWN_IID(ViewObject),
- ADD_KNOWN_IID(ViewObject2),
- };
-
- // don't clobber preprocessor name space
- #undef ADD_KNOWN_IID
-
- // try to find the interface in the table
- for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ ) {
- if ( riid == *aKnownIids[ui].pIid ) {
- return aKnownIids[ui].szName;
- }
- }
-
- // unknown IID, just transform to string
- Uuid uuid(riid);
- return wxString((const wxChar *)uuid);
-}
-
-WXDLLEXPORT void wxLogQueryInterface(const wxChar *szInterface, REFIID riid)
-{
- wxLogTrace(wxTRACE_OleCalls, wxT("%s::QueryInterface (iid = %s)"),
- szInterface, GetIidName(riid).c_str());
-}
-
-WXDLLEXPORT void wxLogAddRef(const wxChar *szInterface, ULONG cRef)
-{
- wxLogTrace(wxTRACE_OleCalls, wxT("After %s::AddRef: m_cRef = %d"), szInterface, cRef + 1);
-}
-
-WXDLLEXPORT void wxLogRelease(const wxChar *szInterface, ULONG cRef)
-{
- wxLogTrace(wxTRACE_OleCalls, wxT("After %s::Release: m_cRef = %d"), szInterface, cRef - 1);
-}
-
-#endif // wxDEBUG_LEVEL
-
-#endif // wxUSE_DATAOBJ
-
#endif // __CYGWIN10__
#endif // wxUSE_OLE