Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

IMAPI: Issue with UpdateEventHandler not firing with a simple ISO write

$
0
0

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,


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>