So IF CheckStartMethod will work so that I know if I have start my App from windows, command prompt or as an service, everything will work.
Have anyone any idea how to get this information ? Please.
Lets say that i forse CheckStartMethode to return any string (cmd, win or service), everything work as well. But I can't figure how to know from where the application as been started....
Expand|Select|Wrap|Line Numbers
- [STAThread]
- static int Main(string[] args)
- {
- startmethod = CheckStartMethod();
- if (startmethod == "cmd")
- {
- Scan scan = new Scan();
- scan.Run();
- }
- if (startmethod == "win")
- {
- ShowWindowsForm();
- }
- if (startmethod == "service")
- {
- ServiceBase[] ServicesToRun;
- ServicesToRun = new ServiceBase[] { new MainService() };
- ServiceBase.Run(ServicesToRun);
- }
- return 0;
- }