Link to home
Start Free TrialLog in
Avatar of rollocool
rollocool

asked on

Having Problems with AnimateWindow

hi

  I want to hide my application on certain conditions when the
application is minimized. Till now i was using ShowWindow to achieve
this and it worked fine. Now when I am using the AnimateWindow API the
window gets hidden but the window's entry in the taskbar remains. I am
posting the code that i have written.

void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
  if ((nID & 0xFFF0) == SC_MINIMIZE)
  {
    if(bMinimizeToTray)
    {
      this->AnimateWindow(200,AW_HIDE |AW_SLIDE | AW_VER_POSITIVE);
     // this->ShowWindow(SW_HIDE);
      return;
    }
  }

 CFrameWnd::OnSysCommand(nID, lParam);

rollocool
Avatar of AlexFM
AlexFM

What happens if you uncomment line ShowWindow(SW_HIDE) ?
Avatar of rollocool

ASKER

hi

 Doesn't make any difference whether i comment or uncomment the ShowWindow(SW_HIDE) line.

i solved the problem myself

 void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
  if ((nID & 0xFFF0) == SC_MINIMIZE)
  {
    if(bMinimizeToTray)
    {
      this->AnimateWindow(200,AW_HIDE |AW_SLIDE | AW_VER_POSITIVE);
// added these 2 lines
      this->ShowWindow(SW_MINIMIZE);
      this->ShowWindow(SW_HIDE);
      return;
    }
  }

 CFrameWnd::OnSysCommand(nID, lParam);

rollocool

ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial