none
IMAPI: Issue with UpdateEventHandler not firing with a simple ISO write RRS feed

  • Question

  • We have a simple command line prototype, which burns a ISO image.  The problem is that we are not receiving any Update events. 

    There are a few posts about the Update event not firing, which suggest setting the "Make assembly COM-Visible" flag to checked in the project's assembly information. This failed to help us in our situation.  

    Our application's burn CD method and Update event registration is as follows:

                         

    private static void BurnISO(string aFilePath, string aDriveID)
    {
        MsftDiscRecorder2 wDiscRecorder = new MsftDiscRecorder2();
        MsftDiscFormat2Data wDiscFormat = new MsftDiscFormat2Data();

        wDiscRecorder.InitializeDiscRecorder(aDriveID);            
        wDiscFormat.Recorder = wDiscRecorder;

        try
        {
            wDiscFormat.ForceMediaToBeClosed = true;
            wDiscFormat.ClientName = "ClientName";

            IMAPI2.IStream stream = null;
            SHCreateStreamOnFile(aFilePath, STGM_READ, ref stream);

            wDiscFormat.Update += new DDiscFormat2DataEvents_UpdateEventHandler(discFormatData_Update);
            wDiscFormat.Write(stream);               
        }
        catch (COMException e)
        {
           ... 
        }
        finally
        {
            Marshal.ReleaseComObject(wDiscFormat);
            Marshal.ReleaseComObject(wDiscRecorder);
        }
    }

    public static void discFormatData_Update(object sender, object progress)
    {
        Console.WriteLine("update event fired");
    }

    Thanks,

    Monday, March 17, 2014 2:00 PM

Answers