Altova Authentic 2024 Desktop

In the code snippets below, the methods StartAuthenticDesktop_Click and ShutdownAuthenticDesktop_Click are those assigned to buttons in the AutomateAuthenticDesktop example that, respectively, start up and shut down the application. This example is located in the C# subfolder of the API Examples folder (see the file Form1.cs):

 

 

Windows 7, Windows 8, Windows 10, Windows 11

C:\Users\<usuario>\Documentos\
Altova\Authentic\2024\%APPNAME%>Examples

 

 

You can compile and run the project from within Visual Studio 2012/2013/2015/2017/2019/2022.

 

Starting Authentic Desktop

The following code snippet from the AutomateAuthenticDesktop example shows how to start up the application.

 

  // Handler for the "Start AuthenticDesktop" button

       private void StartAuthenticDesktop_Click(object sender, EventArgs e)

       {

           if (AuthenticDesktop == null)

           {

               Cursor.Current = Cursors.WaitCursor;

 

               // If there is no AuthenticDesktop instance, create one and make it visible.

               AuthenticDesktop = new XMLSpyLib.Application();

               AuthenticDesktop.Visible = true;

 

               Cursor.Current = Cursors.Default;

           }

           else

           {

               // If an instance of Authentic Desktop is already running, make sure it's visible

               if (!AuthenticDesktop.Visible)

                   AuthenticDesktop.Visible = true;

           }

       }

 

Shutting down Authentic Desktop

The following code snippet from the AutomateAuthenticDesktop example shows how to shut down the application.

 

       // Handler for the "Shut down AuthenticDesktop" button

       // Shut down application instance by explicitely releasing the COM object.

       private void shutdownAuthenticDesktop_Click(object sender, EventArgs e)

       {

           if (AuthenticDesktop != null)

           {

               // Allow shut down of AuthenticDesktop by releasing the UI

               AuthenticDesktop.Visible = false;

 

               // Explicitly release the COM object

               try

               {

                   while (System.Runtime.InteropServices.Marshal.ReleaseComObject(AuthenticDesktop) > 0) ;

               }

               finally

               {

                   // Avoid subsequent access to this object.

                   AuthenticDesktop = null;

               }

           }

       }

 

© 2017-2023 Altova GmbH