Click here to Skip to main content
15,920,688 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: BOOL to bool conversion Pin
User 66585-Jul-04 0:54
User 66585-Jul-04 0:54 
GeneralRe: BOOL to bool conversion Pin
Tim Smith5-Jul-04 4:03
Tim Smith5-Jul-04 4:03 
GeneralRe: BOOL to bool conversion Pin
V.4-Jul-04 22:18
professionalV.4-Jul-04 22:18 
GeneralRe: BOOL to bool conversion Pin
Tim Smith5-Jul-04 4:01
Tim Smith5-Jul-04 4:01 
GeneralUsing MFC in Win32 Application Pin
vyjesh4-Jul-04 0:33
vyjesh4-Jul-04 0:33 
GeneralRe: Using MFC in Win32 Application Pin
gamitech4-Jul-04 6:19
gamitech4-Jul-04 6:19 
GeneralRe: Using MFC in Win32 Application Pin
Frank K4-Jul-04 19:34
Frank K4-Jul-04 19:34 
Generalproblem with console app Pin
cpeed4-Jul-04 0:29
cpeed4-Jul-04 0:29 
here is a relevent snippets:

TCHAR buf[20]; 

fdwMode = ENABLE_LINE_INPUT |       //ReadConsole() should wait and read 
                                   // characters until ENTER is pressed 
                 ENABLE_ECHO_INPUT |   // show characters as you type 
                 ENABLE_PROCESSED_INPUT;    // let system process all 
                                                // control keystrikes 
SetConsoleMode(hStdin, fdwMode) ; 
        
fdwMode = ENABLE_PROCESSED_OUTPUT; 
SetConsoleMode(hStdout, fdwMode); 


while (1) 
{ 
    WriteConsole(hStdout, "\npress [1] for codepage: ", 25, &ch, NULL); 
     ReadConsole(hStdin,buf,1,&ch,NULL); 
     buf[ch]='\0'; 
     FlushConsoleInputBuffer(hStdin); 
    WriteConsole(hStdout, buf, 3, &ch, NULL); 
}


the problem is that the first time while executes everything is ok:
i get on screen:

press [1] for codepage:


i enter 1 and press enter then it prints the character.

from this point something strange happens...
while loop continue to execute two more times despite the fact that ReadConsole() should wait for input...

anyone understand where is the problem?
GeneralRe: problem with console app Pin
Mike Nordell4-Jul-04 1:17
Mike Nordell4-Jul-04 1:17 
GeneralRe: problem with console app Pin
cpeed4-Jul-04 1:25
cpeed4-Jul-04 1:25 
Generalthe "outp" command Pin
Member 12178723-Jul-04 22:59
Member 12178723-Jul-04 22:59 
GeneralRe: the "outp" command Pin
peterchen4-Jul-04 0:30
peterchen4-Jul-04 0:30 
Generalthe "outp" command Pin
Member 12178723-Jul-04 22:56
Member 12178723-Jul-04 22:56 
Generalthe "outp" command Pin
Member 12178723-Jul-04 19:24
Member 12178723-Jul-04 19:24 
GeneralRe: the "outp" command Pin
Michael Dunn3-Jul-04 20:40
sitebuilderMichael Dunn3-Jul-04 20:40 
GeneralRe: the "outp" command Pin
Johan Rosengren3-Jul-04 21:02
Johan Rosengren3-Jul-04 21:02 
Generaldialog box help Pin
AmericanBacon3-Jul-04 15:15
AmericanBacon3-Jul-04 15:15 
GeneralRe: dialog box help Pin
Ravi Bhavnani3-Jul-04 16:04
professionalRavi Bhavnani3-Jul-04 16:04 
GeneralRe: dialog box help Pin
PJ Arends3-Jul-04 17:22
professionalPJ Arends3-Jul-04 17:22 
GeneralRe: dialog box help Pin
gamitech4-Jul-04 6:21
gamitech4-Jul-04 6:21 
GeneralRe: dialog box help Pin
vyjesh4-Jul-04 23:05
vyjesh4-Jul-04 23:05 
GeneralCString into a non-MFC app Pin
CaesarCZ3-Jul-04 13:06
CaesarCZ3-Jul-04 13:06 
GeneralRe: CString into a non-MFC app Pin
John R. Shaw3-Jul-04 13:16
John R. Shaw3-Jul-04 13:16 
GeneralRe: CString into a non-MFC app Pin
CaesarCZ3-Jul-04 14:02
CaesarCZ3-Jul-04 14:02 
GeneralRe: CString into a non-MFC app Pin
Mike Nordell4-Jul-04 1:19
Mike Nordell4-Jul-04 1:19 

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.