Click here to Skip to main content
15,923,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an application with GUI that it must run for long term on the most top of the interface i used to use windows services to run long term background application but this time i have a gui with, i have i separate gui and another one is the controller that controls the flow of the ui screens and do some background operations, so if anyone had any idea on how to run gui application for long term and i have to launch the application once the system runs after reboot.

till now i have no idea on how to run the application for long term and shutdown and starting and what ever the windows service do



please any help is graceful i have another idea but i do not like to use it for now
Posted
Comments
[no name] 30-Jul-12 14:43pm    
So your question is how to use the Startup folder or the Run registry key?
fjdiewornncalwe 30-Jul-12 15:00pm    
Can't the Windows Task Scheduler be used in this situation? I'm not entirely sure because I don't tend to use it much, but I figure someone else may be able to give more information along these lines.

1 solution

As I understand, you call long-term run the application which keeps executing as people login and logout and starts running after reboot. You can do so with the Windows Service, not with the UI application. (After all, it the users logout, there is no a desktop to he a UI parent; and who would interact with such application?)

So, you will need to have such UI started only when someone login. You can trigger executing such application form your service, in response to system events. To handle such events, your Windows Service application can use the class Microsoft.Win32.SystemEvents. To handle user login/logout events, you need to add handlers to some or all of the session events: SessionEnded, SessionEnding or SessionSwitch:
http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.aspx[^].

I would advise to make such UI application a thin client of your Windows Service application, as thin as possible — pure UI. All application logic, persistence, etc. — should better reside in the Windows Service application. The UI application can communicate to your Windows Service via IPC, which can be based on sockets, named pipes, classical remoting or WCF self-hosted by the Windows Service application.

—SA
 
Share this answer
 
Comments
Waleedkassem 30-Jul-12 21:53pm    
thank you dear, what i am looking for is when the account is logged on i need to open user interface and the idea of windows service only to run or close the application, i have done the application and i have separated it into two part one logical operations and the other for ui i have in my mind your idea about pipes or anything over tcpip but i must not use these technologies "i do not know why" so i decided to find something similar to your suggestion that only the windows service launch or close the other application for ui

thank you
Sergey Alexandrovich Kryukov 30-Jul-12 22:04pm    
Sorry, but if you really "must not use these technologies" (would be good it you specified what "these" means) "do not know why", you are not qualified to ask such questions.

Sorry if I did not understand you.

As you are using .NET, the most adequate technology in this case would be .NET remoting or self-hosted WCF. From the standpoint of CLR platform(s), using something like Windows messages is simply illegal, because this would break platform compatibility and is based on some Windows weirdness which is the result of rotten old Windows legacy (since it was a shell over DOS) -- the processes should be strictly isolated and communicate only over IPC. So come on, find "something similar", but it can appear illegal technically, even if it works on existing Windows.

I gave you a good advice, it's up to you if you want to make trash out of it. But then again, please excuse me if I did not correctly understand you; in this case, please explain...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900