Click here to Skip to main content
15,885,278 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Matt T Heffron17-May-16 14:51
professionalMatt T Heffron17-May-16 14:51 
AnswerRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Gerry Schmitz19-May-16 6:41
mveGerry Schmitz19-May-16 6:41 
QuestionHow record behavior of a process in windows? Pin
saeedmir17-May-16 7:26
saeedmir17-May-16 7:26 
AnswerRe: How record behavior of a process in windows? Pin
BillWoodruff17-May-16 7:46
professionalBillWoodruff17-May-16 7:46 
GeneralRe: How record behavior of a process in windows? Pin
saeedmir17-May-16 7:52
saeedmir17-May-16 7:52 
GeneralRe: How record behavior of a process in windows? Pin
Eddy Vluggen17-May-16 8:03
professionalEddy Vluggen17-May-16 8:03 
Rant[REPOST] How record behavior of a process in windows? Pin
Richard Deeming17-May-16 7:49
mveRichard Deeming17-May-16 7:49 
QuestionObject is currently in use elsewhere C# - System.Drawing Exception Pin
Django_Untaken16-May-16 21:56
Django_Untaken16-May-16 21:56 
Hello there. I am using FrameGrabber to get me the images which I then use in MainForm - 2 self developed classes. But it gives me the said exception. Here is the relevant code for both classes.
------------ FrameGrabber ----------------

  static object m_obj = new object()
  Bitmap CurrentBitmap = null;

   // setting the member variable......... this is accessed in MainForm
   public Bitmap CurrentFrame
   {
       get
       {
           Bitmap bmp = null;
           try
           {
               lock (m_obj)
               {
                   if (CurrentBitmap != null)
                       bmp = new Bitmap(CurrentBitmap);
               }
           }
           catch (Exception ex)
           {
       MessageBox.Show(ex.Message);
           }
           return bmp;
       }
   }

 // whenever an event is raised with new image - i set the CurrentBitmap
  private void OnNewFrame(Frame frm)
  {
       Bitmap current_bitmap = new Bitmap(frm.Image);

       lock (m_obj)
       {
           if (current_bitmap != null)
           {
               if (DateTime.Now.Subtract(LastFrameSendTime).TotalMilliseconds >= FrameDelay)
               {
                   LastFrameSendTime = DateTime.Now;
                   CurrentBitmap = new Bitmap(current_bitmap);
               }
           }
       }
  }

And here is the code for MainForm.
------------ MainForm ----------------

                   bool isplaying = objFrameGrabber.Player.IsPlaying;
                   while ((isplaying))
                   {
                       Bitmap current_frame = objFrameGrabber.CurrentFrame;
                       while ((current_frame == null)
                       {
                           System.Threading.Thread.Sleep(10);
                           current_frame = objFrameGrabber.CurrentFrame;
                       }

                       // AND HERE COMES THE EXCEPTION

                       picLiveVideo.Image = current_frame;
                   }

As you can see, I am using lock in FrameGrabber class. What could be wrong ? (I can provide full stack trace if needed) Thanks for any input.
AnswerRe: Object is currently in use elsewhere C# - System.Drawing Exception Pin
Pete O'Hanlon16-May-16 23:09
mvePete O'Hanlon16-May-16 23:09 
Question[Updated] AnyCPU and exposing functionality via COM Pin
Matt T Heffron16-May-16 13:51
professionalMatt T Heffron16-May-16 13:51 
AnswerRe: AnyCPU and exposing functionality via COM Pin
Garth J Lancaster16-May-16 16:28
professionalGarth J Lancaster16-May-16 16:28 
GeneralRe: AnyCPU and exposing functionality via COM Pin
Matt T Heffron17-May-16 7:20
professionalMatt T Heffron17-May-16 7:20 
Questionsearch quickly Pin
Denis Tarasov16-May-16 13:26
Denis Tarasov16-May-16 13:26 
AnswerRe: search quickly Pin
OriginalGriff16-May-16 19:27
mveOriginalGriff16-May-16 19:27 
QuestionHow to create http client server application in C#? Pin
Jaimesh.241115-May-16 21:23
Jaimesh.241115-May-16 21:23 
AnswerRe: How to create http client server application in C#? Pin
Richard MacCutchan15-May-16 22:31
mveRichard MacCutchan15-May-16 22:31 
QuestionHow can i protect c# .net Code to be decompile? Pin
Member 1243103913-May-16 6:39
Member 1243103913-May-16 6:39 
AnswerRe: How can i protect c# .net Code to be decompile? Pin
Eddy Vluggen13-May-16 7:12
professionalEddy Vluggen13-May-16 7:12 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Nathan Minier14-May-16 3:02
professionalNathan Minier14-May-16 3:02 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Eddy Vluggen14-May-16 5:12
professionalEddy Vluggen14-May-16 5:12 
AnswerRe: How can i protect c# .net Code to be decompile? Pin
BillWoodruff13-May-16 8:52
professionalBillWoodruff13-May-16 8:52 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Sascha Lefèvre13-May-16 10:13
professionalSascha Lefèvre13-May-16 10:13 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
BillWoodruff13-May-16 22:26
professionalBillWoodruff13-May-16 22:26 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
PrateekM13-May-16 23:15
PrateekM13-May-16 23:15 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Sascha Lefèvre14-May-16 1:01
professionalSascha Lefèvre14-May-16 1:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.