Hello all,
I'm trying to draw some simple graphics (dots, lines) into a windowed console.
Although grabbing its DC and use that to draw on works, any updating of the screen by the running program (partially) causes havoc - from the drawing being partially erased to it fully disappearing.
So, I'm looking for a way to subclass a console window so I can intercept its WM_PAINT message, and redraw my stuff after an update of the window occurs.
The problem is that although I have a hWnd to the console, a 'SetWindowSubclass' fails (incorrect parameter), and a GetWindowLong GWL_WINPROC returns Zero (whut ?).
This morning I've been searching the intarnetz for information on how to intercept WM_* messages of a console window, but I've not been able to find anything in that direction. :-\
Anyone knows how to do it and wants to share ?
Target OS: XPsp3
I thought the basic idea of a console was that you weren't going to do
that sort of thing?
I don't know how to do what you want to do, and I'm not even sure if
it's possible.
A possible way round things though - why don't you have a normal window,
with a big multi-line edit box covering some or all of it, and "print"
text by adding it to the text in the box?
Hello all,
I'm trying to draw some simple graphics (dots, lines) into a windowed console.
Although grabbing its DC and use that to draw on works, any updating of the screen by the running program (partially) causes havoc - from the drawing being partially erased to it fully disappearing.
So, I'm looking for a way to subclass a console window so I can intercept
its WM_PAINT message, and redraw my stuff after an update of the window occurs.
The problem is that although I have a hWnd to the console, a 'SetWindowSubclass' fails (incorrect parameter), and a GetWindowLong GWL_WINPROC returns Zero (whut ?).
This morning I've been searching the intarnetz for information on how to intercept WM_* messages of a console window, but I've not been able to find anything in that direction. :-\
Anyone knows how to do it and wants to share ?
Target OS: XPsp3
Regards,
Rudy Wieser
Have you tried using `SetWindowLong()` or `SetClassLong()` instead?
Alas, changing either/both doesn't give any kind of different result. No intercepted messages, nothing throwing a hissy fit either. Its as if I've done nothing at all.
Worse: changing both GWL_WNDPROC and CWL_WNDPROC and checking them later shows the same values as before I made the change. IOW, its as if setting them is ignored.
GetWindowLong returns a kernel-space pointer (e.g. 0xFFFF0501)
This conclusion is based on the fact that, an application run using
the SYSTEM account can terminate CSRSS.EXE and BSOD-ed the system.
So, if it can't subclass the console window, it should mean that,
the system has prevented it unconditionally - regardless of user
credentials and privileges.
Because IMO, it's unbelievable to think that a console window
message handler is more crucial than CSRSS.EXE.
My focus is userland, so I again didn't even think of trying it under different accounts. But thank you for the testing (and posting it :-) ).
Hmmmm... I'm allowed to tinker around with most all GUI windows, but am not allowed to do the same with a console one. I'm not so sure I understand that distinction.
By the way, I also tried to use VESA, but that locked up the 'puter as well.
:-\ I knew (was warned about it that) the NVIDIA GT 730 video card is a
simple one, but *that* simple ?...
What do you mean "use VESA"? AFAIK, Windows doesn't expose any of
the display adapter's VESA API.
Hello all,...
I'm trying to draw some simple graphics (dots, lines) into a windowed console.
Anyone knows how to do it and wants to share ?
I found some almost decade-old code that does it here :
http://blog.airesoft.co.uk/2012/10/things-ms-can-do-that-they-dont-tell-you-about-console-graphics/
Although there are a number of restrictions, it shows that you can indeed
use the console window for graphics output. :-)
You can only create graphics buffers on 32-bit versions of Windows [4].
Alas, as it doesn't draw the graphics over the already existing text (and only works in a windowed console) its not really usefull toward my own goal.
:-\
You can only create graphics buffers on 32-bit versions of Windows [4].
Kind of expected that, since 64-bit Windows no longer support 16-bit programs. But... FUUU!!
Alas, as it doesn't draw the graphics over the already existing text
(and only works in a windowed console) its not really usefull toward
my own goal. :-\
That may be worked around by hooking the drawing function
I'm not so sure it has anything to do with 16-bit programs : In the example the console buffer itself is 32 bits, as is the program feeding it.
Having said that, I've got no idea what actually prohibits it.
Having said that, I've got no idea what actually prohibits it.
I wasn't referring to the graphic console buffer's bitmap bit depth.
There's no longer need to have graphic cosole buffer in 64-bit Windows,
since there's nothing which runs in real or V86 mode.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 42:29:11 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,851 |