how to handle System.Windows.Forms.Axhost+InvalidActiveXState exception
I am developing a program that should read realpla开发者_StackOverflow社区yer file duration and then set it to a timer.Interval , how ever when I debug program there is no errors, but when attemping to get length of file, I get this error : System.Windows.Forms.Axhost+InvalidActiveXState exception
. I am using an assembly called AxRealAudioObjects.dll, its version is 2.0. I remember it worked very well on .NET 2.0 but since the current version of .NET is 4.0 it gives this error. Is the dll damaged or is it something else?
From MSDN, "The exception that is thrown when the ActiveX control is referenced while in an invalid state." In this case, there is nothing you can "do" to "handle" this error; COM/ActiveX is in an unknown state. There is either a bug in your code, a bug in the ActiveX control code, or else. Make sure you are using the ActiveX in a support manner.
Most ActiveX controls have a CreateControl()
method, call that first. if the control does not show after calling CreateControl()
call Refresh()
next
精彩评论