How to make a snapshot of the screen/window at runtime?


I’d like to make a snapshot of the sreen/window/area at run time form my PhAB C apllication. I bulid an HMI and I want to add new integrated functionality for users to make a screenshot of current data on the screen. As I found it was easy to do it in QNX 4.25 with snapshot command (with relevant options) e.g.:

snapshot -A 100100 -o 5050 -p “BMP Spool File” -f /src/photon/apps/print1.bmp

But in QNX 6.3 version it doesn’t work by this way.

Could you give me a tips how to do it by code, please?

Thans, Meg

The parameters given to snapshot are just for the GUI-App Snapshot, so not a direct screenshot.
I don´t think there is anythink like the old console-driven-snapshot possible, unless you write your
own shot-app

OK, but could you give me some principle idea how on it?

I think you would need to open a memoryContext and Copy your current DC into it, where the DC is the MAIN-Screen

I do right now do not have the time to check this, but i will try this soon i guess :slight_smile:

For all others…

I found a good example here: … 293_2.html

I works nice!!!

thx a lot, so i do not have to try that long now :slight_smile:

Any know, how to draw widget to memory context?

The memory context has a property image which has the same structure of image. Use that to decode the pointer to unsigned char of image data.