-
Mar 13th, 2018, 02:29 PM
#1
Thread Starter
Hyperactive Member
Need help with Application as Service
Hi guys,
I'm trying to build a service app (Formless) that will run in the background when Windows starts (before user login):
1. I need it to be able to display messages on Windows 10 lockscreen
2. I need it to be able to call (or load) another application
3. Depending on computer name, load the second app in a specific size and location on screen
I don't really know where to start...
-
Mar 13th, 2018, 06:42 PM
#2
Re: Need help with Application as Service
2. Use Process.Start
3. Use My.Computer.Name, and for the size/location it depends on the application... if it is one you wrote, it would be easiest to modify that application.
-
Mar 14th, 2018, 08:08 AM
#3
Thread Starter
Hyperactive Member
Re: Need help with Application as Service
Originally Posted by si_the_geek
2. Use Process.Start
3. Use My.Computer.Name, and for the size/location it depends on the application... if it is one you wrote, it would be easiest to modify that application.
Thanks for the reply,
I know how to do 2, that is not a problem
But 3, it doesn't matter if I wrote it (which I did), it is a compiled application, so I can't play with the sizing of it if I call it with "Process.Start".
So I'm testing an option of making the whole 2nd application into a DLL so I can Import it as a Reference into the service app (or at least that is the plan...).
But I'm really stuck with the service app part...
-
Mar 14th, 2018, 08:24 AM
#4
Re: Need help with Application as Service
Are you looking at actually writing a windows service to achieve these things? If you are then there are a few points you should consider...
You need to be very careful when writing a service and getting it to interact directly with things like the lock screen or running another app. A service isn't designed to have a UI and isn't designed for direct user interaction, they run under their own desktop and user credentials.
If you want something to appear on the lock screen then you are better off creating a lock screen app that can communicate with the service rather than having the service attempt to modify the lock screen.
Getting the service to load an application isn't difficult but getting this application to then appear on screen isn't something a service should be doing, the application will effectively be running under the identity of the service and this can lead to various security exploits.
-
Mar 14th, 2018, 10:35 AM
#5
Thread Starter
Hyperactive Member
Re: Need help with Application as Service
Originally Posted by PlausiblyDamp
Are you looking at actually writing a windows service to achieve these things? If you are then there are a few points you should consider...
You need to be very careful when writing a service and getting it to interact directly with things like the lock screen or running another app. A service isn't designed to have a UI and isn't designed for direct user interaction, they run under their own desktop and user credentials.
If you want something to appear on the lock screen then you are better off creating a lock screen app that can communicate with the service rather than having the service attempt to modify the lock screen.
Getting the service to load an application isn't difficult but getting this application to then appear on screen isn't something a service should be doing, the application will effectively be running under the identity of the service and this can lead to various security exploits.
Thanks for the reply,
The service app has no GUI, or any way to interact with it (all it does is monitor a file for changes, and when it does, it loads the second app (a DLL app) (and depending on the computer name, closes it after 30sec...)
A. Will the second app still run under the identity of the service?
B. How do I create a VB.NET lock screen app?
C. How do I update the DLL file on runtime?
-
Mar 14th, 2018, 12:00 PM
#6
Re: Need help with Application as Service
Originally Posted by threeeye
But 3, it doesn't matter if I wrote it (which I did), it is a compiled application, so I can't play with the sizing of it if I call it with "Process.Start".
In a way you can... you can decide on the size in the service, and pass the values as command line parameters via Process.Start, and in the other application read them using Environment.GetCommandLineArgs, then set the size using them.
-
Mar 20th, 2018, 03:16 PM
#7
Thread Starter
Hyperactive Member
Re: Need help with Application as Service
I have my Form in DLL.
I open it with:
Code:
If IsFormOpened = 0 Then
Dim f As New SQL_Stored_Procedure.Form1
f.Show()
f.WindowState = FormWindowState.Normal
f.Size = New Drawing.Size(Screen.PrimaryScreen.Bounds.Width / 5, Screen.PrimaryScreen.Bounds.Height * 0.85)
f.Location = New Drawing.Point(Screen.PrimaryScreen.Bounds.Width - (Screen.PrimaryScreen.Bounds.Width / 4.8), (Screen.PrimaryScreen.Bounds.Height * 0.075))
IsFormOpened = 1
End If
And close it with:
Code:
Dim openForms = Application.OpenForms.OfType(Of SQL_Stored_Procedure.Form1)()
While openForms.Any()
openForms.First.Close()
End While
IsFormOpened = 0
But if you click on the x in the DLL Form, IsFormOpened will not change to 0.
So I need to pass data (String, Int and/or Boolean) to and from the DLL
Any idea how to do that?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|