473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems Shutting down a Sys Tray app

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(re f 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(re f m) is placed at the bottom, it closes correctly, but
doesn't seem to perform the Logout function.

protected override void WndProc(ref Message m)
{
//base.WndProc(re f m); ----------placed at the top position
switch(m.Msg)
{
case WM_SYSCOMMAND:

switch(m.WParam .ToInt32()){

case SC_SCREENSAVE:
Logout();
break;

case SC_MONITORPOWER :
Logout();
break;

default:
break;
}
break;

case WM_QUERYENDSESS ION:
this.flagBoolea n1 = true;
Logout();
break;

case WM_WTSSESSION_C HANGE:
this.flagBoolea n1 = true;
Logout();
break;

}
base.WndProc(re f m); ----------placed at the bottom position
}

the Logout() function consists of a call to a website.
Nov 17 '05 #1
1 2057
Is there anyway to hold the base.WndProc(re f m) until after the Logout()
finishes loading the webpage?? any takers??


"mikelostca use" wrote:
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(re f 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(re f m) is placed at the bottom, it closes correctly, but
doesn't seem to perform the Logout function.

protected override void WndProc(ref Message m)
{
//base.WndProc(re f m); ----------placed at the top position
switch(m.Msg)
{
case WM_SYSCOMMAND:

switch(m.WParam .ToInt32()){

case SC_SCREENSAVE:
Logout();
break;

case SC_MONITORPOWER :
Logout();
break;

default:
break;
}
break;

case WM_QUERYENDSESS ION:
this.flagBoolea n1 = true;
Logout();
break;

case WM_WTSSESSION_C HANGE:
this.flagBoolea n1 = true;
Logout();
break;

}
base.WndProc(re f m); ----------placed at the bottom position
}

the Logout() function consists of a call to a website.

Nov 17 '05 #2

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

Similar topics

10
18630
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. --
4
5841
by: Claire | last post by:
Running XP pro, SP2. Visual studio .NET 2003. App written in C# I have written an application that hides itself when run and shows a notification icon in the system tray. If the main form is visible/restored to the desktop, and I tell windows to restart, windows shuts down fine. If the main form is minimized to the tray and I tell windows...
7
6863
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray icon. I've had a look at the example on code project that creates an application that runs in the system tray: ...
2
1046
by: Simon Verona | last post by:
I have a program that sits in the system tray and spawns off a number of sub processes. For some reason, when this is running on a system, Windows will not shutdown without manually shutting it down. Is there some way within my code that I can pick up that Windows wants to shut down and then do an orderly shutdown of the processes? ...
0
1089
by: Sidney | last post by:
Dear, I am writting a system which opened at the system tray. But every before I shut down my computer, I have to close the system first. However, it should be automatically close when I shutting down my system. So, I want to know how I can do so that it can close up itself when the computer shut down. Thank You!! Sidney
4
3400
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...
3
3174
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)
1
1237
by: William LaMartin | last post by:
Something very strange has happened to Visual Studio Professional 2005 on my laptop. I need to get it figured out since I am on the road and don't have access to my desktop computer or my VS disks. I was working with a Windows project and debugging fine. I only made a few minutes worth of changes (and did nothing to the VS setup as far as...
2
13654
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...
0
7915
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...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
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...
0
8220
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...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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

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.