473,653 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shutting down whilst copying a file

I've written a Windows Application in C#.net that runs in the
background and silently archives files to a network drive (using the
System.IO.File. Copy function).

Sometimes, users may run this application when connected to our
network via a dial-up connection. This means that files take a long
time to copy.

If users try and shut down their computer whilst a file is copying, an
error message is shown and the only way to shut down the computer is
by killing the application using Task Manager.

I would like to show the user a dialog box, asking if they want to
wait for the file to finish copying or abort the copy and shut down
their computer.

Is there any way of doing this?

Thanks,

Richard Jonas
Jul 21 '05 #1
2 1478
This article[1] should help, but you'll have to tweak it a bit.

[1]
http://www.codeproject.com/csharp/Sy...ntsHandler.asp

Jul 21 '05 #2
"Jamin Guy" <ja******@gmail .com> wrote in message news:<11******* *************** @f14g2000cwb.go oglegroups.com> ...
This article[1] should help, but you'll have to tweak it a bit.

[1]
http://www.codeproject.com/csharp/Sy...ntsHandler.asp


Thanks - I'll add a handler for the SessionEnding event and see if this works.

Richard
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
18634
by: Jesper | last post by:
Does anyone know some c++ code for shutting down windows? I want to write a program using borland c++ builder to shut down windows. --
1
2058
by: mikelostcause | last post by:
I'm working on shutting down an app that runs in the system tray, I have no problems shutting down, but I have problems saving data first. if the base.WndProc(ref m) is placed at the top, it closes, but the system does not continue to shutdown and it does not save the data via the Logout() funtion. If the base.WndProc(ref m) is placed at the bottom, it closes correctly, but doesn't seem to perform the Logout function. protected...
2
305
by: Richard Jonas | last post by:
I've written a Windows Application in C#.net that runs in the background and silently archives files to a network drive (using the System.IO.File.Copy function). Sometimes, users may run this application when connected to our network via a dial-up connection. This means that files take a long time to copy. If users try and shut down their computer whilst a file is copying, an error message is shown and the only way to shut down the...
4
3402
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify icon in the system tray and it uses Application.Run() to keep the message loop running. When the user clicks the icon, the application should shut down and exit. So far that works fine.
7
4262
by: Mark | last post by:
It is possible from a .NET application to prevent Windows from shutting down? I understand that a .NET application can "know" that windows is initiating the process of to shutting down - but what about *preventing* that shutdown? (and yes - I know the user can always unplug the machine) Thanks.
3
3177
by: leocwh | last post by:
Dear all, I would like to know how to run the execuatable before windows shutting down. Here is my simple code: Private Sub Command1_Click() Shell "C:\abc.bat", vbNormalFocus End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
2
13658
by: Jack | last post by:
Sorry for the double post (also in the IIS group). We've got an ASP.Net 2.0 app running on IIS6. We kept losing sessions, and enabled health monitoring to see what was happening. This morning the got the following in the logs. Any idea what would cause it? Event code: 1002 Event message: Application is shutting down. Reason: Hosting environment is shutting down. Event time: 7/17/2007 10:28:37 AM
4
3695
by: Larry Bud | last post by:
Not sure where else to post this.... One of our developers quit and I'm taking over stuff from him. He had a COM app that would lock files on occasion (yeah, thanks for leaving that in production instead of finding the real problem)... anyway, the "fix" was to shut down the com app when it would lock the file. Any way to do that from a command line?
2
2012
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I am monitoring web apps with the windows event log and noticed several (Hosting environment is shutting down) statements. The server appears to still be running, just wondering any ideas on what can cause this, thanks. -- Paul G Software engineer.
0
8370
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8590
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4147
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.