using gdi functions in console

Started by
3 comments, last by GameDev.net 18 years, 7 months ago
Is it possible to use gdi graphic function in the console of a windows system. I am using c++
Advertisement
No, you will need to use the Win32 API in order to make a window and GDI context to use those functions. There exist console functions that let you set the color of text, but that's about as graphic as you can get.
Quote:Original post by dk32321
Is it possible to use gdi graphic function in the console of a windows system.
I am using c++

Certainly, but what device context are you planning to use?
You can create a window in a console application and use GDI functions on that. You can access the desktop device context and use GDI functions on that. Some GDI functions can be used with just the desktop device context and still be useful like EnumFontFamilies(). However, drawing to the console window the GDI functions is non-kosher.
not worth it

just make a window
and use a static text control for the text, and an edit control for text input
and all the gdi's work

you can get an hdc from the console through win32 trickery, as a matter of fact you can get the hdc from any open window system wide and mess with it, close it, paint on it, etc
but thats a lot of hard work

This topic is closed to new replies.

Advertisement