EDN Admin
Well-known member
Hello,
I am working in C# using some system calls to access webcam data. I have code in place that will do so, but only if it is the first time the webcam has been activated since the last system reboot. At the moment, I have a simple window with the
buttons Start, Stop, and Continue. If the program is the first to access the webcam it will display fine. From this state the Stop button also works fine. Continue is really just a copy of Start since it will have been stopped previously
if continue is a valid choice.
After I stop execution, either by using the Stop button or by closing the window or by exiting debug mode, it will not start back up again. The stock Arcsoft webcam software that came with my pc is still able to connect to the camera and display fine
at this point.
This is the Start function excluding error checking:
this.Stop();
// setup a capture window
mCapHwnd = capCreateCaptureWindowA("WebCap", 0, 0, 0, m_Width, m_Height, this.Handle.ToInt32(), 0);
// connect to the capture device
Application.DoEvents();
SendNotifyMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0);
SendNotifyMessage(mCapHwnd, WM_CAP_SET_PREVIEW, 0, 0);
// set the frame number
m_FrameNumber = FrameNum;
// set the timer information
this.timer1.Interval = m_TimeToCapture_milliseconds;
bStopped = false;
this.timer1.Start();
Im thinking its an addressing issue, but Im not sure where. I recorded the handle IDs from the first time accessing the camera and tried to hard code the same values after, but I still got the same message. I havent worked with webcams at
all before this, but it seems to me that
<span style="font-weight:bold SendNotifyMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0);
should connect my window(located at mCapHwnd and displayed within the original message window(start/stop/cont)) to device 0.
When the program is the first to access the cam it turns the cam on(denoted by a green LED), and when stopped the cam is shut off(green LED turns off). Also, when the program first runs and opens the cam, the stock background software opens too(Arcsoft
magic-i visual effects 2). Closing this software and all processes associated with it does not stop the error.
Im not looking for any code, but rather some insight into what happens after that first time? What changes occur within the OS when the webcam is activated and what data can I access to find those changes?
View the full article
I am working in C# using some system calls to access webcam data. I have code in place that will do so, but only if it is the first time the webcam has been activated since the last system reboot. At the moment, I have a simple window with the
buttons Start, Stop, and Continue. If the program is the first to access the webcam it will display fine. From this state the Stop button also works fine. Continue is really just a copy of Start since it will have been stopped previously
if continue is a valid choice.
After I stop execution, either by using the Stop button or by closing the window or by exiting debug mode, it will not start back up again. The stock Arcsoft webcam software that came with my pc is still able to connect to the camera and display fine
at this point.
This is the Start function excluding error checking:
this.Stop();
// setup a capture window
mCapHwnd = capCreateCaptureWindowA("WebCap", 0, 0, 0, m_Width, m_Height, this.Handle.ToInt32(), 0);
// connect to the capture device
Application.DoEvents();
SendNotifyMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0);
SendNotifyMessage(mCapHwnd, WM_CAP_SET_PREVIEW, 0, 0);
// set the frame number
m_FrameNumber = FrameNum;
// set the timer information
this.timer1.Interval = m_TimeToCapture_milliseconds;
bStopped = false;
this.timer1.Start();
Im thinking its an addressing issue, but Im not sure where. I recorded the handle IDs from the first time accessing the camera and tried to hard code the same values after, but I still got the same message. I havent worked with webcams at
all before this, but it seems to me that
<span style="font-weight:bold SendNotifyMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0);
should connect my window(located at mCapHwnd and displayed within the original message window(start/stop/cont)) to device 0.
When the program is the first to access the cam it turns the cam on(denoted by a green LED), and when stopped the cam is shut off(green LED turns off). Also, when the program first runs and opens the cam, the stock background software opens too(Arcsoft
magic-i visual effects 2). Closing this software and all processes associated with it does not stop the error.
Im not looking for any code, but rather some insight into what happens after that first time? What changes occur within the OS when the webcam is activated and what data can I access to find those changes?
View the full article