Win CE application



  • I'm coding and application for mobile with C++ and Qt for Win CE. I need to use the bar-code scanner to get the code but I don't know how to do it, I need your help.



  • I worked for years with the portable devices with WindowsCE products.

    You do not need to drive the scanner, is usually an active program or service that scanner run and operate as normal keyboard or service.

    In short, the scanner should be called by hardware, with button of the device.



  • What brand of machine you use?

    I am Brazilian. maybe know that you use?



  • Hi,

    If your bar-code scanner is connected in USB (the more likely), then, as Flavio said, it will be interpreted as a keyboard and so you will receive keyboard events on the focused widget

    @onKeyPress(QKeyEvent*)@

    To catch those events at application level, you can reimplement bool QApplication::event(QEvent*) and test the incoming event type

    @bool MyQApplication::event(QEvent* event)
    {
    if (event->type() == QEvent::KeyPress)
    {
    ...
    return true;
    }

    QApplication::event(event);
    }@

    Or install an event filter on your QApplication.

    @
    MyKeyboardEventFilter : public QObject
    {
    ...
    bool eventFilter(QObject* object, QEvent* event)
    {
    if(event->type() == QEvent::KeyPress)
    {
    ...
    return true;
    }

      QObject::eventFilter(object, event);
    

    }
    };@

    @// main.cpp
    qApp->installEventFilter(new MyKeyboardEventFilter());@

    Finally, else if it's connected through a serial port, have a look at QExtSerialPort lib project to receive and interpret incoming messages.



  • Thanks for your help, for the bar-code scanner it's in the PDA, so i need a library to manipulate the bar-code scanner, like (turn it on,off,....) and thnx a lot for ur help :D


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.