Help with my camera qt

  • Hi i am trying to record my camera i used this code:

    #include "../headers/webcamwin.h"
    #include <QFile>
    HWND hwndVideo; // video capture window
    void encender()
    // ::hwndVideo = capCreateCaptureWindowA("captura",WS_POPUP ,1,1 ,240 ,320,NULL,0);

    void apagar()
    ::hwndVideo = NULL;

    QPixmap capturar()
    QPixmap imagen;
    QFile crear;
    return imagen;

    But i get these errors:
    C2065: 'WS_POPUP' : undeclared identifier
    and more errors like identifier not found.

    My question is: I need to include some class or some library. Thanks in advance.

  • Why do you use the Windows API instead of QCamera?

  • This post is deleted!

  • This post is deleted!

  • Hi i am trying to record my camera with qcamera but i dont have many experience.

    I declare in headers this:

    #include <QPixmap>
    #include <QDir>
    #ifdef Q_WS_WIN
    #include <windows.h>
    #include <vfw.h>

    class QCamera;
    class QCameraViewfinder;
    class QCameraImageCapture;
    class QVBoxLayout;
    class QMenu;
    class QAction;

    QAction *mEncenderAction;
    QAction *mApagarAction;
    QAction *mCapturarAction;

    QPixmap capturar();
    void encender();
    void apagar();

    cpp file:
    #include "../headers/webcamwin.h"
    #include <QFile>
    #include <QCamera>
    #include <QCameraViewfinder>
    #include <QCameraImageCapture>
    #include <QVBoxLayout>
    #include <QMenu>
    #include <QAction>
    #include <QFileDialog>

    void encender()



    void apagar()



    QPixmap capturar()

        auto filename = QFileDialog::getSaveFileName(this,"Capturar","/",
        QImageEncoderSettings imageEncoderSettings;


    Obviously doesnt work. I only want that when i call one determined function, the camera do (up,off, or record). Sorry for all.

    I spend a lot of time with the QCamera for my project until I found that that the camera api is nearly not supported for windows.
    Video works never !
    Camera takes always photos with the lowest resolution. No change to change it with Qt.
    No flash or an other feature of the camera is suppoedt.

    So forget the QCamera for windows, I use the integrated windows camera software now,
    but I am very interested how to use the windows api to access the camera in Qt.

  • @Andy314 with qcamera you could take pictures, turn on camera and many things. I dont know why you say this. I was trying with win api because i always do with this way and before works old versions. Now you could use the qcamera and works but i only want to combinate with functions and i am little newbie for this i take help. If you need help i could help you. If you want check in YouTube you will get a easy tutorial:

  • this is solved you can include the library and works

Log in to reply

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