Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - Tray Icon and restoring to maximized position
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Tray Icon and restoring to maximized position

 Post Reply Post Reply
Author
Message
mitcheljh View Drop Down
Groupie
Groupie


Joined: 20 July 2008
Location: United States
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitcheljh Quote  Post ReplyReply Direct Link To This Post Topic: Tray Icon and restoring to maximized position
    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
Back to Top
mitcheljh View Drop Down
Groupie
Groupie


Joined: 20 July 2008
Location: United States
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitcheljh Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.