Hi and thanks always for your help. I have a strange problem here, and I would like to hear your advice, comments or ideas about this. My problem is that I cannot reproduce the problem on my development computer.
Situation
I created a console application (in C #). It works great. Now other people use it. On the computer of one of the users there is another application. In his opinion, this application is for Windows. I do not know his code, and I was told rather vaguely that "it was built in C #". This application is basically initialized in the window, closes this window, and then the login window appears with the button, and two text fields for the password. The problem that I was informed about (and attributed to my console application) is that when the console application is started and not minimized, and then another application starts, the login window does not appear in the first text box. This means that if I start writing, nothing happens, and I must explicitly select this text box to write to it.When my console application is minimized or not running, another application starts with the first text field in focus (I can just start writing - no need to select a text field)
Now the console application is quite complicated, so I created a very simple console application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleFocus
{
class Program
{
private static volatile bool keepRunning = true;
static void Main(string[] args)
{
Console.CancelKeyPress += delegate (object sender, ConsoleCancelEventArgs e)
{
e.Cancel = true;
keepRunning = false;
};
while(keepRunning)
{
Console.WriteLine("I am still here");
Thread.Sleep(2000);
}
Console.WriteLine("Hit enter to finish...");
Console.Read();
}
}
}
as well as a very simple application for Windows. I tried the effect as in another application. As expected, even the simplest console application causes loss of focus on another application. Meanwhile, the Windows application does not call anything.
So it seems that somehow the console applications that intercept ctrl-c interfere with this application. (I created my own applications, and this does not happen at all)
Any idea why this could be happening?
Thanks in advance
source
share