|
I use two webcams in my project and want to switch between them without oppenning UI window . kindly ask to send the code for switching between two cameras .
|
|
|
|
|
Does sending the WM_CAP_DRIVER_CONNECT message not work?
SendMessage(hwndVideo, WM_CAP_DRIVER_CONNECT, camIndex, 0L);
or the macro
capDriverConnect(hwndVideo, camIndex);
What problems are you facing?
|
|
|
|
|
when I put camIndex , nonzero , it doesn't work , but windows recognizes
both of webcams .
|
|
|
|
|
Um. Windows recognizes both webcams as in... they both have VFW drivers? Did you see the webcams listed in the listbox of this application?
|
|
|
|
|
Yes I can choose between two webcams in windows UI dialog .
but as mentioned above when I put the camIndex=1 it doesn't recognize it.
|
|
|
|
|
What windows UI dialog? Is it present in the SelCapDrvDlg in this application?
Set a breakpoint in main.cpp line 199. What are the indexes of the 2 webcams you are interested in?
|
|
|
|
|
it reaches the breakpoint when i=0 and it doesn't reach in i=1
|
|
|
|
|
And there we have it. One of your webcams only has a WDM driver. You would have to write a DirectShow application.
|
|
|
|
|
how can I write a DirectShow program , If you have time , please tell me .
thank you
|
|
|
|
|
If you have VC7+, download and install the latest Platform SDK. Go to http://tmhare.mvps.org/downloads.htm[^] to get the project files for the samples since Microsoft has for some reason stripped it out.
Then go have a look at the PlayCap sample application in "..\Program Files\Microsoft Platform SDK\Samples\Multimedia\DirectShow\Capture\PlayCap"
If you have VC6 though, you would have to grab an old DirectX SDK, maybe 2003 or 2004.
|
|
|
|
|
|
|
I dont Have visual C++ , I just have visual studio .NET and CBuilder And I prefer to write this program in CBuilder .
-- modified at 10:09 Thursday 4th May, 2006
|
|
|
|
|
|
|
i need help on chngin for loop in this file to while loop..plz solve this for me as soon as possible...i trien in many ways but cant...
#include <ctime> <br />
#include <iostream><br />
#include <string><br />
#include <algorithm><br />
#include <fstream><br />
using namespace std;<br />
<br />
time_t tmStart, tmEnd;<br />
<br />
<br />
<br />
void DoStuff()<br />
{<br />
tmStart = time(0);<br />
ifstream fin;<br />
fin.open("data.txt",ios::in);<br />
<br />
ofstream File("MyFile.txt",ios::out);<br />
<br />
<br />
char str[14];<br />
<br />
fin.getline(str,sizeof(str),'\n');<br />
<br />
<br />
string line(str);<br />
cout << str<<endl;<br />
<br />
<br />
<br />
for (int i=0; i<5000; ++i)<br />
{<br />
random_shuffle(line.begin(), line.end());<br />
File << "Randomised: " << line << endl;<br />
File << " : " << line << endl;<br />
File << " : " << line << endl;<br />
File << " : " << line << endl;<br />
File << " "<< endl;<br />
<br />
File << " "<< endl;<br />
<br />
<br />
<br />
tmEnd = time(0);<br />
cout << tmEnd-tmStart << " seconds (that was fast!)" << endl;<br />
<br />
} <br />
File.close ();<br />
fin.close ();<br />
<br />
}<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
DoStuff();<br />
<br />
return 0;<br />
<br />
}<br />
<br />
<br />
|
|
|
|
|
Mmmmh... At first glance, this is not even easy, it is trivial... smells like homework ... please post your code that does not work with your while attempt, and we will help you.
~RaGE();
|
|
|
|
|
i know its sumthing about this but i dont knw how to implement it..
{<br />
char str[2000];<br />
fstream file_op("c:\\test_file.txt",ios::in);<br />
while(!file_op.eof()) <br />
{<br />
file_op.getline(str,2000);<br />
cout <<str;<br />
} file_op.close();<br />
cout <<endl;<br />
<br />
|
|
|
|
|
Please, stop asking things you don't even understand. Take a C++ book and start reading it.
How will you learn if people make the complete program for you (this is what is happening right now, looking at the number of questions you already asked for such a trivial code snippet).
|
|
|
|
|
i am learning...give me any hint on this...
|
|
|
|
|
|
A good book. Every C++ programmer should read it.
Steve
|
|
|
|
|
|
I started reading it after already "knowing" C++: I thought I wouldn't learn much from it: I was wrong.
Steve
|
|
|
|
|
Stephen Hewitt wrote: I thought I wouldn't learn much from it: I was wrong.
Such as? Do you mind listing a few which you learned in addition from the book? Thanks.
Maxwell Chen
|
|
|
|