Add basic support to use WinRT APIs.

Some Windows8+ APIs are only accessible via WinRT which is based on COM. However there are a few dependencies to get to the interfaces via functions defined in roapi.h. Using RoInitialize, RoUninitialize, etc. directly from it's windows headers adds dependencies to the WinRT dlls leaving the resulting exe unable to launch on earlier Windows versions. The wxWinRT functions wrap this with dynamic loading. Additionally wxWinRT::TempStringRef adds a convenient wrapper to HSTRING which is used extensively in WinRT APIs.
This commit is contained in:
Tobias Taschner 2015-09-14 20:00:00 +02:00
parent 816c58e0af
commit 72db8a6265
19 changed files with 537 additions and 1 deletions

View File

@ -3129,6 +3129,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \
wx/msw/toplevel.h \
wx/msw/treectrl.h \
wx/msw/window.h \
wx/msw/rt/utils.h \
wx/msw/checklst.h \
wx/msw/fdrepdlg.h \
wx/msw/fontdlg.h \
@ -4912,6 +4913,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \
monodll_uxtheme.o \
monodll_msw_window.o \
monodll_graphicsd2d.o \
monodll_utilsrt.o \
monodll_helpchm.o \
monodll_helpwin.o \
monodll_automtn.o \
@ -5614,6 +5616,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \
monodll_uxtheme.o \
monodll_msw_window.o \
monodll_graphicsd2d.o \
monodll_utilsrt.o \
monodll_helpchm.o \
monodll_helpwin.o \
monodll_automtn.o \
@ -6912,6 +6915,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \
monolib_uxtheme.o \
monolib_msw_window.o \
monolib_graphicsd2d.o \
monolib_utilsrt.o \
monolib_helpchm.o \
monolib_helpwin.o \
monolib_automtn.o \
@ -7614,6 +7618,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \
monolib_uxtheme.o \
monolib_msw_window.o \
monolib_graphicsd2d.o \
monolib_utilsrt.o \
monolib_helpchm.o \
monolib_helpwin.o \
monolib_automtn.o \
@ -9055,6 +9060,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \
coredll_uxtheme.o \
coredll_msw_window.o \
coredll_graphicsd2d.o \
coredll_utilsrt.o \
coredll_helpchm.o \
coredll_helpwin.o \
coredll_automtn.o \
@ -9757,6 +9763,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \
coredll_uxtheme.o \
coredll_msw_window.o \
coredll_graphicsd2d.o \
coredll_utilsrt.o \
coredll_helpchm.o \
coredll_helpwin.o \
coredll_automtn.o \
@ -10520,6 +10527,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \
corelib_uxtheme.o \
corelib_msw_window.o \
corelib_graphicsd2d.o \
corelib_utilsrt.o \
corelib_helpchm.o \
corelib_helpwin.o \
corelib_automtn.o \
@ -11222,6 +11230,7 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \
corelib_uxtheme.o \
corelib_msw_window.o \
corelib_graphicsd2d.o \
corelib_utilsrt.o \
corelib_helpchm.o \
corelib_helpwin.o \
corelib_automtn.o \
@ -17982,6 +17991,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp
@ -22791,6 +22803,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp
@ -27660,6 +27675,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@coredll_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(COREDLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp
@ -31044,6 +31062,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_graphicsd2d.o: $(srcdir)/src/msw/graphicsd2d.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/graphicsd2d.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_utilsrt.o: $(srcdir)/src/msw/rt/utilsrt.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/rt/utilsrt.cpp
@COND_TOOLKIT_MSW_USE_GUI_1@corelib_helpchm.o: $(srcdir)/src/msw/helpchm.cpp $(CORELIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/helpchm.cpp

View File

@ -1895,6 +1895,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/uxtheme.cpp
src/msw/window.cpp
src/msw/graphicsd2d.cpp
src/msw/rt/utilsrt.cpp
</set>
<set var="MSW_LOWLEVEL_HDR" hints="files">
wx/msw/nonownedwnd.h
@ -2075,6 +2076,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/msw/toplevel.h
wx/msw/treectrl.h
wx/msw/window.h
wx/msw/rt/utils.h
</set>
<set var="MSW_RSC" hints="files">
<!-- Resources must be installed together with headers: -->

View File

@ -1550,6 +1550,7 @@ MSW_LOWLEVEL_SRC =
src/msw/printwin.cpp
src/msw/region.cpp
src/msw/renderer.cpp
src/msw/rt/utilsrt.cpp
src/msw/settings.cpp
src/msw/textmeasure.cpp
src/msw/tooltip.cpp
@ -1716,6 +1717,7 @@ MSW_HDR =
wx/msw/region.h
wx/msw/rcdefs.h
wx/msw/richmsgdlg.h
wx/msw/rt/utils.h
wx/msw/scrolbar.h
wx/msw/slider.h
wx/msw/spinbutt.h

View File

@ -1824,6 +1824,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_graphicsd2d.obj \
$(OBJS)\monodll_utilsrt.obj \
$(OBJS)\monodll_helpchm.obj \
$(OBJS)\monodll_helpwin.obj \
$(OBJS)\monodll_automtn.obj \
@ -2110,6 +2111,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_graphicsd2d.obj \
$(OBJS)\monodll_utilsrt.obj \
$(OBJS)\monodll_helpchm.obj \
$(OBJS)\monodll_helpwin.obj \
$(OBJS)\monodll_automtn.obj \
@ -2648,6 +2650,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_graphicsd2d.obj \
$(OBJS)\monolib_utilsrt.obj \
$(OBJS)\monolib_helpchm.obj \
$(OBJS)\monolib_helpwin.obj \
$(OBJS)\monolib_automtn.obj \
@ -2934,6 +2937,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_graphicsd2d.obj \
$(OBJS)\monolib_utilsrt.obj \
$(OBJS)\monolib_helpchm.obj \
$(OBJS)\monolib_helpwin.obj \
$(OBJS)\monolib_automtn.obj \
@ -3345,6 +3349,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_graphicsd2d.obj \
$(OBJS)\coredll_utilsrt.obj \
$(OBJS)\coredll_helpchm.obj \
$(OBJS)\coredll_helpwin.obj \
$(OBJS)\coredll_automtn.obj \
@ -3631,6 +3636,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_graphicsd2d.obj \
$(OBJS)\coredll_utilsrt.obj \
$(OBJS)\coredll_helpchm.obj \
$(OBJS)\coredll_helpwin.obj \
$(OBJS)\coredll_automtn.obj \
@ -3913,6 +3919,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_graphicsd2d.obj \
$(OBJS)\corelib_utilsrt.obj \
$(OBJS)\corelib_helpchm.obj \
$(OBJS)\corelib_helpwin.obj \
$(OBJS)\corelib_automtn.obj \
@ -4199,6 +4206,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_graphicsd2d.obj \
$(OBJS)\corelib_utilsrt.obj \
$(OBJS)\corelib_helpchm.obj \
$(OBJS)\corelib_helpwin.obj \
$(OBJS)\corelib_automtn.obj \
@ -7764,6 +7772,11 @@ $(OBJS)\monodll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp
@ -10279,6 +10292,11 @@ $(OBJS)\monolib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp
@ -12728,6 +12746,11 @@ $(OBJS)\coredll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp
@ -14197,6 +14220,11 @@ $(OBJS)\corelib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp

View File

@ -1843,6 +1843,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uxtheme.o \
$(OBJS)\monodll_window.o \
$(OBJS)\monodll_graphicsd2d.o \
$(OBJS)\monodll_utilsrt.o \
$(OBJS)\monodll_helpchm.o \
$(OBJS)\monodll_helpwin.o \
$(OBJS)\monodll_automtn.o \
@ -2131,6 +2132,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uxtheme.o \
$(OBJS)\monodll_window.o \
$(OBJS)\monodll_graphicsd2d.o \
$(OBJS)\monodll_utilsrt.o \
$(OBJS)\monodll_helpchm.o \
$(OBJS)\monodll_helpwin.o \
$(OBJS)\monodll_automtn.o \
@ -2673,6 +2675,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uxtheme.o \
$(OBJS)\monolib_window.o \
$(OBJS)\monolib_graphicsd2d.o \
$(OBJS)\monolib_utilsrt.o \
$(OBJS)\monolib_helpchm.o \
$(OBJS)\monolib_helpwin.o \
$(OBJS)\monolib_automtn.o \
@ -2961,6 +2964,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uxtheme.o \
$(OBJS)\monolib_window.o \
$(OBJS)\monolib_graphicsd2d.o \
$(OBJS)\monolib_utilsrt.o \
$(OBJS)\monolib_helpchm.o \
$(OBJS)\monolib_helpwin.o \
$(OBJS)\monolib_automtn.o \
@ -3386,6 +3390,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uxtheme.o \
$(OBJS)\coredll_window.o \
$(OBJS)\coredll_graphicsd2d.o \
$(OBJS)\coredll_utilsrt.o \
$(OBJS)\coredll_helpchm.o \
$(OBJS)\coredll_helpwin.o \
$(OBJS)\coredll_automtn.o \
@ -3674,6 +3679,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uxtheme.o \
$(OBJS)\coredll_window.o \
$(OBJS)\coredll_graphicsd2d.o \
$(OBJS)\coredll_utilsrt.o \
$(OBJS)\coredll_helpchm.o \
$(OBJS)\coredll_helpwin.o \
$(OBJS)\coredll_automtn.o \
@ -3962,6 +3968,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uxtheme.o \
$(OBJS)\corelib_window.o \
$(OBJS)\corelib_graphicsd2d.o \
$(OBJS)\corelib_utilsrt.o \
$(OBJS)\corelib_helpchm.o \
$(OBJS)\corelib_helpwin.o \
$(OBJS)\corelib_automtn.o \
@ -4250,6 +4257,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uxtheme.o \
$(OBJS)\corelib_window.o \
$(OBJS)\corelib_graphicsd2d.o \
$(OBJS)\corelib_utilsrt.o \
$(OBJS)\corelib_helpchm.o \
$(OBJS)\corelib_helpwin.o \
$(OBJS)\corelib_automtn.o \
@ -7939,6 +7947,11 @@ $(OBJS)\monodll_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_utilsrt.o: ../../src/msw/rt/utilsrt.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_helpchm.o: ../../src/msw/helpchm.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -10454,6 +10467,11 @@ $(OBJS)\monolib_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_utilsrt.o: ../../src/msw/rt/utilsrt.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_helpchm.o: ../../src/msw/helpchm.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -12903,6 +12921,11 @@ $(OBJS)\coredll_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_utilsrt.o: ../../src/msw/rt/utilsrt.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_helpchm.o: ../../src/msw/helpchm.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@ -14372,6 +14395,11 @@ $(OBJS)\corelib_graphicsd2d.o: ../../src/msw/graphicsd2d.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_utilsrt.o: ../../src/msw/rt/utilsrt.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_helpchm.o: ../../src/msw/helpchm.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -2124,6 +2124,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_graphicsd2d.obj \
$(OBJS)\monodll_utilsrt.obj \
$(OBJS)\monodll_helpchm.obj \
$(OBJS)\monodll_helpwin.obj \
$(OBJS)\monodll_automtn.obj \
@ -2410,6 +2411,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_uxtheme.obj \
$(OBJS)\monodll_window.obj \
$(OBJS)\monodll_graphicsd2d.obj \
$(OBJS)\monodll_utilsrt.obj \
$(OBJS)\monodll_helpchm.obj \
$(OBJS)\monodll_helpwin.obj \
$(OBJS)\monodll_automtn.obj \
@ -2954,6 +2956,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_graphicsd2d.obj \
$(OBJS)\monolib_utilsrt.obj \
$(OBJS)\monolib_helpchm.obj \
$(OBJS)\monolib_helpwin.obj \
$(OBJS)\monolib_automtn.obj \
@ -3240,6 +3243,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_uxtheme.obj \
$(OBJS)\monolib_window.obj \
$(OBJS)\monolib_graphicsd2d.obj \
$(OBJS)\monolib_utilsrt.obj \
$(OBJS)\monolib_helpchm.obj \
$(OBJS)\monolib_helpwin.obj \
$(OBJS)\monolib_automtn.obj \
@ -3717,6 +3721,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_graphicsd2d.obj \
$(OBJS)\coredll_utilsrt.obj \
$(OBJS)\coredll_helpchm.obj \
$(OBJS)\coredll_helpwin.obj \
$(OBJS)\coredll_automtn.obj \
@ -4003,6 +4008,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_uxtheme.obj \
$(OBJS)\coredll_window.obj \
$(OBJS)\coredll_graphicsd2d.obj \
$(OBJS)\coredll_utilsrt.obj \
$(OBJS)\coredll_helpchm.obj \
$(OBJS)\coredll_helpwin.obj \
$(OBJS)\coredll_automtn.obj \
@ -4291,6 +4297,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_graphicsd2d.obj \
$(OBJS)\corelib_utilsrt.obj \
$(OBJS)\corelib_helpchm.obj \
$(OBJS)\corelib_helpwin.obj \
$(OBJS)\corelib_automtn.obj \
@ -4577,6 +4584,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_uxtheme.obj \
$(OBJS)\corelib_window.obj \
$(OBJS)\corelib_graphicsd2d.obj \
$(OBJS)\corelib_utilsrt.obj \
$(OBJS)\corelib_helpchm.obj \
$(OBJS)\corelib_helpwin.obj \
$(OBJS)\corelib_automtn.obj \
@ -8456,6 +8464,11 @@ $(OBJS)\monodll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp
@ -10971,6 +10984,11 @@ $(OBJS)\monolib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp
@ -13420,6 +13438,11 @@ $(OBJS)\coredll_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\helpchm.cpp
@ -14889,6 +14912,11 @@ $(OBJS)\corelib_graphicsd2d.obj: ..\..\src\msw\graphicsd2d.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\graphicsd2d.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_utilsrt.obj: ..\..\src\msw\rt\utilsrt.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\rt\utilsrt.cpp
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_helpchm.obj: ..\..\src\msw\helpchm.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\helpchm.cpp

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -1006,6 +1006,7 @@
<ClCompile Include="..\..\src\generic\vscroll.cpp" />
<ClCompile Include="..\..\src\xrc\xmlreshandler.cpp" />
<ClCompile Include="..\..\src\generic\collheaderctrlg.cpp" />
<ClCompile Include="..\..\src\msw\rt\utilsrt.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc">
@ -1377,6 +1378,7 @@
<ClInclude Include="..\..\include\wx\msw\ole\safearray.h" />
<ClInclude Include="..\..\include\wx\collheaderctrl.h" />
<ClInclude Include="..\..\include\wx\generic\collheaderctrl.h" />
<ClInclude Include="..\..\include\wx\msw\rt\utils.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -813,6 +813,9 @@
<ClCompile Include="..\..\src\msw\richmsgdlg.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\msw\rt\utilsrt.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\msw\scrolbar.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
@ -1606,6 +1609,9 @@
<ClInclude Include="..\..\include\wx\msw\richmsgdlg.h">
<Filter>MSW Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\msw\rt\utils.h">
<Filter>MSW Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\msw\scrolbar.h">
<Filter>MSW Headers</Filter>
</ClInclude>

View File

@ -1051,6 +1051,9 @@
<File
RelativePath="..\..\src\msw\window.cpp">
</File>
<File
RelativePath="..\..\src\msw\rt\utilsrt.cpp">
</File>
</Filter>
<Filter
Name="Generic Sources"
@ -1634,6 +1637,9 @@
<File
RelativePath="..\..\include\wx\msw\window.h">
</File>
<File
RelativePath="..\..\include\wx\msw\rt\utils.h">
</File>
</Filter>
<Filter
Name="Generic Headers"

View File

@ -1814,6 +1814,10 @@
RelativePath="..\..\src\msw\window.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\rt\utilsrt.cpp"
>
</File>
</Filter>
<Filter
Name="Generic Sources"
@ -2681,6 +2685,10 @@
RelativePath="..\..\include\wx\msw\window.h"
>
</File>
<File
RelativePath="..\..\include\wx\msw\rt\utils.h"
>
</File>
</Filter>
<Filter
Name="Generic Headers"

View File

@ -1810,6 +1810,10 @@
RelativePath="..\..\src\msw\window.cpp"
>
</File>
<File
RelativePath="..\..\src\msw\rt\utilsrt.cpp"
>
</File>
</Filter>
<Filter
Name="Generic Sources"
@ -2677,6 +2681,10 @@
RelativePath="..\..\include\wx\msw\window.h"
>
</File>
<File
RelativePath="..\..\include\wx\msw\rt\utils.h"
>
</File>
</Filter>
<Filter
Name="Generic Headers"

View File

@ -346,6 +346,7 @@ compilers. See also wxUSE_NO_MANIFEST.}
@itemdef{wxUSE_VC_CRTDBG, See wx/msw/msvcrt.h file.}
@itemdef{wxUSE_UXTHEME, Enable support for XP themes.}
@itemdef{wxUSE_WIN_METAFILES_ALWAYS, Use wxMetaFile even when wxUSE_ENH_METAFILE=1.}
@itemdef{wxUSE_WINRT, Enable WinRT support.}
@itemdef{wxUSE_WXDIB, Use wxDIB class.}
@endDefList

View File

@ -1553,6 +1553,19 @@
// Recommended setting: 1, required by wxMediaCtrl
#define wxUSE_ACTIVEX 1
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0
#endif
// wxDC caching implementation
#define wxUSE_DC_CACHEING 1

View File

@ -22,6 +22,14 @@
# endif
#endif /* !defined(wxUSE_ACTIVEX) */
#ifndef wxUSE_WINRT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WINRT must be defined."
# else
# define wxUSE_WINRT 0
# endif
#endif /* !defined(wxUSE_ACTIVEX) */
#ifndef wxUSE_CRASHREPORT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CRASHREPORT must be defined."

84
include/wx/msw/rt/utils.h Normal file
View File

@ -0,0 +1,84 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/rt/utils.h
// Purpose: Windows Runtime Objects helper functions and objects
// Author: Tobias Taschner
// Created: 2015-09-05
// Copyright: (c) 2015 wxWidgets development team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_RTUTILS_H
#define _WX_MSW_RTUTILS_H
#include "wx/defs.h"
#if wxUSE_WINRT
#include "wx/string.h"
#include "wx/msw/wrapwin.h"
#include <winstring.h>
namespace wxWinRT
{
bool WXDLLIMPEXP_CORE IsAvailable();
bool WXDLLIMPEXP_CORE Initialize();
void WXDLLIMPEXP_CORE Uninitialize();
bool WXDLLIMPEXP_CORE GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory);
// RAII class initializing WinRT in its ctor and undoing it in its dtor.
class WXDLLIMPEXP_CORE Initializer
{
public:
Initializer()
: m_ok(Initialize())
{
}
bool IsOk() const
{
return m_ok;
}
~Initializer()
{
if (m_ok)
Uninitialize();
}
private:
const bool m_ok;
wxDECLARE_NO_COPY_CLASS(Initializer);
};
// Simple class to convert wxString to HSTRING
// This just wraps a reference to the wxString object,
// which needs a life time greater than the TempStringRef object
class WXDLLIMPEXP_CORE TempStringRef
{
public:
HSTRING Get() const { return m_hstring; }
operator HSTRING() const { return m_hstring; };
static const TempStringRef Make(const wxString &str);
private:
TempStringRef(const wxString &str);
HSTRING m_hstring;
HSTRING_HEADER m_header;
wxDECLARE_NO_COPY_CLASS(TempStringRef);
};
} // namespace wxWinRT
#endif // wxUSE_WINRT
#endif // _WX_MSW_RTUTILS_H

