3

The documents state that the function isavailable however I get an error with the statement

img = QPixmap::fromWinHBITMAP(hRetVal).toImage();

The error is

error C3861: 'fromWinHBITMAP': identifier not found

I tried including

#include <QPixmap>

However I am still getting that . Any suggestions ?

Rajeshwar
  • 11,179
  • 26
  • 86
  • 158

1 Answers1

4

It was moved into the QtWin namespace.

#include <QtWin>

HBITMAP bitmap = ...
QtWin::HBitmapFormat format = ...

QPixmap pixmap = QtWin::fromHBITMAP(bitmap, format);

http://doc.qt.io/qt-5/qtwin.html#fromHBITMAP

iPherian
  • 908
  • 15
  • 38
  • You may need to include it like this: #include , and add: "winextras" to Qt at .pro file: QT += core gui winextras – Tarek.Mh Feb 25 '22 at 08:01