• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

TaskBar at Window?


I know there exists a msg called ABN_STATECHANE to allow us to notify the taskbar's autohide or always-on-top state has been changed.

However, I don't know to how to catch this msg in my application. Until now, I have tried to catch this msg at the function PreTranslateMessage()  but it is not successfully.

I have read some articles which have pointed out that I can catch this msg at the window proc. What is window Procedure? How can I use this function?

  • 2
1 Solution
Vinayak KumbarSr Program ManagerCommented:

I dont know how exactly u can map that message :-(

But U can put the following code to check the state of the task bar. U can put it in timer or thread to continously monitor the state.

APPBARDATA appbardata;      
appbardata.cbSize = sizeof(APPBARDATA);

UINT state = (UINT)SHAppBarMessage(ABM_GETSTATE , &appbardata);

if(state == ABS_ALWAYSONTOP)
else if(state == ABS_AUTOHIDE )
else if(state == 3 )
      AfxMessageBox("ABS_AUTOHIDE and ABS_ALWAYSONTOP");

Try it out.
The Window procedure is defined like this:

LRESULT CYourClass::WindowProc(UINT message, WPARAM wParam, LPARAM lParam;

Just override WindowProc and then you can check the message parameter for ABN_STATECHANGE...

let me know if that works for you...
ABN_STATECHANE is a notification message only sent to an appbar. When using ABM_NEW to register a new appbar, you specify the message identifier that the system should use to send the notification messages, of which the wParam parameter is the notification code, such as ABN_STATECHANGE. You may use Spy++ on a top-level window to verify it. When the Auto hide state of the taskbar is changed, only a WM_SETTINGCHANGE message with SPI_SETWORKAREA is sent.
That's true - I should have been more clear - the application window can't be any old window - it has to be an appbar. the WM_SETTINGCHANGE message is sent to all top level windows when a system setting has changed - you can't just send this message directly to any window, either.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now