I have some callback method that set on my queue some bitmap.
This callback is called every 3 millisecond.
What i mean is that my queue will be fill up with a new bitmap every 3 Millisecond.
I trying to get the first picture ( this is queue ... ) and show it on pictureBox - but i get some "external error " and i don't understand why.
public delegate void UpdateBitmapCallback( IntPtr img );
private void CallBack( object sender, IntPtr e )
{
lock( IncomingBmp )
{
IncomingBmp.Enqueue ( e );
if( IncomingBmp.Count > 10)
{
UpdateBitmap( IncomingBmp.Dequeue() );
}
}
}
private void UpdateBitmap( IntPtr img )
{
if( this.pictureBox1.InvokeRequired == true )
{
UpdateBitmapCallback p = new UpdateBitmapCallback( UpdateBitmap );
this.Invoke( p, img );
}
else
{
this.pictureBox1.Image = Image.FromHbitmap( img );
}
}