Hi Urs,
Can that be solved somehow? It is very dangerous for the application to
stop just because of a wrong mouse click.
It is a generic feature of the Console window when its "QuickEdit Mode"(
"...\ConsoleApp.exe" Properties\Options\Edit Options) is enabled, in order
to disable that feature, you should uncheck the "QuickEdit Mode" option of
your app's console window at run-time by code:
...
Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Integer)
As Integer
Declare Function GetConsoleMode Lib "kernel32" (ByVal hConsoleHandle As
Integer, ByRef lpMode As Integer) As Integer
Declare Function SetConsoleMode Lib "kernel32" (ByVal hConsoleHandle As
Integer, ByVal dwMode As Integer) As Integer
Public Const STD_INPUT_HANDLE = -10&
...
Dim hConsole As Integer
Dim iMode As Integer
Dim bSuccess As Integer
hConsole = GetStdHandle(STD_INPUT_HANDLE)
'bSuccess = GetConsoleMode(hConsole, iMode)
iMode = &HB7 ' Note below
bSuccess = SetConsoleMode(hConsole, iMode)
...
Note: the &HB7 is the console's mode value when disabled "QuickEdit Mode"
on my machine, if it is different with yours, please uncomment the previous
code line('bSuccess = GetConsoleMode...), and set a BreakPoint on that
line, then at the run-time when the program stops here, right click the
titlebar of the program's console window, select "Properties" and in its
"Options" tab, uncheck the "QuickEdit Mode" item, then click OK(select
"Apply properties to current window only"). Now return to the debugger,
step run the GetConsoleMode(hConsole, iMode) code and recode iMode value it
got, then stop debugging and replace that &HB7 with the new recorded iMode
value...
Wish it helps!
Best regards,
Gary Chang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------