Tray Icon and restoring to maximized position
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=14758
Printed Date: 12 December 2024 at 1:40pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Tray Icon and restoring to maximized position
Posted By: mitcheljh
Subject: Tray Icon and restoring to maximized position
Date Posted: 16 July 2009 at 11:41am
I'm encountering an odd situation with my application with the tray icon. It seems that the when I restore the app from the tray icon which was minimized from a maximized position, the application is restored to the window position BEFORE the application was maximized, not the maximized position. I can never restore the application (from the tray icon) to a maximized state.
The Demo application TrayIconDemo doesn't have this problem, so it's something unique to my application.
I've traced through CXTTrayIcon::MinimizeToTray() and CXTTrayIcon::MaximizeFromTray().
In MinimizeToTray(), the rectangle rectFrom, returned from GetWindowRect() has the correct dimensions of my maximized application.
But, when restoring from the tray icon, in MaximizeFromTray(), GetWindowRect() returns a rectangle of the dimensions that my application was in BEFORE I maximized it, not the maximized dimensions.
It seems like it could be an issue that windows is not saving the dimensions of my maximized window. But when I minimize and maximize without using the tray icon, this problem doesn't occur.
I checked my application and I can't find anywhere that I'm manually setting the windows position that would cause this issue.
Thanks
|
Replies:
Posted By: mitcheljh
Date Posted: 16 July 2009 at 1:48pm
Sorry for posting my question prematurely.
I just discovered the problem.
I needed to derive a new class from CXTTrayIcon, and override CreateMinimizedWnd() to do nothing but return true, as in the demo application.
After doing this, the application window is now minimizing from, and maximizing to, a fully maximized window properly.
Thanks.
|
|