Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionsuspending program execution. kbhit() Pin
9ine29-Aug-06 23:12
9ine29-Aug-06 23:12 
AnswerRe: suspending program execution. kbhit() Pin
toxcct29-Aug-06 23:36
toxcct29-Aug-06 23:36 
AnswerRe: suspending program execution. kbhit() Pin
kakan29-Aug-06 23:37
professionalkakan29-Aug-06 23:37 
GeneralRe: suspending program execution. kbhit() Pin
toxcct29-Aug-06 23:39
toxcct29-Aug-06 23:39 
GeneralRe: suspending program execution. kbhit() Pin
kakan29-Aug-06 23:45
professionalkakan29-Aug-06 23:45 
GeneralRe: suspending program execution. kbhit() Pin
Eytukan29-Aug-06 23:49
Eytukan29-Aug-06 23:49 
GeneralRe: suspending program execution. kbhit() Pin
toxcct30-Aug-06 0:17
toxcct30-Aug-06 0:17 
GeneralRe: suspending program execution. kbhit() Pin
Rage30-Aug-06 0:21
professionalRage30-Aug-06 0:21 
int __cdecl _getch (
        void
        )
{
        INPUT_RECORD ConInpRec;
        DWORD NumRead;
        CharPair *pCP;
        int ch = 0;                     /* single character buffer */
        DWORD oldstate;

        /*
         * check pushback buffer (chbuf) a for character
         */
        if ( chbuf != EOF ) {
            /*
             * something there, clear buffer and return the character.
             */
            ch = (unsigned char)(chbuf & 0xFF);
            chbuf = EOF;
            return ch;
        }

        if (_coninpfh == -1)
            return EOF;

        /*
         * _coninpfh, the handle to the console input, is created the first
         * time that either _getch() or _cgets() or _kbhit() is called.
         */

        if ( _coninpfh == -2 )
            __initconin();

        /*
         * Switch to raw mode (no line input, no echo input)
         */
        GetConsoleMode( (HANDLE)_coninpfh, &oldstate );
        SetConsoleMode( (HANDLE)_coninpfh, 0L );

        for ( ; ; ) {

            /*
             * Get a console input event.
             */
            if ( !ReadConsoleInput( (HANDLE)_coninpfh,
                                    &ConInpRec,
                                    1L,
                                    &NumRead )
                 || (NumRead == 0L) )
            {
                ch = EOF;
                break;
            }

            /*
             * Look for, and decipher, key events.
             */
            if ( (ConInpRec.EventType == KEY_EVENT) &&
                 ConInpRec.Event.KeyEvent.bKeyDown ) {
                /*
                 * Easy case: if uChar.AsciiChar is non-zero, just stuff it
                 * into ch and quit.
                 */

                if ( ch = (unsigned char)ConInpRec.Event.KeyEvent.uChar.AsciiChar )
                    break;

                /*
                 * Hard case: either an extended code or an event which should
                 * not be recognized. let _getextendedkeycode() do the work...
                 */
                if ( pCP = _getextendedkeycode( &(ConInpRec.Event.KeyEvent) ) ) {
                    ch = pCP->LeadChar;
                    chbuf = pCP->SecondChar;
                    break;
                }
            }
        }


        /*
         * Restore previous console mode.
         */
        SetConsoleMode( (HANDLE)_coninpfh, oldstate );

        return ch;
}


Smile | :) ;)

~RaGE();

I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus

GeneralRe: suspending program execution. kbhit() Pin
toxcct30-Aug-06 0:27
toxcct30-Aug-06 0:27 
GeneralRe: suspending program execution. kbhit() Pin
kakan30-Aug-06 1:36
professionalkakan30-Aug-06 1:36 
GeneralRe: suspending program execution. kbhit() Pin
toxcct30-Aug-06 2:03
toxcct30-Aug-06 2:03 
GeneralRe: suspending program execution. kbhit() Pin
David Crow30-Aug-06 3:07
David Crow30-Aug-06 3:07 
GeneralRe: suspending program execution. kbhit() Pin
kakan30-Aug-06 4:01
professionalkakan30-Aug-06 4:01 
GeneralRe: suspending program execution. kbhit() Pin
9ine30-Aug-06 0:36
9ine30-Aug-06 0:36 
GeneralRe: suspending program execution. kbhit() Pin
kakan30-Aug-06 0:46
professionalkakan30-Aug-06 0:46 
GeneralRe: suspending program execution. kbhit() Pin
Eytukan9-Sep-06 0:10
Eytukan9-Sep-06 0:10 
AnswerRe: suspending program execution. kbhit() Pin
Eytukan29-Aug-06 23:47
Eytukan29-Aug-06 23:47 
GeneralRe: suspending program execution. kbhit() Pin
9ine30-Aug-06 0:38
9ine30-Aug-06 0:38 
GeneralRe: suspending program execution. kbhit() Pin
toxcct30-Aug-06 0:49
toxcct30-Aug-06 0:49 
Questionhow to proceed with Notification of emails using Mapi. Pin
uday kiran janaswamy29-Aug-06 23:10
uday kiran janaswamy29-Aug-06 23:10 
AnswerRe: how to proceed with Notification of emails using Mapi. Pin
_AnsHUMAN_ 29-Aug-06 23:51
_AnsHUMAN_ 29-Aug-06 23:51 
GeneralRe: how to proceed with Notification of emails using Mapi. Pin
uday kiran janaswamy30-Aug-06 1:45
uday kiran janaswamy30-Aug-06 1:45 
QuestionRich text formating and tags Pin
Cedric Moonen29-Aug-06 22:53
Cedric Moonen29-Aug-06 22:53 
AnswerRe: Rich text formating and tags Pin
Waldermort30-Aug-06 1:08
Waldermort30-Aug-06 1:08 
QuestionRe: Rich text formating and tags Pin
David Crow30-Aug-06 3:13
David Crow30-Aug-06 3:13 

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.