Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access to functions in Logitech QuickCam dlls

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
AU
Anyone know how to access the functions for Logitech QuickCam web cameras?
I want to be able to change pixel resolution because when I access it with AVICap32.DLL it defaults only to low resolution.
 
>it defaults only to low resolution

Have you tried sending the WM_CAP_SET_VIDEOFORMAT message? Certainly works for changing the resolution of my webcam.
 
Thanks, Yes I did manage to change the resolution using this since I first posed the question however it only worked once.
Now I cant change it back and the settings window won't appear at all.
Is there perhaps an avicap32 reset command?

Do you know of a resource that gives all the functions for avicap32 and their variables? I would like to be able to control video and exposure levels as well if this is possible. I can only find sites offering to sell me programs to "fix the avicap spyware problem" that apparently doesn't exist.

 
Thanks
Is this for VBnet or C?
I was hoping there was a reference for VB6 without having to fiddle around translating it (If I could - I'm not as quick as I used to be!)
I was hoping I wouldn't have to learn VBnet before it is out of date - or I die, whichever is the sooner.
I see references to c# being the language to go for anyway?
 
It is the reference for the Win32 AVICap API (which historically is aimed at C).

But it shouldn't be a problem. AVICap only exports two functions (er, unless you want to get involved in callbacks, which you probably don't at this stage):

capCreateCaptureWindow
and
capGetDriverDescription

I suspect your code is currently based of my webcam capturing example from this forum, e.g. thread222-853019 (or one of the similar examples out there on the 'net), and that includes the necessary VB dialect declarations for both of them - so it doesn't matter that the definition in the documentation is for another language, because all you'd be interested in is the description of what they do and what each of the parameters are.

Everything else is driven through messages, which are sent through (tada!) SendMessage

Now Sendmessage takes 4 parameters

1) hwnd - handle of the window we want to send the message to (e.g the video capture window)
2) wMsg - the message we are sending (e.g WM_CAP_SET_VIDEOFORMAT)
3) wParam - additional message-specific information
4) lParam - additional message-specific information

And it is these latter two that are described in the AVICap documentation for each of the messages. The documentation tells you what the formal name for each of these paremeters is for the message in question and then describes what each of the parameters is expected to contain. So using as the example WM_CAP_SET_VIDEOFORMAT, we get

wParam = (WPARAM) (wSize) - which simply says that the name for wParam for this message is wSize
lParam = (LPARAM) (LPVOID) (psVideoFormat) - which simply says that the name for lParam for this message is psVideoFormat

(actually, if you are familiar with Microsoft's Hungarian notation, then these declarations give you a little bit more info than that, but it isn't something to worry about)

Then it goes on describes what wSize and lSize actually are:

wSize: Size, in bytes, of the structure referenced by s.

(inconveniently, this is actually a documentation error, as s should read psVideoFormat)

psVideoFormat: Pointer to a BITMAPINFO structure










 
Thanks
Sendmessage WM_CAP_SET_VIDEOFORMAT,0,0 is what I originally used and it brought up a dialog box so I could change the resolution.(WM_CAP_SET_VIDEOFORMAT=1069)
The problem now is it only worked once.
Now nothing at all happens with his command.
Do I have to change the values of the parameters?
Or maybe send something else first?

I cant find an explanation of what they mean by "size of the structure referenced by s" or "psVideoFormat
 
Ted, why did you send 0,0 as the wParam and lParam? I think you were lucky to a dialog rather than simply crashing your application.
 
Thats my problem - I cant find a reasonable explanation of or understand what values to put in these two variables!

 
So you were just trying random values? You probably don't want to do that with the API ...

The link I have provided is pretty explicit (in a pretty much language independant way once you get past the wParam and lParam declarations) about what the values are allowed to be for all the messages
 
Forgive me - I must be stupid.
When I click on a links that I would have imagined would tell me what is meant by "s" "wsize" and "psVideoFormat", I am directed in a circular manner back to the original page telling me I should use "s" "wsize" and "psVideoFortmat" etc.

When I try to find out what psVideoFormat is, I get references to the original pages that say wsize is the size, in bytes, of the structure referenced by "s". This I already know from the first page but I cant find anywhere that tells me what is the "structure" and what reference "s" is or what "psVideoFormat" really is! Clicking on any of the links on the searched page take me back to the original page I was already on.

What does it all mean? I am completely frustrated!
 
Ted, sometimes I get the feeling that you don't fully read the responses to your posts.

Firstly, the link that I sent you is to the entire documentation for Microsofts AVICap stuff, not just the one message that you are interested in, so yes, you'll have to navigate a bit.

Secondly, in my follow-up post I do try to explain how the documentation for messages work, specifically using the one that you are interested in as an example. I even clearly pointed out that "s" is a documentation error, and should read "psVideoFormat").

I'll repeat in hopefully simpler terms:

Windows messages take two extra parameters apart from the handle of the window you are sending the message to and the message itself. The placeholders for these parameters are called wParam and lParam (i.e, wParam and lParam are just proxie names). The documentation for each message firstly shows the proper Microsoft assigned name for each of these parameters for the particualr message in question (and we can ignore the stuff in brackets)

So (again using the particular message that you are interested in):
Code:
WM_CAP_SET_VIDEOFORMAT 
wParam = (WPARAM) (wSize); 
lParam = (LPARAM) (LPVOID) (psVideoFormat);
can be read as
Code:
For the message [b][blue]WM_CAP_SET_VIDEOFORMAT[/blue][/b] 
[b][blue]wParam[/blue][/b] is known as [b][blue]wSize 
lParam[/blue][/b] is known as [b][blue]psVideoFormat[/blue][/b]

