Creating Your Own BMC AppSight Black Box

Version 4


    BMC AppSight includes a Black Box COM API to support customers who would like to embed the BMC AppSight Black Box into their application.


    The Black Box COM API enables you to control the settings and execution of the Black Box object from within your code. For example, you can write functions in your application to start the Black Box, load a recording profile and start recording. The following example demonstrates how this API can be used to create a simple Black Box that resides in the system tray and allows the end user to change a recording profile and save a log file.


    The custom Black Box sample requires having the Black Box COM API installed.  The Black Box COM.exe will install the API.


    1) From the BMC Support home page (
    1a) Click the link titled "Product Downloads, Patches and Fixes"
    2) From the "Product Downloads, Patches, and Fixes" page
    2a) Click "Product Downloads (EPD)"

    Running myBBx

    Double-click on the myBBx.exe application to run the Black Box wrapper. The Black Box icon will be displayed in the system tray. If a default.rpr is available in the same folder as myBBx.exe it will be loaded as the default profile on initialization and a balloon tooltip will be displayed to the user with the recording profile that is loaded:


    The default.rpr included in this example contains WINWORD.exe in the traced processes list.

    Using myBBx

    Once the Black Box is initialized the user can right-click on the Black Box icon in the system tray and either: Set a different recording profile, save the log file or close the Black Box from the context menu:



    The Black Box wrapper uses balloon tooltips to display the different notification and status messages to the end user. The Black Box will notify to the user when a process is being traced by the Black Box or when the Black Box stopped tracing the process:

    image3.jpg                                image4.jpg

    Customizing This Sample


    The Black Box wrapper is implemented in frmBBx.cs. The following global variables can be set to customize the Black Box:

    // Title / Name of your Black Box
    private const string m_BlackBoxTitle = "myBBx";
    //Timeout for the balloon tooltip
    private const int m_BalloonTimeout = 500; 
    //number of frames for the animated Black Box Icon
    private const int m_IconFrames = 7;


    Once all the wrapper initialization is completed, the StartBlackBox function is called and the Black Box is started with the default profile (if available):


    string defaultRPR = System.AppDomain.CurrentDomain.BaseDirectory + "\\default.rpr";
    BBx = new BBXCOMSERVERLib.CoBlackBoxClass();
    if (File.Exists(defaultRPR))
       sysTray.ShowBalloonTip("Set a recording profile to start a trace", NotifyIconBalloonIconFlags.NIIF_INFO, 
                                         m_BlackBoxTitle, m_BalloonTimeout);

    When the end user selects the Set Profile option from the context menu, the SetRPR function is called:


    openFileDialog.Filter = "Black Box Recording Profile (*.rpr)|*.rpr";
    if(openFileDialog.ShowDialog() == DialogResult.OK)


    When the end user selects the Save Log option from the context menu, the SaveLog function is called:


    saveFileDialog.Filter = "Black Box Log Files (*.asl)|*.asl";
    if(saveFileDialog.ShowDialog() == DialogResult.OK)
       sysTray.ShowBalloonTip("Black Box log file saved:" + Environment.NewLine + saveFileDialog.FileName, 
                                         NotifyIconBalloonIconFlags.NIIF_INFO, m_BlackBoxTitle, m_BalloonTimeout);