Reply to Re: C to Delphi

Your name:

Reply:


Posted by Samuel van Laere on 11/13/07 18:49

Sorry, wrong group I now realise :(

Cheers,
Sam

"Samuel van Laere" <webkluns@yahoo.com> schreef in bericht
news:473898af$0$240$e4fe514c@news.xs4all.nl...
> Hello,
>
> i've found a nice function for console windows on a website, but its coded
> in C.
> Could someone provide me a Delphi version of the code below, or give me
> some hints on what to look for in Delphi?
>
> Cheers,
> Samuel van Laere
>
> //
> // Set text and background colors
> //
> void setrgb(int color)
> {
> switch (color)
> {
> case 0: // White on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_RED |
> FOREGROUND_GREEN | FOREGROUND_BLUE);
> break;
> case 1: // Red on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_RED);
> break;
> case 2: // Green on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_GREEN);
> break;
> case 3: // Yellow on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_RED |
> FOREGROUND_GREEN);
> break;
> case 4: // Blue on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_BLUE);
> break;
> case 5: // Magenta on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_RED |
> FOREGROUND_BLUE);
> break;
> case 6: // Cyan on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_GREEN |
> FOREGROUND_BLUE);
> break;
> case 7: // Black on Gray
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | BACKGROUND_INTENSITY);
> break;
> case 8: // Black on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE);
> break;
> case 9: // Red on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE |
> FOREGROUND_RED);
> break;
> case 10: // Green on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE | FOREGROUND_GREEN);
> break;
> case 11: // Yellow on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE | FOREGROUND_RED |
> FOREGROUND_GREEN);
> break;
> case 12: // Blue on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE | FOREGROUND_BLUE);
> break;
> case 13: // Magenta on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE | FOREGROUND_RED |
> FOREGROUND_BLUE);
> break;
> case 14: // Cyan on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE | FOREGROUND_GREEN |
> FOREGROUND_BLUE);
> break;
> case 15: // White on White
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
> BACKGROUND_RED | BACKGROUND_GREEN |
> BACKGROUND_BLUE | FOREGROUND_RED |
> FOREGROUND_GREEN | FOREGROUND_BLUE);
> break;
> default : // White on Black
> SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
> FOREGROUND_INTENSITY | FOREGROUND_RED |
> FOREGROUND_GREEN | FOREGROUND_BLUE);
> break;
> }
> }
>
>
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация