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 wOOdy-Soft 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.
 
Ted,

This is the code I offered to you in my last post back in February. It works 100% with my webcam (which is a ZoomCam). It is only an extract (so you'll need to slot it into a procedure/function of your own) from a slightly extended version of the code I already referenced for you earlier in this thread, thread222-853019, and so assumes that you have successfully got a handle to a capture window which is called mCaphWnd. I include all the additional declarations necessary:
Code:
[blue]Const WM_USER As Integer = &H400
Const WM_CAP_GET_VIDEOFORMAT = WM_USER + 44
Const WM_CAP_SET_VIDEOFORMAT = WM_USER + 45

Private Type BITMAPINFOHEADER
        biSize As Long
        biWidth As Long
        biHeight As Long
        biPlanes As Integer
        biBitCount As Integer
        biCompression As Long
        biSizeImage As Long
        biXPelsPerMeter As Long
        biYPelsPerMeter As Long
        biClrUsed As Long
        biClrImportant As Long
End Type

Private Type RGBQUAD
        rgbBlue As Byte
        rgbGreen As Byte
        rgbRed As Byte
        rgbReserved As Byte
End Type

Private Type BITMAPINFO
        bmiHeader As BITMAPINFOHEADER
        bmiColors As RGBQUAD
End Type        




	' Let's play around with capture resolutions
        ' Remember that, no matter what resolution the camera is set to the image will be strectched
        ' to fit the preview window exactly - but do not worry, the actual capture will be at the selected
        ' resolution. In this example, we can see this by grabbing a single snapshot from the preview window
        ' and blitting it into a non-strecthed window; i.e. the  Command1_Click code here
        Dim myBMI As BITMAPINFO
        Dim result As Long
        Dim size As Long
        result = SendMessage(mCaphWnd, WM_CAP_GET_VIDEOFORMAT, 0&, ByVal 0&) ' get real size of structure into result (as there may be additional data after the documented members)
        SendMessage mCaphWnd, WM_CAP_GET_VIDEOFORMAT, result, myBMI ' OK , now get current settings into structure (this means we will only have to set the members we want rather than ALL the members)
        ' Make sure you choose a resolution the webcam supports
        myBMI.bmiHeader.biWidth = 160 '320
        myBMI.bmiHeader.biHeight = 120 '240
        myBMI.bmiHeader.biSizeImage = myBMI.bmiHeader.biHeight * myBMI.bmiHeader.biWidth * 3
        SendMessage mCaphWnd, WM_CAP_SET_VIDEOFORMAT, result, myBMI[/blue]
Oh, the Command_Click code mentioned in the Remarks is part of the original example
 
Thanks - works fine on my cameras with a little fiddling.
It all looks so simple when you see how it is done even though it looks nothing like what I imagined from the "help" files.

I got your conversion to JPG to work but it crashes after a while at random for no apparent reason and as you inferred, takes up to half a second to convert a 1 meg BMP.(on a 2.4GHZ core duo)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top