![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Консольные приложения [D5, WinME]
Tuzemec © (2003-02-04 00:08:00)Доброго все времени суток.
Народ, ктонить знает что можно использовать в консольных приложениях? Как сделать то, что я делал в паскале, тоесть Readkey, Window,... измень цвет символов, экрана итд
Tuzemec (2003-02-11 15:30:00) [1]Привет народ!
Спасибо за ответ. Как сам не догадался посмотреть в мсдн не понимаю. но в общем немножко пдолбался и написал себе модуль для консольных приложений. Кому будеть нужно - вышлю!
А теперь пока, инет нынчен не дешёвый.
DarkGreen (2003-02-04 14:04:00) [2]Здесь в кладовке есть TurboVision портированный (правда криво) под Delphi. Возьми его, поправь и не мучайся
asmith (2003-02-04 13:15:00) [3]Маленький примерчик:
{$APPTYPE CONSOLE}
program ConsoleOutput;
uses
Windows;
var
hOutput: THandle;
sbiAttributes: TConsoleScreenBufferInfo;
wDefColors: WORD;
coorCurrent, coorTopLeft: TCoord;
const
FOREGROUND_BRCYAN = FOREGROUND_GREEN or FOREGROUND_BLUE or
FOREGROUND_INTENSITY;
begin
hOutput := GetStdHandle(STD_OUTPUT_HANDLE);
coorTopLeft.X := 1;
coorTopLeft.Y := 1;
{* Read the default colors first. *}
GetConsoleScreenBufferInfo(hOutput, sbiAttributes);
wDefColors := sbiAttributes.wAttributes;
coorCurrent := sbiAttributes.dwCursorPosition;
{* Change the output color to bright cyan and move the *}
{* cursor to the top of the screen *}
SetConsoleTextAttribute(hOutput, FOREGROUND_BRCYAN);
SetConsoleCursorPosition(hOutput, coorTopLeft);
{* Write Some Stuff *}
WriteLn("This test is in cyan.");
WriteLn("As is this text.");
{* Restore the default colors *}
SetConsoleTextAttribute(hOutput, wDefColors);
SetConsoleCursorPosition(hOutput, coorCurrent);
end.
ZZ (2003-02-04 03:48:00) [4]The following functions are used to access a console. (c)MSDN
AllocConsoleAllocates a new console for the calling process.
CreateConsoleScreenBufferCreates a console screen buffer.
FillConsoleOutputAttributeSets the text and background color attributes for a specified number of character cells.
FillConsoleOutputCharacterWrites a character to the screen buffer a specified number of times.
FlushConsoleInputBufferFlushes the console input buffer.
FreeConsoleDetaches the calling process from its console.
GenerateConsoleCtrlEventSends a specified signal to a console process group that shares the console associated with the calling process.
GetConsoleCPRetrieves the input code page used by the console associated with the calling process.
GetConsoleCursorInfoRetrieves information about the size and visibility of the cursor for the specified console screen buffer.
GetConsoleModeRetrieves the current input mode of a console"s input buffer or the current output mode of a console screen buffer.
GetConsoleOutputCPRetrieves the output code page used by the console associated with the calling process.
GetConsoleScreenBufferInfoRetrieves information about the specified console screen buffer.
GetConsoleTitleRetrieves the title bar string for the current console window.
GetConsoleWindowRetrieves the window handle used by the console associated with the calling process.
GetLargestConsoleWindowSizeRetrieves the size of the largest possible console window.
GetNumberOfConsoleInputEventsRetrieves the number of unread input records in the console"s input buffer.
GetNumberOfConsoleMouseButtonsRetrieves the number of buttons on the mouse used by the current console.
GetStdHandleRetrieves a handle for the standard input, standard output, or standard error device.
HandlerRoutineAn application-defined function used with the SetConsoleCtrlHandler function.
PeekConsoleInputReads data from the specified console input buffer without removing it from the buffer.
ReadConsoleReads character input from the console input buffer and removes it from the buffer.
ReadConsoleInputReads data from a console input buffer and removes it from the buffer.
ReadConsoleOutputReads character and color attribute data from a rectangular block of character cells in a console screen buffer.
ReadConsoleOutputAttributeCopies a specified number of foreground and background color attributes from consecutive cells of a console screen buffer.
ReadConsoleOutputCharacterCopies a number of characters from consecutive cells of a console screen buffer.
ScrollConsoleScreenBufferMoves a block of data in a screen buffer.
SetConsoleActiveScreenBufferSets the specified screen buffer to be the currently displayed console screen buffer.
SetConsoleCPSets the input code page used by the console associated with the calling process.
SetConsoleCtrlHandlerAdds or removes an application-defined HandlerRoutine from the list of handler functions for the calling process.
SetConsoleCursorInfoSets the size and visibility of the cursor for the specified console screen buffer.
SetConsoleCursorPositionSets the cursor position in the specified console screen buffer.
SetConsoleModeSets the input mode of a console"s input buffer or the output mode of a console screen buffer.
SetConsoleOutputCPSets the output code page used by the console associated with the calling process.
SetConsoleScreenBufferSizeChanges the size of the specified console screen buffer.
SetConsoleTextAttributeSets the foreground (text) and background color attributes of characters written to the screen buffer.
SetConsoleTitleSets the title bar string for the current console window.
SetConsoleWindowInfoSets the current size and position of a console screen buffer"s window.
SetStdHandleSets the handle for the standard input, standard output, or standard error device.
WriteConsoleWrites a character string to a console screen buffer beginning at the current cursor location.
WriteConsoleInputWrites data directly to the console input buffer.
WriteConsoleOutputWrites character and color attribute data to a specified rectangular block of character cells in a console screen buffer.
WriteConsoleOutputAttributeCopies a number of foreground and background color attributes to consecutive cells of a console screen buffer.
WriteConsoleOutputCharacterCopies a number of characters to consecutive cells of a console screen buffer.
SeF (2003-02-04 01:46:00) [5]CONSOLE_SCREEN_BUFFER_INFO