我開發了一個小型控制檯應用程序,它實質上是一個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);
}
也許如果您將其更改爲線程化任務,那麼可以使用'ManualResetEvent'來指示何時使用MRE的'WaitOne'方法完成線程。儘管如此,我還沒有測試過,所以我不想添加這個解決方案。 – jp2code 2012-03-17 01:34:45