Object: Application
The Application object is the only object that you must create (using new). You retrieve all other objects by assigning interfaces.
Refer to the following examples:
• Managed code:
VB,
C#, and
C++ using
ApplicationCreator
Methods
• Activate()—Brings the PTC Mathcad Prime window to the foreground and activates it.
• CloseAll(Ptc.MathcadPrime.Automation.SaveOption)—Closes all open worksheets in PTC Mathcad Prime.
The special behavior for any new and unmodified worksheet:
◦ Worksheet is closed without prompting the user, even if the saveOption is spPromptToSaveChanges.
◦ Worksheet is closed without saving, even if the saveOption is spSaveChanges.
Use this method to create the WorksheetReadonlyOptions object to pass it as an OpenEx(String, WorksheetReadonlyOptions) argument.
• GetVersion()—Gets the version of PTC Mathcad Prime.
Returns:
String
• InitializeEvents2(eventHandler,SubscribeAll)
eventHandler is an object provided by the client that implements the
IMathcadPrimeEvents2 interface.
SubscribeAll is a boolean value:
◦ True—Subscribe to all events when initializing.
◦ False—Do not subscribe to events when initializing. You can subscribe to events later, using the
SubscribeEvent function.
Returns:
S_OK—The COM Events Sink initialization succeeded.
S_FALSE—The COM Events Sink initialization failed.
• Open(filename)
filename (string)—The path and file name of a PTC Mathcad Prime worksheet. If filename is null or empty, open a new worksheet.
• OpenEx(String,WorksheetReadonlyOptions)—Opens the worksheet in PTC Mathcad Prime from path and sets the WorksheetReadonlyOptions when opening. If String is NULL or EMPTY STRING then opens a new worksheet.
String is the path to the worksheet to be opened. If the path is NULL or EMPTY STRING, open a new worksheet.
WorksheetReadonlyOption is the object that will be used to set the
Readonly options for Worksheet which will be opened.
Returns:
The Worksheet Object associated with the worksheet to be opened, or Null if an error occurred while retrieving an object instance.
• Quit()—Closes this PTC Mathcad Prime application if possible.
The Quit() behavior is defined as follows:
◦ If there are live connections, then PTC Mathcad Prime keeps running.
◦ If there are no alive connections, but still open any non-Untitled worksheet (or Untitled but modified and non-saved), then PTC Mathcad Prime keeps running.
◦ If there are no alive connections and only non-modified Untitled documents are open, then PTC Mathcad Prime is closed.
MathcadPrimeEvents is the event defined in MathcadPrimeEvents enumeration to be subscribed.
Returns:
S_OK—Successfully subscribed to event.
S_FALSE—Failed to subscribe to event (including case of wrong event)
• UnsubscribeEvent(MathcadPrimeEvents)—Unsubscribe to the MathcadPrimeEvents event by name.
MathcadPrimeEvents is the event defined in MathcadPrimeEvents enumeration to be unsubscribed.
Returns:
S_OK—Successfully unsubscribed from event.
S_FALSE—Failed to unsubscribe from event (including case of wrong event)
Properties
• ActiveWorksheet—Gets the active PTC Mathcad Prime worksheet.
Returns:
The MathcadPrimeWorksheet object associated with an active worksheet, or Null if an error occurred while retrieving an object instance.
• Visible—Sets/Gets the PTC Mathcad Prime window visibility.