Click here to Skip to main content
15,506,209 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Matt T Heffron17-May-16 15:51
professionalMatt T Heffron17-May-16 15:51 
AnswerRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Gerry Schmitz19-May-16 7:41
mveGerry Schmitz19-May-16 7:41 
QuestionHow record behavior of a process in windows? Pin
saeedmir17-May-16 8:26
saeedmir17-May-16 8:26 
AnswerRe: How record behavior of a process in windows? Pin
BillWoodruff17-May-16 8:46
mveBillWoodruff17-May-16 8:46 
GeneralRe: How record behavior of a process in windows? Pin
saeedmir17-May-16 8:52
saeedmir17-May-16 8:52 
GeneralRe: How record behavior of a process in windows? Pin
Eddy Vluggen17-May-16 9:03
professionalEddy Vluggen17-May-16 9:03 
Rant[REPOST] How record behavior of a process in windows? Pin
Richard Deeming17-May-16 8:49
mveRichard Deeming17-May-16 8:49 
QuestionObject is currently in use elsewhere C# - System.Drawing Exception Pin
Django_Untaken16-May-16 22:56
Django_Untaken16-May-16 22: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'Hanlon17-May-16 0:09
mvaPete O'Hanlon17-May-16 0:09 
Question[Updated] AnyCPU and exposing functionality via COM Pin
Matt T Heffron16-May-16 14:51
professionalMatt T Heffron16-May-16 14:51 
AnswerRe: AnyCPU and exposing functionality via COM Pin
Garth J Lancaster16-May-16 17:28
professionalGarth J Lancaster16-May-16 17:28 
GeneralRe: AnyCPU and exposing functionality via COM Pin
Matt T Heffron17-May-16 8:20
professionalMatt T Heffron17-May-16 8:20 
Questionsearch quickly Pin
Denis Tarasov16-May-16 14:26
Denis Tarasov16-May-16 14:26 
AnswerRe: search quickly Pin
OriginalGriff16-May-16 20:27
mveOriginalGriff16-May-16 20:27 
QuestionHow to create http client server application in C#? Pin
Jaimesh.241115-May-16 22:23
Jaimesh.241115-May-16 22:23 
AnswerRe: How to create http client server application in C#? Pin
Richard MacCutchan15-May-16 23:31
mveRichard MacCutchan15-May-16 23:31 
QuestionHow can i protect c# .net Code to be decompile? Pin
Member 1243103913-May-16 7:39
Member 1243103913-May-16 7:39 
AnswerRe: How can i protect c# .net Code to be decompile? Pin
Eddy Vluggen13-May-16 8:12
professionalEddy Vluggen13-May-16 8:12 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Nathan Minier14-May-16 4:02
professionalNathan Minier14-May-16 4:02 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Eddy Vluggen14-May-16 6:12
professionalEddy Vluggen14-May-16 6:12 
AnswerRe: How can i protect c# .net Code to be decompile? Pin
BillWoodruff13-May-16 9:52
mveBillWoodruff13-May-16 9:52 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Sascha Lefèvre13-May-16 11:13
professionalSascha Lefèvre13-May-16 11:13 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
BillWoodruff13-May-16 23:26
mveBillWoodruff13-May-16 23:26 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
PrateekM14-May-16 0:15
PrateekM14-May-16 0:15 
GeneralRe: How can i protect c# .net Code to be decompile? Pin
Sascha Lefèvre14-May-16 2:01
professionalSascha Lefèvre14-May-16 2: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.