

If ( MSWordVersion < 11 ) // MS Word 2002 (Office XP) or older Throw wxString::Format(_("Could not obtain MS Word version (%s)."), MSWordVersionStr) If ( !MSWordVersionStr.ToCDouble(&MSWordVersion) ) // should never happen WxString MSWordVersionStr = application.GetProperty("Version") Throw wxString::Format(_("Failed to open file %s."), docFileName) ĭocument.SetDispatchPtr((WXIDISPATCH*)docVariant.GetVoidPtr()) Throw wxString(_("Failed to obtain Word.Documents property.")) ĭocVariant = documents.CallMethod("Open", docFileName, WxAutomationObject document((WXIDISPATCH*)docVariant.GetVoidPtr()) īool saved = document.GetProperty("Saved") ĭocument.CallMethod("Close", wdDoNotSaveChanges) ĮrrorMsg.Printf(_("Failed to save file %s."), RTFFileName) as these are not suitable for the end user to seeĪpplication.CreateInstance("Word.Application") ĮrrorMsg = _("Failed to create MS Word application instance.") Īpplication.PutProperty("DisplayAlerts", false) Īpplication.PutProperty("Visible", false) Īpplication.GetObject(documents, "Documents") ĮrrorMsg = _("Failed to obtain Word.Documents property.") ĭocVariant = documents.CallMethod("Open",įalse, // do not show conversion dialog if necessary (should never be needed for MS Word document)ĮrrorMsg.Printf(_("Failed to open file %s."), docFileName) in the release mode suppress possible LogErrors() produced by wxAutomationObject WxCHECK( docFileName.IsSameAs(RTFFileName, false) = false, false ) use at your own risk).Code: Select all bool ConvertDocToRTF(const wxString& docFileName, const wxString& RTFFileName, wxString& errorMsg)

WXWIDGETS DOC CODE
Note: This code makes extensive use of the Object Manager and has very specific build requirements - both of which are difficult to configure correctly and neither of which will be documented in the near future (i.e. The Genome Workbench project homepage has links for downloading various binaries and the source code. It also uses DialogBlocks as a GUI RAD development tool. The core framework offers a set of widget extensions and signalling libraries on top of wxWidgets. The Genome Workbench project has developed an advanced wxWidgets-based GUI framework - somewhat skewed to dealing with NCBI ASN.1 data model representations. This approach currently may not be appropriate for projects other than the Genome Workbench due to its complexity. Please see the FOX website for further information.

This approach is used in NCBI by the taskedit application. There is an extremely rich set of layout managers, which is very flexible and fast.

The API is convenient and consistent, with a complete set of widgets. not a native look-and-feel).įOX is very fast, with compact executables. This approach is appropriate for projects requiring uniform behavior across platforms (i.e. Please see the wxWidgets and OpenGL websites for further information. This approach is used in NCBI by the Cn3D application, and the Genome Workbench application is based on that too. Also, its installations are maintained in NCBI for a variety of OS’s. It additionally offers substantial support for OpenGL. It offers a GUI builder, support for automated code generation, and a carefully designed event model that makes it a much more capable solution if your application needs extend beyond a dialog-based application with multiple controls. WxWidgets has a heavier API than FOX, but is not more resource intensive (it uses the underlying system’s native rendering toolkit). This approach is appropriate for projects requiring complex GUIs with rich user interactivity and layered event models. Using the Genome Workbench wxWidgets-based GUI framework Using wxWidgets (for GUI) and OpenGL (for graphics) The following approaches to developing GUI applications have been proved to work reasonably well:
