Fix crash with x86 (#853)

This commit is contained in:
Rudy Huyn 2019-12-06 17:02:46 -08:00 committed by Eric Wong
parent 503831895d
commit 5209084bb0

View File

@ -19,13 +19,18 @@ DEPENDENCY_PROPERTY_INITIALIZATION(MathRichEditBox, MathText);
// TODO remove when Windows 10 version 2004 SDK is adopted // TODO remove when Windows 10 version 2004 SDK is adopted
namespace Windows_2004_Prerelease namespace Windows_2004_Prerelease
{ {
constexpr auto RichEditMathMode_MathOnly = 1; enum RichEditMathMode : int
[uuid("619c20f2-cb3b-4521-981f-2865b1b93f04")] __interface ITextDocument4 : IInspectable
{ {
HRESULT SetMath(HSTRING value); NoMath,
HRESULT GetMath(HSTRING * value); MathOnly,
HRESULT SetMathMode(int32_t mathMode); };
MIDL_INTERFACE("619c20f2-cb3b-4521-981f-2865b1b93f04")
ITextDocument4 : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE SetMath(HSTRING value) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMath(HSTRING * value) = 0;
virtual HRESULT STDMETHODCALLTYPE SetMathMode(RichEditMathMode mathMode) = 0;
}; };
} }
@ -65,7 +70,7 @@ MathRichEditBox::MathRichEditBox()
// TextDocument->SetMathMode(Windows::UI::Text::RichEditMathMode::MathOnly); // TextDocument->SetMathMode(Windows::UI::Text::RichEditMathMode::MathOnly);
Microsoft::WRL::ComPtr<Windows_2004_Prerelease::ITextDocument4> textDocument4; Microsoft::WRL::ComPtr<Windows_2004_Prerelease::ITextDocument4> textDocument4;
reinterpret_cast<IInspectable*>(this->TextDocument)->QueryInterface(IID_PPV_ARGS(&textDocument4)); reinterpret_cast<IInspectable*>(this->TextDocument)->QueryInterface(IID_PPV_ARGS(&textDocument4));
auto hr = textDocument4->SetMathMode(Windows_2004_Prerelease::RichEditMathMode_MathOnly); auto hr = textDocument4->SetMathMode(Windows_2004_Prerelease::RichEditMathMode::MathOnly);
if (FAILED(hr)) if (FAILED(hr))
{ {
throw Exception::CreateException(hr); throw Exception::CreateException(hr);