Important: Please read the Qt Code of Conduct -

how to load file.bmp with macro MAKEINTRESOURCE(IDB_BITMAP) with Qt Creator

  • Hi Guys, I need advice, which codes can I use to upload a .bitmap file and upload it to MAKEINTRESOURCE (IDB_BITMAP) for the function:


    i tried with: #define IDB_BITMAP 1000

    in resource.h

    IDB_BITMAP BITMAP "file.bmp"

    but it is not possible because Qt creator does not create file resource.rc but resource.qrc which is very different from resource.rc. what codes can I use to automatically load the .bmp file in the macro MAKEINTRESOURCE (IDB_BITMAP)??
    thank you for those who help me

  • I solved the same way:

    #include "afxwin.h"
    #include <qt_windows.h>
    #include <QtWinExtras/qwinfunctions.h>

    Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0);

    QPixmap pixmap(":/resources/images/file.bmp");
    pixmap = pixmap.scaled(16,16);
    HBITMAP bitMap = qt_pixmapToWinHBITMAP(pixmap);

    thanks all the same for those who wanted to help me!!

Log in to reply