Next it describes what these 'properly' named parameters are expected to contain. Given the explanation shown abpove this should now be clear(er), the documentation error for the message we are looking at notwithstanding.

Code:
[b][blue]wSize[/blue][/b] (the real name for wParam for this particular message) contains the [b][blue]size of the structure pointed to by psVideoFormat[/blue][/b]

[b][blue]psVideoFormat[/blue][/b] (the real name for lParam for this particular message) is a [b][blue]pointer to a BITMAPINFO structure[/blue][/b]

Hence, wSize contains the size of a BITMAPINFO structure - right now I'm not going to go into BITMAPINFO, but you should find it predefined for you in VB's API Text Viewer)

 
Thanks but I have understood all what you are saying from the start and I have gone over it 1000 times but it was the values of the variables I could not find anywhere.
I did not realise they were contained in the API text viewer.
 
Sorry but I still can't work out what value to substitute for psVideoFormat or the other constants. It says it is a pointer to "a" BITMAPINFO structure.
In the Microsoft pages, the definition of BITMAPINFO is not a definition or explanation by any reasonable standard I know. It contains a reference to further API routines and does not tell me what a BITMAPINFO really is, or which one I should be looking for, or how to look for it if I knew what or why I was looking for in the first place!

My API viewer does not tell me the values of any of the constants I need.
 
Here's the first part

Code:
    Public Structure BITMAPINFO
        Public Header As BITMAPINFOHEADER
        Public Bits() As Integer   '(Colors)
    End Structure

-David
2006, 2007 & 2008 Microsoft Most Valuable Professional (VB)
2006 Dell Certified System Professional (CSP)
 
Thanks, but what I cant find is any explanation of what numbers to put into the functions to get the desired results.
They seems to be listed nowhere, just a circular reference to various routines that use the same numbers. Nowhere can I find out which number to put in the function for any desired result.

Also what is "the structure pointed to by psVideoFormat"? I can't find any explanation of this only a repeat of the expression.

When I enter psVideoFormat in Google the very first response I got is my own Tek-Tips question about it - how on earth did I get to the top of the Google search engine so quickly! The rest of the entries are a repeat of the Microsoft page.

(Like asking "out of 1000 unmarked keys in a pile, how do I find which key to use to open my front door", the answer being "use the front door key"!
 
Thanks, but I can't understand what you mean!
What I can't find is any reasonable reference or explanation of what numbers to put into the functions to get the desired results.
They seems to be listed nowhere, just a circular reference to various routines that use the same names. Nowhere can I find out which number to put in the functions for any desired result or how to find out what the number is.

Also what is "the structure pointed to by psVideoFormat"? This may as well be Japanese to me. I can't find any explanation of this - only a repeat of the expression.

When I enter psVideoFormat in Google the very first response I get is my own Tek-Tips question about it - how on earth did I get to the top of the Google search engine so quickly! The rest of the 1000 entries are a repeat of the Microsoft page definition, not an explanation.

Like asking "out of 1000 numbered keys in a pile, how do I find which key to use to open my front door", the answer from MicroHard being "use the front door key"!

Can anybody really tell me how to find out about this subject?
 
You keep telling me that you understand what I'm saying, and then clearly demonstrate that you don't - but I think I see why: you've assumed that wParam and lParam are constants, and based your investigation on that. But they are not constants, they are variables. Given that we've been chucking API-based solutions at you in a number of areas for well over a year, I also assumed a level of familiarity with it that was perhaps overoptimistic.

So, I'll just try and go over this one more time

>Also what is "the structure pointed to by psVideoFormat"?

It is a BITMAPINFO structure. And it is in the API text viewer

>My API viewer does not tell me the values of any of the constants

They are not constants, that's why (and, as I said above, I guess this is the primary cause of the disconnect between us). A 'structure' is, in VB terms, a User Defined Type (UDT), so you'll find it under Types in the Viewer, where it appears as
Code:
[blue]
Public Type BITMAPINFO
        bmiHeader As BITMAPINFOHEADER
        bmiColors As RGBQUAD
End Type[/blue]
(and not the example quoted by dglienna, which is for .NET)
As you can see it references two more Types, and both BITMAPINFOHEADER and RGBQUAD can also be found in the Viewer. And they are defined in terms of standard VB variable types.

You may also find this useful (the site has a whole bunch of API info for VB users along with this tutorial/overview)

If you are still unsure, I can dig out my resolution switching code that uses this particular message
 
I am now convinced that strongm is THE_STIG of programming. [wink]

[gray]Experience is something you don't get until just after you need it.[/gray]
 
Sorry but I have really exhausted all avenues in my search for a method of changing the video pixel size format of a webcam.
All combinations I have tried simply do not work.
There are numerous examples in various examples posted in a number of forums that are apparently either based on feeding a picture directly to a form rather than a picture box OR involve the internal dialog box of a DLL that I simply can't work out how to access or bypass. Set format functions are declared but don't seem to be called by any method I know so I can't trace how they work.
The explanations are circular and just do not make sense - all I get are snippets of code that don't piece together.

If only I could see some total code that really works I would be able to understand the steps necessary to see how it all works.
This has been the most frustrating experience I have ever had with VB6 programming.
If any body has some such code I would be grateful to see it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top