Hi all.
I thought I posted this yesterday, but it doesn't show up in "My Threads" on the board. If this is a duplicate and the other is somehow hiding from me, I apologize.
I have two questions about some VB .NET programming I'm working on. I have an app that runs at startup (from the Startup folder) and collects some system data. Right now, it runs and then quits once the data is sent to a SQL server.
The first problem is that I'd like to keep the application running, though not doing anything, until it's told to close. I'd like to do this so I can capture the Close event (see the second problem, below). How can I make the app stay open? It's a console application (no need for a form), so it would also need to run in the background hidden from view. I'd like it to not show up in the Applications tab in Task Manager (Processes is fine, obviously).
The second problem is that once it's running, I want to be able to do some final data collection when it is told to close by a logoff or shutdown. I tried to do something like "Private Sub Closing(ByVal...) Handles Me.Close". First, I don't know if Me.Close exists and seconds, VS flags Handles as requiring a WithEvents somewhere. I can't get WithEvents to work anywhere or even know what I'm supposed to do with it. Anyone know how to do this? I'm sure there's a way. Also, related, if I can capture the close event and do something, is there a way to tell why it closed (shutdown, logoff, manually closed)?
Thanks, and please let me know if something is unclear!
I thought I posted this yesterday, but it doesn't show up in "My Threads" on the board. If this is a duplicate and the other is somehow hiding from me, I apologize.
I have two questions about some VB .NET programming I'm working on. I have an app that runs at startup (from the Startup folder) and collects some system data. Right now, it runs and then quits once the data is sent to a SQL server.
The first problem is that I'd like to keep the application running, though not doing anything, until it's told to close. I'd like to do this so I can capture the Close event (see the second problem, below). How can I make the app stay open? It's a console application (no need for a form), so it would also need to run in the background hidden from view. I'd like it to not show up in the Applications tab in Task Manager (Processes is fine, obviously).
The second problem is that once it's running, I want to be able to do some final data collection when it is told to close by a logoff or shutdown. I tried to do something like "Private Sub Closing(ByVal...) Handles Me.Close". First, I don't know if Me.Close exists and seconds, VS flags Handles as requiring a WithEvents somewhere. I can't get WithEvents to work anywhere or even know what I'm supposed to do with it. Anyone know how to do this? I'm sure there's a way. Also, related, if I can capture the close event and do something, is there a way to tell why it closed (shutdown, logoff, manually closed)?
Thanks, and please let me know if something is unclear!