Hello, I am going to make a application that can show live preview from a webcam, and after reading alot on the internet I think that Avicap is easier to learn than directshow.
After googling on avicap I found some Visual Basic tutorials, But no c++ ones.
First question: Can you use avicap in c++?
Second: Are there any good tutorials on using avicap on the internet?
Did you find any tutorials that explain the basics of avicap from that search? I only got some tutorial in creating a wrapper for avicap live stream or a tutorial in vb...
Well the concepts will be the same regardless of whether you use VB or C++.
And the concept of a DLL wrapper will be relevant to all DLLs, and not something specific to avicap.
Sooner or later, you have to start mixing and matching disparate sources of information yourself. There simply isn't a tutorial for everything on the web.
If you've already googled sufficiently well already, then the chances are we're not going to fare much better at finding something "just right for you".
So let's say there ain't any tutorial on this, how would I learn the very basics of usig avicap? Should I read the VB tutorials? Or maybe someone of you here maybe could explain some of the basics? Or are there some kind of documentation or something?
Sure, read the VB tutorials.
But don't worry too much about the syntactic details of any code, but pay more attention to which API calls are being made.
Reading code in other languages is a useful skill, even if you've got no intention of actually writing anything. VB is verbose enough that you should be able to figure out what is going on without having to read a great deal.
So I found this piece of code that I actually understand (the most of it anyway) so I will be able to learn something from it.
The problem is just 2 errors that I think are very strange.
(158): error C2065: 'true' : undeclared identifier
(160): error C2065: 'true' : undeclared identifier
Here is a piece of the code that I found:
I am really confused about this error.
SendMessage(camhwnd, WM_CAP_SET_SCALE, true, 0);// Here is error 1
SendMessage(camhwnd, WM_CAP_SET_PREVIEWRATE, 30, 0);
SendMessage(camhwnd, WM_CAP_SET_PREVIEW, true, 0);// Here is error 2
If someone could explain it to me, I would appreciate it.
true and false are valid C++ code.
Are you sure you're compiling C++?
I am compiling in c++ yes, Visual c++ 2010 express edition .
Make sure the filename ends in .cpp rather than .c, then. Or, alternatively, if you're supposed to pass an int as the third argument, then pass an int (like 1).
Oh, It was ending in .c , my bad. trying it as cpp now
Got some less strange errors this time:
program.exe not found or not built by the last incremental link; performing full link
1>ctl_one.obj : error LNK2019: unresolved external symbol _capCreateCaptureWindowA@32 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z)
program .exe : fatal error LNK1120: 1 unresolved externals
This part is creating a capture window:
camhwnd = capCreateCaptureWindow ("camera window", WS_CHILD , 0, 100, 300, 300, hwnd, 0);
If you believe that capCreateCaptureWindow exists, then you need to link with the library that contains it.
already linked in the code
Edit: Found this in msdn.microsoft:
HWND VFWAPI capCreateCaptureWindow(
so there doesnt seem to be any wrong the the parameters.
vfw.h is not the library. According to capCreateCaptureWindow Function (Windows), the library is vfw32.dll.