View File

@ -1553,6 +1553,19 @@
// Recommended setting: 1, required by wxMediaCtrl
#define wxUSE_ACTIVEX 1
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0
#endif
// wxDC caching implementation
#define wxUSE_DC_CACHEING 1

View File

@ -65,6 +65,19 @@
// Recommended setting: 1, required by wxMediaCtrl
#define wxUSE_ACTIVEX 1
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0
#endif
// wxDC caching implementation
#define wxUSE_DC_CACHEING 1

View File

@ -653,6 +653,12 @@
#define wxUSE_ACTIVEX 0
#if defined(_MSC_VER) && _MSC_VER >= 1700
#define wxUSE_WINRT 0
#else
#define wxUSE_WINRT 0
#endif
#define wxUSE_DC_CACHEING 0
#define wxUSE_WXDIB 0

259
src/msw/rt/utilsrt.cpp Normal file
View File

@ -0,0 +1,259 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/msw/rt/utilsrt.cpp
// Purpose: Windows Runtime Objects helper functions and objects
// Author: Tobias Taschner
// Created: 2015-09-05
// Copyright: (c) 2015 wxWidgets development team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if defined(__BORLANDC__)
#pragma hdrstop
#endif
#include "wx/msw/rt/utils.h"
#if wxUSE_WINRT
#include <roapi.h>
#include "wx/dynlib.h"
#include "wx/utils.h"
#include "wx/module.h"
// Core function typedefs
typedef HRESULT (__stdcall *PFNWXROINITIALIZE)(RO_INIT_TYPE initType);
typedef void (__stdcall *PFNWXROUNINITIALIZE)();
typedef HRESULT (__stdcall *PFNWXROGETACTIVATIONFACTORY)(
HSTRING activatableClassId, REFIID iid, void ** factory);
// String function typedefs
typedef HRESULT (__stdcall *PFNWXWINDOWSCREATESTRINGREFERENCE)(
PCWSTR sourceString,
UINT32 length,
HSTRING_HEADER * hstringHeader,
HSTRING * string
);
typedef HRESULT (__stdcall *PFNWXWINDOWSDELETESTRING)(HSTRING string);
namespace wxWinRT
{
//
// RTCore
//
class RTCore
{
public:
static RTCore& Get()
{
if ( ms_isAvailable == -1 )
{
if ( !ms_rtcore.Initialize() )
{
ms_isAvailable = 0;
}
else
ms_isAvailable = 1;
}
return ms_rtcore;
}
static bool IsAvailable()
{
if (ms_isAvailable == -1)
Get();
return (ms_isAvailable == 1);
}
PFNWXROINITIALIZE RoInitialize;
PFNWXROUNINITIALIZE RoUninitialize;
PFNWXROGETACTIVATIONFACTORY RoGetActivationFactory;
PFNWXWINDOWSCREATESTRINGREFERENCE WindowsCreateStringReference;
PFNWXWINDOWSDELETESTRING WindowsDeleteString;
bool Initialize()
{
#define RESOLVE_RT_FUNCTION(dll, type, funcname) \
funcname = (type)dll.GetSymbol(wxT(#funcname)); \
if ( !funcname ) \
return false
#define RESOLVE_RTCORE_FUNCTION(type, funcname) \
RESOLVE_RT_FUNCTION(m_dllCore, type, funcname)
#define RESOLVE_RTSTRING_FUNCTION(type, funcname) \
RESOLVE_RT_FUNCTION(m_dllString, type, funcname)
// WinRT is only available in Windows 8 or newer
if (!wxCheckOsVersion(6, 2))
return false;
// Initialize core functions
if (!m_dllCore.Load("api-ms-win-core-winrt-l1-1-0.dll"))
return false;
RESOLVE_RTCORE_FUNCTION(PFNWXROINITIALIZE, RoInitialize);
RESOLVE_RTCORE_FUNCTION(PFNWXROUNINITIALIZE, RoUninitialize);
RESOLVE_RTCORE_FUNCTION(PFNWXROGETACTIVATIONFACTORY, RoGetActivationFactory);
// Initialize string functions
if (!m_dllString.Load("api-ms-win-core-winrt-string-l1-1-0.dll"))
return false;
RESOLVE_RTSTRING_FUNCTION(PFNWXWINDOWSCREATESTRINGREFERENCE, WindowsCreateStringReference);
RESOLVE_RTSTRING_FUNCTION(PFNWXWINDOWSDELETESTRING, WindowsDeleteString);
return true;
#undef RESOLVE_RT_FUNCTION
#undef RESOLVE_RTCORE_FUNCTION
#undef RESOLVE_RTSTRING_FUNCTION
}
void UnloadModules()
{
m_dllCore.Unload();
m_dllString.Unload();
}
static void Uninitalize()
{
if (ms_isAvailable == 1)
{
Get().UnloadModules();
ms_isAvailable = -1;
}
}
private:
RTCore()
{
}
wxDynamicLibrary m_dllCore;
wxDynamicLibrary m_dllString;
static RTCore ms_rtcore;
static int ms_isAvailable;
wxDECLARE_NO_COPY_CLASS(RTCore);
};
RTCore RTCore::ms_rtcore;
int RTCore::ms_isAvailable = -1;
//
// wxWinRT::TempStringRef
//
const TempStringRef TempStringRef::Make(const wxString &str)
{
return TempStringRef(str);
}
TempStringRef::TempStringRef(const wxString &str)
{
if ( !RTCore::IsAvailable() )
wxLogDebug("Can not create string reference without WinRT");
// This creates a fast-pass string which must not be deleted using WindowsDeleteString
HRESULT hr = RTCore::Get().WindowsCreateStringReference(
str.wc_str(), str.length(),
&m_header, &m_hstring);
if ( FAILED(hr) )
wxLogDebug("Could not create string reference %.8x", hr);
}
//
// wrapper functions
//
bool IsAvailable()
{
return RTCore::IsAvailable();
}
bool Initialize()
{
if ( !RTCore::IsAvailable() )
return false;
HRESULT hr = RTCore::Get().RoInitialize(RO_INIT_SINGLETHREADED);
if ( FAILED(hr) )
{
wxLogDebug("RoInitialize failed %.8x", hr);
return false;
}
else
return true;
}
void Uninitialize()
{
if ( !RTCore::IsAvailable() )
return;
RTCore::Get().RoUninitialize();
}
bool GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory)
{
if ( !RTCore::IsAvailable() )
return false;
HRESULT hr = RTCore::Get().RoGetActivationFactory(TempStringRef::Make(activatableClassId), iid, factory);
if ( FAILED(hr) )
{
wxLogDebug("RoGetActivationFactory failed %.8x", hr);
return false;
}
else
return true;
}
// ----------------------------------------------------------------------------
// Module ensuring all global/singleton objects are destroyed on shutdown.
// ----------------------------------------------------------------------------
class RTModule : public wxModule
{
public:
RTModule()
{
}
virtual bool OnInit() wxOVERRIDE
{
return true;
}
virtual void OnExit() wxOVERRIDE
{
RTCore::Uninitalize();
}
private:
wxDECLARE_DYNAMIC_CLASS(RTModule);
};
wxIMPLEMENT_DYNAMIC_CLASS(RTModule, wxModule);
} // namespace wxWinRT
#endif // wxUSE_WINRT