If the task pane you are watching is Task Pane created by your code than you can track the activation/deactivation via the following events:
You can also get the windows handle of the task pane: TaskpaneView::GetTaskpaneViewWnd and check the visibility through Windows API.
But you cannot find which of the standard task panes is currently active unless monitoring the command messages via Windows API.
this is perfect.
Have a nice day