Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » trayicon and shutdown
trayicon and shutdown [message #5571] Wed, 04 October 2006 08:40 Go to next message
atmks is currently offline  atmks
Messages: 33
Registered: July 2006
Member
hi
i have small problem with trayicon example,
when trayicon (or eyecare) is running and i want shutdown
a computer, windows shows a window with message:

  ____________________________________
 |End program - trayicon.exe
 |------------------------------------
 |
 | progress bar
 | ######################
 |
 | If you choose to end program.....
 |                   ---------
 |                  | End now |
 |                   ---------
 |____________________________________

and 2nd message in same window

This program not responding


how can i resolv this?

bye
atmks

[Updated on: Wed, 04 October 2006 08:41]

Report message to a moderator

Re: trayicon and shutdown [message #5572 is a reply to message #5571] Wed, 04 October 2006 10:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
atmks wrote on Wed, 04 October 2006 02:40

hi
i have small problem with trayicon example,
when trayicon (or eyecare) is running and i want shutdown
a computer, windows shows a window with message:

  ____________________________________
 |End program - trayicon.exe
 |------------------------------------
 |
 | progress bar
 | ######################
 |
 | If you choose to end program.....
 |                   ---------
 |                  | End now |
 |                   ---------
 |____________________________________

and 2nd message in same window

This program not responding


how can i resolv this?

bye
atmks



Actually, recently I have encountered similiar problem with TheIDE as well. Maybe something is broken with shutdown/exit code (and it is not TrayIcon related).

Just to explain, shutdown/exit code is montrous U++ implementation feature that forces regular exit of U++ application through GUI_APP_MAIN in case of system shutdown. The problem is that Win32 simply posts a message to application, but then quits it immediately, which is a little bit problematic as you are in the WindowProc at the moment - rest of GUI_APP_MAIN is not performed in that case.

U++ therefore starts "overwatch thread" at the start of Win32 GUI app. This thread opens single off-screen window and its purpose is to keep U++ application "alive" until GUI_APP_MAIN finishes.

This extremely fragile code starts at line 82 of CtrlCore/Win32Wnd.cpp. I will look into it ASAP, but maybe you will notice some problem there too....

Mirek
Re: trayicon and shutdown [message #5722 is a reply to message #5572] Wed, 11 October 2006 07:59 Go to previous messageGo to next message
atmks is currently offline  atmks
Messages: 33
Registered: July 2006
Member
thx Mirek,
but how can i determine system shutdown in
WindowProc, it is possible?

bye
atmks
Re: trayicon and shutdown [message #5723 is a reply to message #5722] Wed, 11 October 2006 08:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Actually, I do not think you should fix it in your client code. This must be fixed in U++ (because the code is already there).

If you want to try some hacking, it is still the code starting at line 82 of CtrlCore/Win32Wnd.cpp - that is the most probable cause of broken behaviour.

Mirek
Re: trayicon and shutdown [message #5740 is a reply to message #5723] Thu, 12 October 2006 05:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
OK, I think I have hunted this bug down (pretty messy bussines, I had to shutdown the computer 20 times to get all needed info Wink.

I think the problem should be fixed by adding two lines at the beginning of GuiSleep routine (Win32Wnd.cpp around line 670):

void Ctrl::GuiSleep(int ms)
{
	if(EndSession())
		return;
....


Please check whether this helps.

Mirek
Re: trayicon and shutdown [message #5741 is a reply to message #5740] Thu, 12 October 2006 10:58 Go to previous messageGo to next message
atmks is currently offline  atmks
Messages: 33
Registered: July 2006
Member
hi,

thx Smile,
i will try it and i hope this will helps me

bye
atmks
Re: trayicon and shutdown [message #5742 is a reply to message #5741] Thu, 12 October 2006 11:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Please do and make a post about results. I want to have this resolved.

Mirek
Re: trayicon and shutdown [message #5773 is a reply to message #5742] Sun, 15 October 2006 12:26 Go to previous messageGo to next message
atmks is currently offline  atmks
Messages: 33
Registered: July 2006
Member
hi,
it doesn't work Sad
sometime i get window about error

bye
atmks

[Updated on: Sun, 15 October 2006 12:27]

Report message to a moderator

Re: trayicon and shutdown [message #5774 is a reply to message #5773] Sun, 15 October 2006 12:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
atmks wrote on Sun, 15 October 2006 06:26

hi,
it doesn't work Sad
sometime i get window about error

bye
atmks



Please, be more specific. Error or that window about application not closing when shutting down Windows?
Re: trayicon and shutdown [message #5776 is a reply to message #5774] Sun, 15 October 2006 16:00 Go to previous messageGo to next message
atmks is currently offline  atmks
Messages: 33
Registered: July 2006
Member
Quote:


Please, be more specific. Error or that window about application not closing when shutting down Windows?




hi
sorry, i mean a window about application not closing

bye
atmks

Re: trayicon and shutdown [message #5777 is a reply to message #5776] Sun, 15 October 2006 17:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
atmks wrote on Sun, 15 October 2006 10:00

Quote:


Please, be more specific. Error or that window about application not closing when shutting down Windows?




hi
sorry, i mean a window about application not closing

bye
atmks




OK, another try:

void Ctrl::ExitWin32()
{
	sFinished = true;
	for(int i = 0; i < Windows().GetCount(); i++) {
		HWND hwnd = Windows().GetKey(i);
		if(hwnd)
			::DestroyWindow(hwnd);
	}
	MSG msg;
	while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		if(msg.message != WM_QUIT)
			::PostQuitMessage(0);
#ifndef flagDLL
#ifndef PLATFORM_WINCE
	OverwatchEndSession.Set();
	PostMessage(OverwatchHWND, WM_USER, 0, 0);
	LLOG("Waiting for overwatch thread to finish...");
	WaitForSingleObject(OverwatchThread, INFINITE);
	LLOG("...overwatch thread finished");
#endif
#endif
}


Seems to work OK for me now, but unfortunately, the problem is too erratic to judge anything... (otoh, the bug in the code seems to be quite obvious and inline with behaviour).

Please check it ASAP.

Mirek
Re: trayicon and shutdown [message #5805 is a reply to message #5777] Tue, 17 October 2006 14:55 Go to previous messageGo to next message
atmks is currently offline  atmks
Messages: 33
Registered: July 2006
Member
hi

its seems ok Smile

thx

Re: trayicon and shutdown [message #5807 is a reply to message #5805] Tue, 17 October 2006 16:08 Go to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
atmks wrote on Tue, 17 October 2006 08:55

hi

its seems ok Smile

thx




Excellent! Thanks to verify.

Mirek
Previous Topic: StateH(OPEN) call missing in Linux
Next Topic: Problem with SetTimeCallback in TrayIcon
Goto Forum:
  


Current Time: Sun May 26 07:36:53 CEST 2024

Total time taken to generate the page: 0.02769 seconds