Archived

This topic is now archived and is closed to further replies.

How to i display this?

This topic is 5839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Its a windows console, you why not try to get the handle to the desktop, and try drawing to that? i.e.
GetDC( GetWindow( GetDesktop() ) ) 
?

Share this post


Link to post
Share on other sites
cause unless you are writing to the console, its not drawing a bmp in the console window silly. only way to get pictures in a console window is doing ascii art (or the old dos tricks, but they dont work in windows too well if at all)

the thing you say was probally either a normal windows program, or ascii art.

in fact there was a demo done by group which showed the entire matrix movie trailer in the console (the trailer was converted to ascii art by a pre processing program). there is also aalib for linux which allows normal pixel operations and converts the frames into ascii art. text mode quake was quite crazy.


Edited by - a person on December 17, 2001 1:35:30 PM

Share this post


Link to post
Share on other sites
thats not possible anymore, if you want to display a BMP in DOS its another thing, you can try that and see if it runs under windows (I remember Wolfenstein 3d ran fine as a console ALT-ENTER) but good luck as even running old DOS games on WinMe has given me the worse headaches.

I saw a post about getting the Console''s DC, you might want to try that, and then use GDI to paint over the console, but this all seems complicated, and rather Useless, do you have a case example of what exacly you want to achieve by doing this?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
To get the DC for the console, you''ll need the HWND for the console. Here''s some code I wrote a long time ago - looks like it could use a little scrubbing
  

// console finding guid

#define CON_GUID TEXT("CON_GUID-{47A71768-AF1B-4ed2-9CEF-54A08BC7D192}")

////////////////////////////////////////////////////////////////////////

// G E T C O N S O L E H A N D L E 9 X ------------------------------

HWND __stdcall GetConsoleWindow9X(void)
{

HWND hConWnd = NULL;
WIN32_FIND_DATA fd;
HANDLE ff;

static TCHAR szTempTitle[] = CON_GUID;
static TCHAR szTempString[MAX_PATH];

if( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) > 0 )
{
SetConsoleTitle(szTempTitle);
hConWnd = FindWindow(TEXT("tty"), szTempTitle);
SetConsoleTitle(szTempString);
}

// fallback method - could be written differently

if ( !hConWnd )
{
ZeroMemory(&szTempTitle, sizeof(szTempTitle) );
if ( GetModuleFileName(NULL, szTempString, MAX_PATH) > 0 )
{
ff = FindFirstFile(szTempString, &fd);
if ( ff != INVALID_HANDLE_VALUE )
{
ZeroMemory(&szTempString, sizeof(szTempString) );
for ( int i = 0; fd.cFileName[i] != ''.''; i++ )
{
szTempString[i] = fd.cFileName[i];
}
hConWnd = FindWindow(TEXT("tty"), szTempString);
}
FindClose(ff);
}
}
return( hConWnd );
}




Share this post


Link to post
Share on other sites
Guest Anonymous Poster
To get the DC for the console, you''ll need the HWND for the console. Here''s some code I wrote a long time ago - looks like it could use a little scrubbing.

  

// console finding guid

#define CON_GUID TEXT("CON_GUID-{47A71768-AF1B-4ed2-9CEF-54A08BC7D192}")

////////////////////////////////////////////////////////////////////////

// G E T C O N S O L E H A N D L E 9 X ------------------------------

HWND __stdcall GetConsoleWindow9X(void)
{

HWND hConWnd = NULL;
WIN32_FIND_DATA fd;
HANDLE ff;

static TCHAR szTempTitle[] = CON_GUID;
static TCHAR szTempString[MAX_PATH];

if( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) > 0 )
{
SetConsoleTitle(szTempTitle);
hConWnd = FindWindow(TEXT("tty"), szTempTitle);
SetConsoleTitle(szTempString);
}

// fallback method - could be written differently

if ( !hConWnd )
{
ZeroMemory(&szTempTitle, sizeof(szTempTitle) );
if ( GetModuleFileName(NULL, szTempString, MAX_PATH) > 0 )
{
ff = FindFirstFile(szTempString, &fd);
if ( ff != INVALID_HANDLE_VALUE )
{
ZeroMemory(&szTempString, sizeof(szTempString) );
for ( int i = 0; fd.cFileName[i] != ''.''; i++ )
{
szTempString[i] = fd.cFileName[i];
}
hConWnd = FindWindow(TEXT("tty"), szTempString);
}
FindClose(ff);
}
}
return( hConWnd );
}




Share this post


Link to post
Share on other sites
Guest Anonymous Poster
To get the DC for the console, you''ll need the HWND for the console. Here''s some code I wrote a long time ago - looks like it could use a little scrubbing.

  

// console finding guid - use your own

#define CON_GUID TEXT("CON_GUID-{47A71768-AF1B-4ed2-9CEF-54A08BC7D192}")

////////////////////////////////////////////////////////////////////////

// G E T C O N S O L E H A N D L E 9 X ------------------------------

HWND __stdcall GetConsoleWindow9X(void)
{

HWND hConWnd = NULL;
WIN32_FIND_DATA fd;
HANDLE ff;

static TCHAR szTempTitle[] = CON_GUID;
static TCHAR szTempString[MAX_PATH];

if( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) > 0 )
{
SetConsoleTitle(szTempTitle);
hConWnd = FindWindow(TEXT("tty"), szTempTitle);
SetConsoleTitle(szTempString);
}

// fallback method - could be written differently

if ( !hConWnd )
{
ZeroMemory(&szTempTitle, sizeof(szTempTitle) );
if ( GetModuleFileName(NULL, szTempString, MAX_PATH) > 0 )
{
ff = FindFirstFile(szTempString, &fd);
if ( ff != INVALID_HANDLE_VALUE )
{
ZeroMemory(&szTempString, sizeof(szTempString) );
for ( int i = 0; fd.cFileName[i] != ''.''; i++ )
{
szTempString[i] = fd.cFileName[i];
}
hConWnd = FindWindow(TEXT("tty"), szTempString);
}
FindClose(ff);
}
}
return( hConWnd );
}




Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Oops! Can some one who knows how clean that up? Looks like I''ll have to stop lurking so I can do it for myself should that ever happen again!

Share this post


Link to post
Share on other sites
well, you actually can display bmp (or sorta) images on console. I know it works for DOS but I''m not sure about Windows 9x/Me(under NT/XP/2k it certainly won''t work).

You can achieve this by remapping the ROM character set that is used to display your text with a custom one. You could reserve, say 128 characters for that and get nice results together with standart CGA text attributes.

It was introduced in the book "PC intern" (German title). If I only could find that CD with the sample code...

Share this post


Link to post
Share on other sites