Execute Script On Shutdown?
Feb 28, 2009
I have a fully working application which runs in the background while a user is logged in. What I need the application to do, is disconnect itself from the database, save the users settings and close itself when the user shuts the computer down or logs off.I know how to do those things, the issue I am facing is figuring out how to detect when the computer is logging off or shutting down. I thought about using log off scripts to do this but then it would be impossible to call classes and methods from my application as the log off scripts are not associated with my application at all. Are there any other methods of telling my application when the computer is shutting down and then run some lines of code?
View 6 Replies
ADVERTISEMENT
Feb 25, 2010
[Code]...
how can i get this code to return all values instead of just the first value ?
View 30 Replies
Aug 1, 2009
How to block shutdown using vb.net?
View 1 Replies
Sep 13, 2010
Shutting down a pc in vb.net is easy:Process.Start("shutdown", "-s -t 00")less the user has locked the pc in which case the above fails.How do I get around this in vb.net? How do I shutdown a locked PC?
View 5 Replies
Jun 11, 2010
I am making a program that takes a time input from the user or a countdown amount and when that time comes it will shutdown or restart or log off the computer. I know how to make the timing code and everything else but i don't know how to shutdown or restart or log off.
View 1 Replies
Jun 11, 2011
I'm currently writing a small system tray app that needs to shutdown my PC at a certain time. That bit's easy:Process.Start("shutdown", "-s -t 00")But how do I do this when my PC is locked? The above doesn't work and I don't want to leave my PC unlocked and unattended
View 1 Replies
Apr 30, 2007
Can I call shutdown.exe by using GetProccessByID? If so, what is the code(In VB 2005)?
View 3 Replies
Feb 23, 2011
I've written a program which I propose to give a local club, which sadly may be'attractive' to pirates so I propose to build in some sort of anti-copying feature.My idea is to hide a file in a folder somewhere in the club's laptop, then on program start up I'll check to see if that file exists and if it's not there, which it's unlikely to be on a pirates machine, I'll flag up a message box saying that if they have a legitimate reason to install the program on a different machine they'll have to contact myself.By way of nuisance value, pressing the 'OK' button on the message box will cause the machine running, what I'm assuming is a pirated copy, to shut down.I've been looking at the VB.NET forum and MSDN for ideas as to how to achieve this and the general opinion seems to be:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("shutdown", "-s")
[code].....
View 23 Replies
Aug 3, 2010
How do I control the ShutDownStyle property of Windows Forms Applications created with vbc.exe?
View 1 Replies
Aug 30, 2009
I've created a shutdown manager with 4 buttons , standby , shutdown , restart and exit.
But ,when i click one of the buttons ,i want to display a message and give the user a message "Are your sure you want to restart" and have a yes/no option.[code]...
View 14 Replies
Sep 19, 2011
I have a question about the keyboard and mouse, is it able to block input from the keyboard and mouse with a visual basic code?
(no typing or clicking etc)
if it works please post the code.
I'm looking forward to receiving your reply.
View 6 Replies
Oct 14, 2010
How to remote shutdown a PC in a network using vb .net?
View 5 Replies
Jan 8, 2010
I have a program with the line process.start("shutdown", "-s -f -t 00") However, when it's executed, everything exits, and the logging off text appears, then the screen blackens out and there's only the mouse pointer. Nothing can be done like opening the task manager, I just have to shut it down using the main button, holding it for 7 sec.
View 12 Replies
Dec 5, 2009
how to shutdown / restart with a non-admin acount using vb net code? logof is not needed because the logoff is alow!
View 8 Replies
Mar 2, 2010
I ve to shut down the remote system of a network.. so i need the full vb.net source code to make it possible ..
View 2 Replies
Apr 8, 2011
My app is having problems shutting down in a WinXP environment. I thus want to simulate a Windows shutdown in the VB.Net IDE and then debug my code but is this possible?
View 1 Replies
Jul 16, 2010
I've been making a program and for it I need to be able to detect shutdown. I've been told to do vbAppWindows etc. but there's a problem. For some reason it says "vbAppWindows is not declared" Does anyone have another way of doing it?Then I've used my.settings throughout the program and it has just started to not work. It wont save anymore.
[Code]...
View 5 Replies
May 8, 2009
Is there any way to turn off a remote pc that's not by using shutdown /s /m \computer name etc...I just want to turn off the server computer at night from my laptop. Is it possible to make the program check for pings and then shutdown? Or is there an easier way? (Maybe if I'm not on the local network send over a "signal"(?) to the pc so that it'll shut down..?)
View 6 Replies
Dec 24, 2009
I'm trying to create a way for the User of my application to Log Off, Shutdown, or Restart the PC.
The idea is that User can more quickly access these options from my application and if they choose, force these actions instead of waiting for the OS to respond.
Here's how I'm trying to do it:
CODE:
Log Off works just fine. It's shutdown and restart that doesn't work. From the research that I've done, the Consts seem fine and the function obviously works correctly because Log Off works. I am running the application as an administrator, so that should affect it.
View 5 Replies
Aug 8, 2009
I was woundering if there is anyway via VB.net to have only two option on vista's shutdown menu. I only need "Logoff" and "Hibernate". just woundering if there was anyway possible to have these two options.
View 5 Replies
May 27, 2008
I was just wondering if there was a way to shutdown different computers that were on your network through writing a custom vb application.If so, what do I need to look into, such as certain objects and such.
View 26 Replies
Jun 3, 2011
I made a little VB app to shutdown a laptop after it has been powered on for 2 1/2 hours, and giving the user a little over 8min warning that it is about to be shutdown. However I have nothing in place to stop the user from restarting the device once it is shutdown. What I would like to integrate in this, is a sort of memory where if the user doesn't wait at least 30 minutes, the shutdwon will re-iniate immediatly.
I included the code I did so far.
Public Class Form1
Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
[Code].....
View 2 Replies
Nov 1, 2011
I've got a List(Of IWorker) which contains a number of concretes. IWorker in turn has a Startup() and Shutdown() method.Inside the Worker class, Startup() creates a new worker thread then returns. Shutdown() presently sets a private ShutDownRequested flag and returns. The flag is checked by the worker thread (at worst every few seconds).This all works fine but at present the parent app has no way to determine if the Worker has finished shutting down.I can see a number of ways around this but am not sure what the best one is.Add a State property to IWorker. Should work but I'm going to be polling states which seems a little nasty.Make the shutdown command blocking - Would probably be my ideal solution but I'm not sure how to implement it - does the worker Sunclock a private object which Shutdown() should also try to Synclock after setting the flag?
View 3 Replies
Apr 5, 2012
I am trying to capture SHUTDOWN and LOGOFF Events, so that I can be alerted when my process stops. The below code works in detecting these events. I am trying to get it to release the monitoring of the system events after the email has been sent, Being newer to VB, I am not sure how to do this. I copied this code from another google forum.
[Code]...
View 3 Replies
Sep 7, 2011
My main Application A starts a 3rd party Application B that runs as a console application. So I don't have access to the Application B source code. When specific things happen in Application A, I can properly launch a vb.net Application C that I built, which properly shuts down Application B, by sending a Ctrl-C signal to it, the same as hitting Ctrl-C in a console window. But I cannot have this occur on Windows shutdown because Application B shuts down on its own before I even have the chance to launch Application C to shut it down. Is there a way to keep some kind of control over Application B when I launch it, or any way to have it be last in the shut down of programs in Windows?
View 1 Replies
Feb 5, 2010
is there a way to detect if the user is shuting down?
View 1 Replies
May 28, 2009
I have an application that starts from Sub Main and I need to run a sub when the system is about to shut down, restart or logoff so it can save it's settings. I found some code on google:
Imports Microsoft.Win32
Public Sub Main
AddHandler SystemEvents.SessionEnding, AddressOf OnShuttingdown
[code].....
View 4 Replies
Mar 9, 2009
Alright im trying to make it where in Visual Basic 2008 you click on a box ether 10, 20, or 30. Then that tells a timer that the program needs to turn off in 10, 20, or 30 minutes. What I basically want it to do is, whenever the set amount time is when it goes off it shows form1(login form). I have prepared a picture can anyone supply me with some information on how to do this?
View 14 Replies
May 25, 2009
I typically prompt the user to save changes in the FormClosing event in MDI children. The application updater uses a Process.CloseMainWindow call to close the application if it's running before the patch update is applied.
I need to detect when the updater is closing the application and NOT prompt the user to save changes but save them automatically. I've tried using the System.Windows.Forms.CloseReason but this method isn't working for me. I capture the CloseReason in the MDI Parent FormClosing event but it's called AFTER the MDI children are told to close. I tried capturing the CloseReason (e.CloseReason) in the MDI child's FormClosing event but it registers as MDI Parent closing and a normal application exit is also going to raise this same e.CloseReason so I can't auto-save here either.
So my question is: How can I detect this Process.CloseMainWindow being used to close my application so that I can bypass all save prompts and save automatically? What is the first event called in this method of closing so that I can signal all MDI children that are open in their FormClosing event to just save?
View 1 Replies
Jan 13, 2011
I need some general advice about using ListView. The program was originally written in VB2002, but now it's running in VB2008.The results of my program would typically be a ListView of 30 lines by 8 columns. I need to be able to save this data so that it persists after I close the program. There will never be a need to manipulate the data, so I'm looking for something simple. (There will be a need to print it.) I'm presuming that I need to link to a database to save the data. Correct? If so, can I use the one in Microsoft Works (which I already have), or do I need to get Microsoft Access, or is there some other better (simpler?) alternative?
View 7 Replies