4 * --------------------------------------------------------------------
6 * This software is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This software is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this software; see the file COPYING.LIB. If
18 * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 * Cambridge, MA 02139, USA.
21 * --------------------------------------------------------------------
22 * ReactOS Coders Console Parade
34 LPCTSTR app_name
= _TEXT("notevil");
38 CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo
;
49 WORD wLen
= lstrlen(lpString
);
53 // don't bother writing text when erasing
55 WriteConsoleOutputCharacter( ScreenBuffer
,
61 FillConsoleOutputAttribute(
80 _TEXT("x=%02d y=%02d"),
87 (BACKGROUND_RED
| BACKGROUND_GREEN
| BACKGROUND_BLUE
)
90 #endif /* def DISPLAY_COORD */
100 if (RES_LAST_INDEX
== *Index
)
102 *Index
= RES_FIRST_INDEX
;
121 LPTSTR szTitle
= _TEXT("ReactOS Coders Console Parade");
124 xy
.X
= (ScreenBufferInfo
.dwSize
.X
- lstrlen(szTitle
)) / 2;
125 xy
.Y
= ScreenBufferInfo
.dwSize
.Y
/ 2;
130 (FOREGROUND_GREEN
| FOREGROUND_INTENSITY
)
135 #define RES_DELAY_CHANGE 12
136 #define RES_BUFFER_SIZE 1024
140 TCHAR NameString
[RES_BUFFER_SIZE
];
144 INT n
= RES_DELAY_CHANGE
;
149 xy
.X
= ScreenBufferInfo
.dwSize
.X
/ 2;
150 xy
.Y
= ScreenBufferInfo
.dwSize
.Y
/ 2;
154 if (n
== RES_DELAY_CHANGE
)
161 NameLength
= lstrlen(NameString
);
163 if ((wColor
& 0x000F) == 0)
171 else if (xy
.X
>= ScreenBufferInfo
.dwSize
.X
- NameLength
- 1)
183 else if (xy
.Y
>= ScreenBufferInfo
.dwSize
.Y
- 1)
191 #endif /* def DISPLAY_COORD */
198 WaitForSingleObject( WaitableTimer
, INFINITE
);
216 COORD Coord
= { 0, 0 };
218 myself
= GetModuleHandle(NULL
);
220 GetConsoleScreenBufferInfo (GetStdHandle(STD_OUTPUT_HANDLE
),
222 ScreenBufferInfo
.dwSize
.X
= ScreenBufferInfo
.srWindow
.Right
- ScreenBufferInfo
.srWindow
.Left
+ 1;
223 ScreenBufferInfo
.dwSize
.Y
= ScreenBufferInfo
.srWindow
.Bottom
- ScreenBufferInfo
.srWindow
.Top
+ 1;
224 ScreenBuffer
= CreateConsoleScreenBuffer(
228 CONSOLE_TEXTMODE_BUFFER
,
231 if (INVALID_HANDLE_VALUE
== ScreenBuffer
)
235 _TEXT("%s: could not create a new screen buffer\n"),
240 // Fill buffer with black background
241 FillConsoleOutputAttribute( ScreenBuffer
,
243 ScreenBufferInfo
.dwSize
.X
* ScreenBufferInfo
.dwSize
.Y
,
247 WaitableTimer
= CreateWaitableTimer( NULL
, FALSE
, NULL
);
248 if( WaitableTimer
== INVALID_HANDLE_VALUE
)
250 printf( "CreateWaitabletimer() failed\n" );
253 lint
.QuadPart
= -2000000;
254 if( SetWaitableTimer( WaitableTimer
, &lint
, 200, NULL
, NULL
, FALSE
) == FALSE
)
256 printf( "SetWaitableTimer() failed: 0x%lx\n", GetLastError() );
259 SetConsoleActiveScreenBuffer(ScreenBuffer
);
261 CloseHandle(ScreenBuffer
);