How do I setup a DOS box with a Windows application?

Started by
11 comments, last by Codegod 22 years, 1 month ago
quote:Original post by siaspete
Output from CMD:
Microsoft Windows 2000 [Version 5.00.2195](C) Copyright 1985-2000 Microsoft Corp. 


Mine prints the same thing. Looks like we''re running the same build.

Interesting to compare the copyrights. cmd.exe dates back to 1985? That seems a wee bit off to me...

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Advertisement
quote:Original post by Codegod
How do I set the properties for the console, such as window and buffer sizes??


SetConsoleWindowInfo is an API that sets the console size. If you want to explore using the hwnd to the console - you can get it with something like this:


    	HWND hConWnd = NULL;	TCHAR szTempTitle[] = MY_CON_GUID; // use a GUID 	TCHAR szTempString[MAX_PATH];	if( GetConsoleTitle(szTempString, sizeof(szTempString)/sizeof(TCHAR) ) > 0 )	{		SetConsoleTitle(szTempTitle);		hConWnd = FindWindow(TEXT("tty"), szTempTitle);		SetConsoleTitle(szTempString);	}    

But you might want to verify that "tty" is the correct classname using a window spy prog or something like that. "tty" was correct on W98 - on W2K its "ConsoleWindowClass"

For changing the buffer the API's are CreateConsoleScreenBuffer, GetConsoleScreenBufferInfo, SetConsoleScreenBufferSize and a few others. Here's a link to a console game that was posted in one of the flipcode totd's last year. The code illustrates several useful console techniques.

JCAB's Console Snake Game

// EDIT - this link points to a lot of useful info - it asks the same question - you might even recognize the code snippet that jacksonh presented above - and goes a bit further with 'freopen' and alt+enter. I even got a little nostalgic looking at it as it was my first post ever at flipcode. How fast time flies...



[edited by - lessbread on March 23, 2002 5:50:55 PM]
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
When you have a Win32 console application, no instance of command.com (the DOS command processor), cmd.exe (the native Win32 command processor), or ntvdm.exe (NT''s virtual DOS machine, necessary for running DOS applications) is spawned, therefore no DOS is involved.

This topic is closed to new replies.

Advertisement