News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

store the current window output before clearing it in the WM_BACKGROUND message

Started by gelatine1, November 13, 2014, 02:28:52 AM

Previous topic - Next topic

gelatine1

Is it possible to retrieve the current ouput in the window to use somewhere later ?

TouEnMasm


Output text,Image ?
If it is an image,copy it in a Hdc
If it is text,send a message WM_GETTEXT (or something like that)


Fa is a musical note to play with CL

Tedd

Do it in the same way you'd use a back buffer, but swap the roles of the two DCs -- create a memory DC to store the window contents, then BitBlt the contents of the window DC to it.

Alternatively, if you're already using a back buffer, there's no need because the window contents are already in the back buffer, so you can just re-blt them when needed.
Potato2

gelatine1

But don't I need to use BeginPaint first to use those device contexts ? and I thought beginpaint sends a message to WM_BACKGROUND to erase the background ? :/

dedndave

no, and no
you do not need to use BeginPaint, unless you are responding to WM_PAINT

the OS sends WM_ERASEBKGND before sending WM_PAINT
that is, unless you use a method that prevents it - I like to use hbrBackground = NULL in the window class

you can get the DC - then copy the contents into another DC
what I suggest, for making a bitmap, is CreateDIBSection (rather than CreateCompatibleBitmap)
select the DIB section into the mem DC and copy the contents using BitBlt (or perhaps, StretchBlt)
once you have the data in a DIB section, it's fairly simple to create a BMP file from it