X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d7dafc91ad68448a481b78df798a7bc85a92a60..81c9effa8462662263c3b4eac2cfae1ef5caae2c:/samples/oleauto/oleauto.cpp?ds=sidebyside diff --git a/samples/oleauto/oleauto.cpp b/samples/oleauto/oleauto.cpp index 05e9da16ad..1c745b8519 100644 --- a/samples/oleauto/oleauto.cpp +++ b/samples/oleauto/oleauto.cpp @@ -40,11 +40,15 @@ #error "Sorry, this sample works under Windows only." #endif +#ifdef __WATCOMC__ +#error "Sorry, Watcom C++ does not support wxAutomationObject." +#endif + // ---------------------------------------------------------------------------- // ressources // ---------------------------------------------------------------------------- // the application icon -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) #include "mondrian.xpm" #endif @@ -197,24 +201,26 @@ void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event)) { wxMessageBox("Please ensure Excel is running, then press OK.\nThe active cell should then say 'wxWindows automation test!' in bold."); - wxAutomationObject excelObject, rangeObject; - if (!excelObject.GetInstance("Excel.Application")) - { + wxAutomationObject excelObject, rangeObject; + if (!excelObject.GetInstance("Excel.Application")) + { if (!excelObject.CreateInstance("Excel.Application")) { - wxMessageBox("Could not create Excel object."); - return; + wxMessageBox("Could not create Excel object."); + return; } - } - if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!")) - { - wxMessageBox("Could not set active cell value."); - return; - } - if (!excelObject.PutProperty("ActiveCell.Font.Bold", (bool) TRUE)) - { - wxMessageBox("Could not put Bold property to active cell."); - return; - } + } + if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!")) + { + wxMessageBox("Could not set active cell value."); + return; + } +#ifdef HAVE_BOOL + if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant((bool) TRUE)) ) + { + wxMessageBox("Could not put Bold property to active cell."); + return; + } +#endif }