EDN Admin
Well-known member
hi all
i am going banana but the addhandler is not doing nothing
i have this code in a BackgroundWorker
recorder.InitializeDiscRecorder(ID)<br/>
Dim ercer As New IMAPI2.MsftDiscFormat2Erase<br/>
ercer = New MsftDiscFormat2Erase()<br/>
ercer.ClientName = "Burn_Erase_M_M_M"<br/>
recorder.AcquireExclusiveAccess(True, "Burn_Erase_M_M_M")<br/>
ercer.Recorder = recorder<br/>
ercer.FullErase = False<br/>
AddHandler ercer.Update, AddressOf ERS
<br/>
Dim eventsGuid As Guid = GetType(DDiscFormat2EraseEvents).GUID<br/>
2735413a-7f64-5b0f-8f00-5d77afbe261e=DDiscFormat2EraseEvents<br/>
ercer.EraseMedia()
RemoveHandler ercer.Update, AddressOf ERS
------------------------------------------------------------
Private Sub ERS (<MarshalAs(UnmanagedType.IDispatch)> ByVal sender As Object,
ByVal elapsedSeconds As Integer,
ByVal estimatedTotalSeconds As Integer)<br/>
Dim percent As Integer = CInt((elapsedSeconds * 100) / estimatedTotalSeconds)<br/>
BK_erase.ReportProgress(percent)<br/>
<br/>
End Sub
----------------------------------------------------------------------------------------------------------------
every thing work fine and it dose the erasing but it dose not report the progress >
for some reason that i am missing the addhandler is not firing
?
------------------------------------------------------------------------------------------------------------------
and this is the call stack
> Burn_Erase_M_M_M.exe!Burn_Erase_M_M_M.Form1.erase_don(Object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) Line 422 Basic<br/>
System.dll!System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(System.ComponentModel.RunWorkerCompletedEventArgs e) + 0x77 bytes <br/>
System.dll!System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(object arg) + 0x31 bytes <br/>
[Native to Managed Transition] <br/>
mscorlib.dll!System.Delegate.DynamicInvokeImpl(object[] args) + 0x76 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(System.Windows.Forms.Control.ThreadMethodEntry tme) + 0x1f1 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj) + 0x63 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallback(System.Windows.Forms.Control.ThreadMethodEntry tme) + 0x92 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks() + 0xe4 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x82b bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x11 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x9f bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x5e bytes <br/>
[Native to Managed Transition] <br/>
[Managed to Native Transition] <br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) + 0x2eb bytes
<br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) + 0x266 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x4a bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context) + 0x18 bytes <br/>
Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() + 0x81 bytes <br/>
Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() + 0x103 bytes <br/>
Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(string[] commandLine) + 0x61 bytes <br/>
[Native to Managed Transition] <br/>
[Managed to Native Transition] <br/>
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x6b bytes <br/>
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x27 bytes <br/>
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes <br/>
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes <br/>
[Native to Managed Transition]
-------------------------------
thanks in advance
View the full article
i am going banana but the addhandler is not doing nothing
i have this code in a BackgroundWorker
recorder.InitializeDiscRecorder(ID)<br/>
Dim ercer As New IMAPI2.MsftDiscFormat2Erase<br/>
ercer = New MsftDiscFormat2Erase()<br/>
ercer.ClientName = "Burn_Erase_M_M_M"<br/>
recorder.AcquireExclusiveAccess(True, "Burn_Erase_M_M_M")<br/>
ercer.Recorder = recorder<br/>
ercer.FullErase = False<br/>
AddHandler ercer.Update, AddressOf ERS
<br/>
Dim eventsGuid As Guid = GetType(DDiscFormat2EraseEvents).GUID<br/>
2735413a-7f64-5b0f-8f00-5d77afbe261e=DDiscFormat2EraseEvents<br/>
ercer.EraseMedia()
RemoveHandler ercer.Update, AddressOf ERS
------------------------------------------------------------
Private Sub ERS (<MarshalAs(UnmanagedType.IDispatch)> ByVal sender As Object,
ByVal elapsedSeconds As Integer,
ByVal estimatedTotalSeconds As Integer)<br/>
Dim percent As Integer = CInt((elapsedSeconds * 100) / estimatedTotalSeconds)<br/>
BK_erase.ReportProgress(percent)<br/>
<br/>
End Sub
----------------------------------------------------------------------------------------------------------------
every thing work fine and it dose the erasing but it dose not report the progress >
for some reason that i am missing the addhandler is not firing
?
------------------------------------------------------------------------------------------------------------------
and this is the call stack
> Burn_Erase_M_M_M.exe!Burn_Erase_M_M_M.Form1.erase_don(Object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) Line 422 Basic<br/>
System.dll!System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(System.ComponentModel.RunWorkerCompletedEventArgs e) + 0x77 bytes <br/>
System.dll!System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(object arg) + 0x31 bytes <br/>
[Native to Managed Transition] <br/>
mscorlib.dll!System.Delegate.DynamicInvokeImpl(object[] args) + 0x76 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(System.Windows.Forms.Control.ThreadMethodEntry tme) + 0x1f1 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj) + 0x63 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallback(System.Windows.Forms.Control.ThreadMethodEntry tme) + 0x92 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks() + 0xe4 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x82b bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x11 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x9f bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x5e bytes <br/>
[Native to Managed Transition] <br/>
[Managed to Native Transition] <br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) + 0x2eb bytes
<br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) + 0x266 bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x4a bytes <br/>
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context) + 0x18 bytes <br/>
Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() + 0x81 bytes <br/>
Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() + 0x103 bytes <br/>
Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(string[] commandLine) + 0x61 bytes <br/>
[Native to Managed Transition] <br/>
[Managed to Native Transition] <br/>
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x6b bytes <br/>
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x27 bytes <br/>
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes <br/>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes <br/>
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes <br/>
[Native to Managed Transition]
-------------------------------
thanks in advance
View the full article