News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

General WM_PAINT Question

Started by 44mag, March 30, 2012, 05:17:56 PM

Previous topic - Next topic

44mag

Hello all, quick question when using WM_PAINT, does Windows keep track of the characters you place on screen?  Like under DOS, where each character on screen has a corresponding address in video memory you can always reference?  Could I somehow tell Windows to look at a certain location on the screen and retrieve whatever character is there?  Thanks for any info!

dedndave

i am afraid that, when it gets to the screen, it is all graphics   :P
what i do, is create a character buffer - similar to a DOS text display buffer, although i haven't made one that stores attributes yet
i use HeapAlloc to create the buffer - then, you can organize it as you like
the one i am using now has a word at the beginning of each line that holds the length
then, i wrote a "StdOut" emulation routine that keeps everything updated when i modify the text contents
i use the line lengths and a "last line" value to control the scoll bar sizes

if you do decide to store character attributes, i suggest a seperate buffer, rather than interlacing them with the text chars

baltoro

The Windows GDI has a number of data structures that it maintains within the kernel to manage graphics operations. These structures are somewhat different from Operating System version to Operating System version. You cannot access these structures because Windows doesn't want User Mode applications to have the ability to corrupt kernel mode data,...this is what malware does and is a major source of system crashes.
User Mode applications are expected to manage the data it uses for graphics API calls,...and, so,...you are expected to store this data in virtual memory.
If you are trying to read the data in another application,...well,...you are going to have to employ methods that,...
WE CAN'T TALK ABOUT HERE,... :eek
The WM_PAINT message is sent by the system to your application when the window is going to be painted,...usually in response to an InvalidateRect function call or an UpdateWindow function call.
More Info: Painting and Drawing, MSDN
Baltoro