Click here to Skip to main content
15,891,657 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C Functions and Macros Pin
roza12317-Aug-12 2:03
roza12317-Aug-12 2:03 
GeneralRe: C Functions and Macros Pin
Richard MacCutchan17-Aug-12 2:22
mveRichard MacCutchan17-Aug-12 2:22 
AnswerRe: C Functions and Macros Pin
Malli_S17-Aug-12 2:41
Malli_S17-Aug-12 2:41 
QuestionRe: C Functions and Macros Pin
David Crow17-Aug-12 2:43
David Crow17-Aug-12 2:43 
AnswerRe: C Functions and Macros Pin
Maximilien17-Aug-12 3:07
Maximilien17-Aug-12 3:07 
GeneralRe: C Functions and Macros Pin
Richard MacCutchan17-Aug-12 4:54
mveRichard MacCutchan17-Aug-12 4:54 
GeneralRe: C Functions and Macros Pin
Albert Holguin17-Aug-12 4:54
professionalAlbert Holguin17-Aug-12 4:54 
AnswerRe: C Functions and Macros Pin
Software_Developer17-Aug-12 5:45
Software_Developer17-Aug-12 5:45 
Challenge accepted. Suspicious | :suss:

C#
//Visual C++ 6 code

#include <iostream> 
#include <conio.h>
#include <windows.h>
#include <stdio.h>
using namespace std;

#define KB_UP 72
#define KB_DOWN 80
#define KB_LEFT 75
#define KB_RIGHT 77
#define KB_ESCAPE 27
#define KB_F8 66
#define KB_ENTER 13


int KB_code=0;
int ch=0;
int ON_OFF_SWITCH=-1;
unsigned long int counter=0;

void gotoxy(int x, int y);
void clrscr();
void do_keyboard_processing_stuff(void);
 
int main(void)
{
   

   while(KB_code != KB_ESCAPE )
   { 
       
       if (ON_OFF_SWITCH==1) counter++;
       gotoxy(22,10);
	   cout<<"Infinity Counter = "<<counter<<"  ";

	   do_keyboard_processing_stuff();
 
   }
   
  cout<<"\n\n";
  return 0;
}



void gotoxy(int x, int y)
{
    COORD coord;
    coord.X = x; coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
    return;
}

 
void clrscr()
{
    COORD coordScreen = { 0, 0 };
    DWORD cCharsWritten;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    DWORD dwConSize;
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

    GetConsoleScreenBufferInfo(hConsole, &csbi);
    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
    FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
    GetConsoleScreenBufferInfo(hConsole, &csbi);
    FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
    SetConsoleCursorPosition(hConsole, coordScreen);
    return;
}

void do_keyboard_processing_stuff(void)
{

    if (kbhit())
      {
            KB_code = getch();
            //cout<<"KB_code = "<<KB_code<<"\n";
            if (KB_code!=KB_ENTER) ON_OFF_SWITCH=-ON_OFF_SWITCH;
			
      
            switch (KB_code)
            {
          
                case KB_ESCAPE:
                           
					 
                break;

                case KB_LEFT:
                           //Do something
                break;

                case KB_RIGHT:
                           //Do something                     
                break;

                case KB_UP:
                           //Do something                     
                break;

                case KB_DOWN:
                           //Do something                     
                break;

                case KB_ENTER:
					clrscr();
                    counter=0;
					ON_OFF_SWITCH=-1;
                                                 
                break;


            }        

      }

}

GeneralRe: C Functions and Macros Pin
Maximilien17-Aug-12 5:55
Maximilien17-Aug-12 5:55 
GeneralRe: C Functions and Macros Pin
Software_Developer17-Aug-12 7:13
Software_Developer17-Aug-12 7:13 
GeneralRe: C Functions and Macros Pin
Wes Aday17-Aug-12 6:31
professionalWes Aday17-Aug-12 6:31 
GeneralRe: C Functions and Macros Pin
Software_Developer17-Aug-12 7:10
Software_Developer17-Aug-12 7:10 
QuestionExceptions handler question Pin
ForNow16-Aug-12 3:07
ForNow16-Aug-12 3:07 
AnswerRe: Exceptions handler question Pin
Richard MacCutchan16-Aug-12 6:59
mveRichard MacCutchan16-Aug-12 6:59 
GeneralRe: Exceptions handler question Pin
ForNow17-Aug-12 3:44
ForNow17-Aug-12 3:44 
GeneralRe: Exceptions handler question Pin
Richard MacCutchan17-Aug-12 4:53
mveRichard MacCutchan17-Aug-12 4:53 
GeneralRe: Exceptions handler question Pin
Eugen Podsypalnikov17-Aug-12 5:01
Eugen Podsypalnikov17-Aug-12 5:01 
AnswerRe: Exceptions handler question Pin
JackDingler16-Aug-12 7:59
JackDingler16-Aug-12 7:59 
QuestionCreateInstance(__uuidof(MYClass)); Pin
KeithF16-Aug-12 2:23
KeithF16-Aug-12 2:23 
AnswerRe: CreateInstance(__uuidof(MYClass)); Pin
KeithF20-Aug-12 6:06
KeithF20-Aug-12 6:06 
QuestionTreeCtrl edge not drawing when resized as part of CControlBar Pin
Phil Outram16-Aug-12 0:48
Phil Outram16-Aug-12 0:48 
AnswerSOLUTION!! Pin
Phil Outram16-Aug-12 2:06
Phil Outram16-Aug-12 2:06 
QuestionEnumprocessmodule fails Pin
Member 450808315-Aug-12 23:35
Member 450808315-Aug-12 23:35 
AnswerRe: Enumprocessmodule fails Pin
pasztorpisti15-Aug-12 23:39
pasztorpisti15-Aug-12 23:39 
AnswerRe: Enumprocessmodule fails Pin
David Crow16-Aug-12 3:59
David Crow16-Aug-12 3:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.