Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

tgraph.c File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct  _BITMAPINFOPAT

Defines

#define FOREGROUND_WHITE   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)

Typedefs

typedef _BITMAPINFOPAT BITMAPINFOPAT

Functions

DWORD main (int argc, char *argv[])

Variables

BITMAPINFOPAT bmiPat
BYTE abBigCat []


Define Documentation

#define FOREGROUND_WHITE   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
 

Definition at line 8 of file tgraph.c.

Referenced by Scroll1(), Scroll2(), Scroll3(), and Scroll4().


Typedef Documentation

typedef struct _BITMAPINFOPAT BITMAPINFOPAT
 


Function Documentation

DWORD main int  argc,
char *  argv[]
 

Definition at line 93 of file tgraph.c.

References abBigCat, bmiPat, BOOL, CONSOLE_GRAPHICS_BUFFER, CreateConsoleScreenBuffer(), DbgPrint, FALSE, Handle, InvalidateConsoleDIBits(), NULL, Rect, SetConsoleActiveScreenBuffer(), STD_OUTPUT_HANDLE, and TRUE.

00097 { 00098 SECURITY_ATTRIBUTES SecurityAttributes; 00099 HANDLE Handle; 00100 int i; 00101 CONSOLE_GRAPHICS_BUFFER_INFO GraphicsInfo; 00102 SMALL_RECT Rect; 00103 BOOL Success; 00104 ULONG NumWritten; 00105 00106 DbgPrint( "TGRAPH: Entering graphics Test Program\n" ); 00107 00108 00109 // 00110 // open a new console 00111 // 00112 00113 SecurityAttributes.bInheritHandle = FALSE; 00114 SecurityAttributes.lpSecurityDescriptor = NULL; 00115 SecurityAttributes.nLength = sizeof (SECURITY_ATTRIBUTES); 00116 GraphicsInfo.dwBitMapInfoLength = sizeof(bmiPat); 00117 GraphicsInfo.lpBitMapInfo = &bmiPat; 00118 GraphicsInfo.dwUsage = DIB_RGB_COLORS; 00119 Handle = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 00120 FILE_SHARE_READ | FILE_SHARE_WRITE, 00121 &SecurityAttributes, 00122 CONSOLE_GRAPHICS_BUFFER, 00123 &GraphicsInfo 00124 ); 00125 if (Handle == (HANDLE)-1) { 00126 DbgPrint("CreateConsoleScreenBuffer failed\n"); 00127 return FALSE; 00128 } 00129 00130 // 00131 // make it current 00132 // 00133 00134 if (!SetConsoleActiveScreenBuffer(Handle)) { 00135 DbgPrint("SetConsoleActiveScreenBuffer failed\n"); 00136 return FALSE; 00137 } 00138 /* 00139 // 00140 // try to write to it. should fail. 00141 // 00142 00143 Success = WriteFile(Handle,"foo",3,&NumWritten,NULL); 00144 if (!Success) { 00145 DbgPrint("WriteFile failed\n"); 00146 } 00147 else { 00148 DbgPrint("WriteFile succeeded\n"); 00149 } 00150 */ 00151 // 00152 // grab mutex 00153 // 00154 00155 Success = WaitForSingleObject(GraphicsInfo.hMutex,-1); 00156 if (Success) { 00157 DbgPrint("WaitForSingleObject failed\n"); 00158 } 00159 else { 00160 DbgPrint("WaitForSingleObject succeeded\n"); 00161 } 00162 00163 // 00164 // write bitmap to memory 00165 // 00166 00167 RtlCopyMemory(GraphicsInfo.lpBitMap,abBigCat,(32*128/8)); 00168 00169 // 00170 // release mutex 00171 // 00172 00173 ReleaseMutex(GraphicsInfo.hMutex); 00174 00175 // 00176 // write bitmap to memory 00177 // 00178 00179 Rect.Left = 0; 00180 Rect.Top = 0; 00181 Rect.Right = 31; 00182 Rect.Bottom = 31; 00183 Success = InvalidateConsoleDIBits(Handle,&Rect); 00184 if (!Success) { 00185 DbgPrint("InvalidateConsoleDIBits failed\n"); 00186 } 00187 else { 00188 DbgPrint("InvalidateConsoleDIBits succeeded\n"); 00189 } 00190 00191 /* 00192 i=0; 00193 while (i<20) { 00194 INPUT_RECORD Buffer; 00195 DWORD NumRead; 00196 00197 ReadConsoleInput(GetStdHandle(STD_INPUT_HANDLE), 00198 &Buffer, 00199 1, 00200 &NumRead); 00201 if (Buffer.EventType == MOUSE_EVENT) { 00202 DbgPrint("Mouse position is %d %d\n", 00203 Buffer.Event.MouseEvent.dwMousePosition.X, 00204 Buffer.Event.MouseEvent.dwMousePosition.Y); 00205 i++; 00206 } 00207 } 00208 */ 00209 00210 while (TRUE) { 00211 Sleep(10000); 00212 } 00213 00214 if (!SetConsoleActiveScreenBuffer(GetStdHandle(STD_OUTPUT_HANDLE))) { 00215 DbgPrint("SetConsoleActiveScreenBuffer failed\n"); 00216 return FALSE; 00217 } 00218 00219 if (!CloseHandle(Handle)) { 00220 DbgPrint("CloseHandle failed\n"); 00221 return FALSE; 00222 } 00223 00224 DbgPrint( "TGRAPH: Exiting Test Program\n" ); 00225 00226 return TRUE; 00227 }


Variable Documentation

BYTE abBigCat[] [static]
 

Definition at line 54 of file tgraph.c.

Referenced by main().

BITMAPINFOPAT bmiPat
 

Definition at line 17 of file tgraph.c.

Referenced by main().


Generated on Sat May 15 19:45:44 2004 for test by doxygen 1.3.7