Results 1 to 4 of 4

Thread: VFW callback function question.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    VFW callback function question.

    I am experimenting with VFW in VB6 for controlling Webcams. To access the actual bytes of video stream data, I need to define a callback function according to the specs at http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx for a callback function type they call capVideoStreamCallback. It is defined on that MSDN webpage like this in C++ code:
    Code:
    LRESULT CALLBACK capVideoStreamCallback(
      HWND hWnd,
      LPVIDEOHDR lpVHdr
    );

    This would be equivalent to this VB6 code:
    Code:
    'code to define user-defined type VIDEOHDR goes here
    Public Function capVideoStreamCallback(Byval hWnd as Long, Byref VHdr as VIDEOHDR) as Long
    'code for processing video frames goes in here
    capVideoStreamCallback = SomeReturnValue
    End Function
    Now as with any callback function which has an output (return value), the calling function (some code internal to VFW, which I'm not able to examine the source code) is likely to expect the callback function to return a certain value, in order to work properly, but unfortunately the above linked MS page on the callback function, say NOTHING AT ALL about what a valid return value would be. So I do not know where to go from here. Is this one of those, super top secret, Microsoft proprietary trade secret, undocumented things, that is kept out of the public knowledge, so that Microsoft is the only one that can properly use the function (leaving everyone else with buggy software that uses this callback function, due to not being able to figure out the correct return values), and thus empowers Microsoft to have a competitive edge over its opponents?
    Last edited by Ben321; Aug 11th, 2014 at 10:03 PM.

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: VFW callback function question.

    If the return result was important, it would have been documented. Seems like it's not, and when I did a search on the API,. I couldn't find anything on its value. Generally though, I believe success is represented by a return value of 0, while a non-0 value indicates abnormal operation. It could be a simple 1, or it might be an actual error number of some kind.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    Re: VFW callback function question.

    Quote Originally Posted by techgnome View Post
    If the return result was important, it would have been documented.

    ...

    Generally though, I believe success is represented by a return value of 0, while a non-0 value indicates abnormal operation.

    -tg
    Not necessarily. It could be as I stated, that Microsoft removed that specific info on purpose, so that while other companies could use it, they would not know the correct return value, and thus any of Microsoft's competitors who did use it would end up creating buggy software. This would give Microsoft a competitive edge over all their opponents.

    In some cases, some API functions actually return a 1 for success, and 0 (or another non-1 value) to indicate failure. And when the internal VFW calling function calls my callback function, correct operation of VFW may very well depend on exactly what the return value from my callback function is. As I said, it appears Microsoft is trying to gain an unfair competitive edge, by leaving out what could be extremely important info, so that any competing company that uses the Microsoft API for VFW will end up making buggy software.
    Last edited by Ben321; Aug 11th, 2014 at 10:20 PM.

  4. #4
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,372

    Re: VFW callback function question.

    don't get too paranoid (a little bit is wise though ) - the return value is not relevant as far as i know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width