CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2010
    Posts
    8

    [RESOLVED] Catch WINAPI messages from external device

    Hello. I write this post before in > C-Sharp Programming < but now i think here is better place for it. I coding in C#, but this is typicall WINAPI problem ( propably ). If moderator read it maybe can delete old version of this ( http://www.codeguru.com/forum/showthread.php?t=504201 ).

    ------------------------

    I have small external device, it is LogiLink Video Grabber in this case ( connected via USB ). It have big single button (physical) and I trying to detect when somebody pressed it.
    I attemp to use catch Window Messages from standard GetMessage() loop and not catch any kind of messages when I press this device button.

    I attempt to use Raw Input ( http://msdn.microsoft.com/en-us/libr...36(VS.85).aspx ) but I cant enumerate my device ( I try use GetRawInputDeviceList() - i know PID and VID of my device ).

    I'm guessing that I need to register for messages from this devices? Or something? Somebody have any idea how I can do this?

    I cann't find any public API for this device - but I have producent application (witout sources) that responds to the button so I know that there is a some way to detect pressing.
    Last edited by Psychowico; October 22nd, 2010 at 12:47 AM.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Catch WINAPI messages from external device

    Quote Originally Posted by Psychowico View Post
    I attemp to use catch Window Messages from standard GetMessage() loop and not catch any kind of messages when I press this device button.
    That is because these devices use a specific API to perform their tasks. For video devices, it's usually Video For Windows, for scanning devices it's usually WIA or TWAIN, etc. It isn't about just checking for windows messages in a GetMessage() loop -- you won't get anywhere pursuing your goal this way.

    http://www.videoocx.de/

    That is an example of a control that already uses Video For Windows in a wrapper.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Aug 2010
    Posts
    8

    Re: Catch WINAPI messages from external device

    Like I say - I have problem with detect pressing of physical button from this device. I capture video without problems.

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Catch WINAPI messages from external device

    Quote Originally Posted by Psychowico View Post
    Like I say - I have problem with detect pressing of physical button from this device. I capture video without problems.
    I come from a background of handling scanning devices, where scanners have different buttons, controls, and some have no buttons (software-only scanners). So "pressing buttons" is device specific.

    If video devices operate similar to scanning devices, then getting physical button presses is highly unlikely, unless the manufacturer provides you an API or "hook" that detects which button is pressed.

    And even if you wanted to know the messages sent, just hook up Spy++ and see the message traffic. There is no need to write your own message loops. But I doubt you will find anything in the message loop or with Spy++ except the normal dialog messages (mouse move, WM_CHAR, etc.)

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Aug 2010
    Posts
    8

    Re: Catch WINAPI messages from external device

    I think u're rate. Thx for reply.

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

Featured