logitech webcam callback in VB6

logitech webcam callback in VB6

Post by Graham » Sat, 07 Jun 2003 01:21:54

I am using the Logitech QuickCam SDK ( developer.logitech.com )in VB6. I
want to use an event that can be set to fire once for every new image. The
event function is declared as

Private Sub VideoPortal1_PortalNotification(ByVal lMsg As Long, ByVal
lParam1 As Long, ByVal lParam2 As Long, ByVal lParam3 As Long)

When I call StartVideoHook this event function is called once per frame, OK
so far.

lMsg may be one of a number of event message IDs and lParam1,2,3 will have
different meaning in each case. In my case lParam1 will be a pointer to a
BITMAPINFOHEADER struct, lParam2 will be a pointer to bitmap pixel data in
24 bit RGB format.

I want to copy the bitmap data into a picture control in this event handler
to produce a live display but I don't see how to do it.

[backgound here is that I want to use drawing functions and file save
available in the picture control. QuickcamSDK has a preview mode to display
live video, which works fine, but this provides no way to draw a graphic

I have considered using SetDIBits to update the Picture control's underlying
bitmap but I'm not sure this will work and I don't know how to make the
call. To make the call I need a pointer to BITMAPINFO and pointer to pixel
data. I have these in lParam1,2 but they are declared byval as long. Simply
passing the values on to the SetDIBits function results in an error Bad DLL
calling convention

        Call SetDIBits(Picture1.hdc, Picture1.Picture.Handle, 0,
Picture1.Picture.Height, lParam2, lParam1, 0)

Where I declared: -
  Private Declare Function SetDIBits Lib "gdi32" ( _
    ByVal hdc As Long, _
    ByVal hbmp As Long, _
    ByVal uStartScan As Long, _
    ByVal cScanLines As Long, _
    ByVal lpvBits As Long, _
    ByVal lpbmi As Long, _
    ByVal fuColorUse As Long)

So my questions: -

Is this a reasonable method to display a live image in a picture control?
Any alternative suggestions or references?
Where am I going wrong in making the GDI call?
Is there a VB equivalent to a 'c' cast?
I should be using the scanlines=biHeight member of lParam1
i.e. ((BITMAPINFOHEADER*)lParam1)->biHeight in 'C'. How do I access this in

Environment is VB6 Pro on XP Pro. End result must run on all Win32 flavours

Many thanks



1. Callback within a callback?

Anyone have any ideas on how to create another callback within a callback?
For example if someone presses a mousebutton and then starts typing everything
the user types is then entered into a string?  Thanks...

2. smooth handwriting

3. Stop Motion animation with a Logitech Webcam.. ?


5. WebCam - Help!

6. solid modeling (CSG, B-reps)

7. Webcam application, masking and merging layer

8. color matching problem

9. ANN: WebCam v.2.0

10. 3Com webcam APIĀ§

11. Recommend webcam software?

12. Art project and Webcam...Help!

13. Mac webcam suggestions?