Building a Console Application in VB for the Alibre Design API - Finishing Up E-mail
Article Index
Building a Console Application in VB for the Alibre Design API
Getting Started
Create a Visual Basic Project
Referencing the Alibre Design API
Importing Namespaces
Adding Comments
Setting Up Command Line Flags
Reading the Command Line Arguments
Redirecting the Standard Output
Hooking Alibre Design
Looping Through Sessions
Looping Through Configurations
Finishing Up
Resources
All Pages

Finishing Up

At this point we've looped through all the visible sessions and output information about them and their configurations. This is a good time to output the session count we were maintaining and close the file we might have opened back in line 37. We need line 80, though, because we should only try to close the file if we did in fact open it -- otherwise we could get an error.

    If includeCount Then
      Call Console.WriteLine("Session Count: " & sessionCount)
    End If

    If Not outStream Is Nothing Then
      Call outStream.Close()
    End If

Now let's be good citizens and tell Microsoft's .Net Framework that we're finished communicating with another application through COM. Because setting up the COM communication channels takes up some memory in the computer, we can also tell the .Net Framework that it's free to clean up memory we're no longer using.

    ' Clean up a bit...
    Call Marshal.ReleaseComObject(hook)
    Call GC.GetTotalMemory(True)

Finally, we can end the program.

  End Sub

End Module



Last Updated ( Monday, 28 January 2008 16:22 )