05-04-2020 09:51 AM
We have a console application that communicates to Mod-bus devices and prints to the console. If you select or highlight text on the console, the process loop freezes.
while (!done) {
// Loop forever (until "e" entered on console port)
process ();
}
If you press the enter key, the process continues. Is there a way to prevent this?
05-04-2020 11:29 AM
If you're using CVI 2019 and CVI uses windows console on a windows 10 system, make sure QuickEdit Mode of the console is disabled.
If QuickEdit is enabled, any random mouse click selects that character from the console and suspend whatever was doing waiting on user input.
05-04-2020 01:17 PM
Thank you. I cleared the HKEY_Current_User\Console\QuickEdit in the Windows Registry and it fixes the issue for CVI and all DOS windows. Is there a way to set this mode within CVI, just for the CVI console?
05-05-2020 04:26 PM - edited 05-05-2020 04:28 PM
We found a way to perform this task from within CVI code:
#define ENABLE_INSERT_MODE 0x0020
#define ENABLE_EXTENDED_FLAGS 0x0080
hStdin = GetStdHandle(STD_INPUT_HANDLE);
if (! SetConsoleMode(hStdin, ENABLE_EXTENDED_FLAGS | ENABLE_INSERT_MODE))
{
MessageBox(NULL, TEXT("SetConsoleMode"), TEXT("Console Error"),
MB_OK);
return 1;
}
Now the code execution does not pause when text is highlighted.