Results 1 to 4 of 4

Thread: Problem with winEvent

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    692
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problem with winEvent

    Good morning,
    I'm building a Qt application ( based on QDialog ) to catch and render frames from my uEye video camera ( IDS-Imaging ).
    So I need to link with my application the sdk coming with the camera ( *.lib, *.h and relative dll ). Basically the sdk of the camera works with windows message ( that I would handle in the application and process ).
    Firstly I have to initialize the camera and once I did it I install the messages I would catch so:

    Qt Code:
    1. bool CameraView::EvInitAll()
    2. {
    3. // Enable Messages
    4. is_EnableMessage( m_hCam, IS_DEVICE_REMOVED, reinterpret_cast<HWND>( this->winId() ) );
    5. is_EnableMessage( m_hCam, IS_DEVICE_RECONNECTED, reinterpret_cast<HWND>( this->winId() ) );
    6. is_EnableMessage( m_hCam, IS_FRAME, reinterpret_cast<HWND>( winId() ) );
    7.  
    8. return true;
    9. }
    To copy to clipboard, switch view to plain text mode 

    This should install the following messages:
    IS_DEVICE_REMOVED // happens when I disconnect the camera
    IS_DEVICE_RECONNECTED // happens when I reconnect the camera
    IS_FRAME // SHOULD happens when I receive frames from the camera

    So I think to handle windows messages into a Qt application I should use winEvent.
    So I reimplemented it in my app so:
    In the *.h
    Qt Code:
    1. protected:
    2. virtual bool winEvent( MSG*, long* );
    To copy to clipboard, switch view to plain text mode 

    and in the *.cpp
    Qt Code:
    1. bool CameraView::winEvent(MSG *m, long* result)
    2. {
    3. uint msgType = m->message; // test line
    4.  
    5. switch ( m->wParam )
    6. {
    7. case IS_DEVICE_REMOVED:
    8. qDebug("Device removed");
    9. break;
    10. case IS_DEVICE_RECONNECTED:
    11. qDebug("Device reconnected");
    12. break;
    13. case IS_FRAME:
    14. qDebug("Frame received");
    15. break;
    16. }
    17.  
    18. return false;
    19. }
    To copy to clipboard, switch view to plain text mode 

    Where ( from the camera sdk ):
    Qt Code:
    1. #define IS_FRAME 0x0000
    2. #define IS_DEVICE_REMOVED 0x1000
    3. #define IS_DEVICE_RECONNECTED 0x0004
    To copy to clipboard, switch view to plain text mode 

    I have problems with the IS_FRAME message. Seems that it occurs always.
    No problem with the IS_DEVICE_REMOVED and IS_DEVICE_RECONNECTED. When I disconnect the camera I can see the Device removed string at shell ( the same with the IS_DEVICE_RECONNECTED ).
    But When I start the application the IS_FRAME is immediately handled ( this should not be possible as I first have to initialize the camera ).
    It immediately starts to print a shell Frame received and it should not. Also when I move the mouse it prints Frame received. Why this message is always handles when I don't effectively receive frames from the camera?

    I hope to get help.

    Here a list of some of the camera messages:

    // ----------------------------------------------------------------------------
    // Window message defines
    // ----------------------------------------------------------------------------
    #define IS_UEYE_MESSAGE (WM_USER + 0x0100)
    #define IS_FRAME 0x0000
    #define IS_SEQUENCE 0x0001
    #define IS_TRIGGER 0x0002
    #define IS_TRANSFER_FAILED 0x0003
    #define IS_DEVICE_RECONNECTED 0x0004
    #define IS_MEMORY_MODE_FINISH 0x0005
    #define IS_FRAME_RECEIVED 0x0006
    #define IS_GENERIC_ERROR 0x0007
    #define IS_STEAL_VIDEO 0x0008
    #define IS_WB_FINISHED 0x0009
    #define IS_AUTOBRIGHTNESS_FINISHED 0x000A
    #define IS_OVERLAY_DATA_LOST 0x000B

    #define IS_DEVICE_REMOVED 0x1000
    #define IS_DEVICE_REMOVAL 0x1001
    #define IS_NEW_DEVICE 0

    Best Regards,
    Franco
    Last edited by franco.amato; 18th August 2010 at 20:00.
    Franco Amato

  2. #2
    Join Date
    May 2010
    Posts
    24
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with winEvent

    Shouldn't you test if it is actually a uEye message ?
    Qt Code:
    1. bool CameraView::winEvent(MSG *m, long* result)
    2. {
    3. uint msgType = m->message;
    4.  
    5. if (msgType != IS_UEYE_MESSAGE)
    6. return false; // Let Qt handle other messages
    7.  
    8. switch ( m->wParam )
    9. {
    10. ...
    11. }
    12. return true;
    13. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to alexisdm for this useful post:

    franco.amato (19th August 2010)

  4. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    692
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with winEvent

    Quote Originally Posted by alexisdm View Post
    Shouldn't you test if it is actually a uEye message ?
    Qt Code:
    1. bool CameraView::winEvent(MSG *m, long* result)
    2. {
    3. uint msgType = m->message;
    4.  
    5. if (msgType != IS_UEYE_MESSAGE)
    6. return false; // Let Qt handle other messages
    7.  
    8. switch ( m->wParam )
    9. {
    10. ...
    11. }
    12. return true;
    13. }
    To copy to clipboard, switch view to plain text mode 
    It worked.
    Thank you
    Franco Amato

  5. #4
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Problem with winEvent

    Hello,

    i'm new at using uEye in Qt. Can you show your entire cpp please?

Similar Threads

  1. winEvent---(MSG * message, long * result)
    By Naveen in forum Qt Programming
    Replies: 4
    Last Post: 29th June 2015, 11:05
  2. winEvent prevents opening menus...
    By supergillis in forum Qt Programming
    Replies: 0
    Last Post: 16th November 2008, 16:48
  3. Win32 MSG - winEvent()
    By AlGaN in forum Qt Programming
    Replies: 1
    Last Post: 24th September 2008, 14:19
  4. Replies: 1
    Last Post: 4th February 2008, 11:12
  5. MSG not defined (winEvent)
    By December in forum Qt Programming
    Replies: 6
    Last Post: 19th February 2007, 16:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.