protected override void OnStart(string[] args) { try { Log.Main.Inform("Starting..."); UiApi.OpenApi(); //try //{ // uint dwSessionId = WinApi.Wts.WTSGetActiveConsoleSessionId(); // MpegStream.Start(dwSessionId, "-f gdigrab -framerate 10 -f rtp_mpegts -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params aMg7BqN047lFN72szkezmPyN1qSMilYCXbqP/sCt srtp://127.0.0.1:5920"); //} //catch (Exception e) //{ // Console.WriteLine(e); //} uint sessionId = WinApi.Wts.WTSGetActiveConsoleSessionId(); if (sessionId == 0 || sessionId == 0xFFFFFFFF) { Log.Main.Inform("No console user is active."); } else { sessionChanged(sessionId, true); } } catch (Exception e) { Log.Main.Error(e); throw e; } }
static void Main() { try { Log.Main.Inform("Version: " + AssemblyRoutines.GetAppVersion()); string user = ProcessRoutines.GetProcessUserName(); string m = "User: "******" (as administrator)"; } Log.Main.Inform(m); #if !test ServiceBase.Run(new Service()); #else MpegStream.Start(1, "-f gdigrab -framerate 10 -f rtp_mpegts -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params aMg7BqN047lFN72szkezmPyN1qSMilYCXbqP/sCt srtp://127.0.0.1:5920"); //Service.sessionChanged(1, true); //System.Threading.Thread.Sleep(1000000); //s.Stop //MpegStream.Start(1, ""); UserSessionApi.OpenApi(); UiApi.OpenApi(); ServiceControllerStatus scs = ServiceControllerStatus.Running; for (; ;) { System.Threading.Thread.Sleep(10000); UiApi.Message(MessageType.INFORM, "test"); scs = scs == ServiceControllerStatus.Running ? ServiceControllerStatus.Stopped : ServiceControllerStatus.Running; } #endif } catch (Exception e) { Log.Main.Error(e); } }