LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows CVI Console Application freezes when text is selected

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?

0 Kudos
Message 1 of 4
(2,207 Views)

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.

0 Kudos
Message 2 of 4
(2,185 Views)

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?

0 Kudos
Message 3 of 4
(2,170 Views)

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.

Message 4 of 4
(2,135 Views)