Results 1 to 4 of 4

Thread: [VB.NET 2003] Thread and CallBack

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    9

    [VB.NET 2003] Thread and CallBack

    Hi,
    I use callkack function for webcam capture (VideoStream).
    A class contains all work for one camera. When callback function is raised, then class raises an event.
    I want to use 2 cameras, so 2 classes instances. The 2 cameras use the same device (Microsoft WDM Image Capture).
    The fact is that my first callback stops when the 2nd one is initialized.
    I could understand this but I'm able to run twice my Exe and both work fine...
    so I think I could have 2 threads and 2 callback in the same Exe, but... I don't find how.
    Any idea?
    Thanks.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: [VB.NET 2003] Thread and CallBack

    Huh? You should show some code. It sounds like you are overwriting your first handler with the second one instead of adding another handler. Look up the help on AddHandler.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    9

    Re: [VB.NET 2003] Thread and CallBack

    Thanks for your answer.
    I 've just solved my problem. I have made cleaner threads...
    Is there a nice way to maintain a thread running?
    I use
    Do
    Application.DoEvents
    Loop Until Condition

    But I not very proud of it...

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: [VB.NET 2003] Thread and CallBack

    Why would you keep a thread running? The way you are doing it will consume a lot of resources. It would be much more efficent if you used a timer although it really depends on what you are using the thread for. What are you using the thread for?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width