Don';当控制台应用程序启动时,t显示等待光标
本文关键字:显示 光标 等待 启动 应用程序 控制台 Don | 更新日期: 2023-09-27 18:27:56
我开发了一个小型控制台应用程序,它基本上是ping一个url,记录结果,在需要时重新启动手机,然后安排自己再次运行。
客户抱怨每次启动应用程序时都会显示"洗衣机"图标(尽管时间不到一秒钟)。
我将等待光标隐藏在主方法的第一行中,但有没有任何方法可以阻止等待光标的显示?
static void Main()
{
//Hide cursor
IntPtr hOldCursor = SetCursor(IntPtr.Zero);
//Ensure EventLog table is ready
PrepareDatabase();
tapi = new Tapi();
tapi.TAPI_Open();
//Ping specified URL and restart phone if required.
PingRestart();
tapi.TAPI_Close();
//Set the application to run again after the ping interval has passed
SystemTime systemTime = new SystemTime(DateTime.Now.AddMilliseconds(RegistryAccess.PingInterval));
CeRunAppAtTime(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase, ref systemTime);
}
没有办法禁用等待光标,因为它出现在应用程序运行之前,因此应用程序无法阻止它。
唯一的方法是用C或Assembly编写,因为与.NET可执行文件相比,这些语言的启动速度非常快。但是,AntiVirus程序在执行之前可能会阻止它一段时间。