You're right. This is (with little difference) the way my SndVol33 works. You can check this program at http://users.info.kuzbass.net/~nav/. I wrote it long time ago, and it don't work under XP. IMHO - it's better to use DeskBand for such tasks.
Well - this will be a bit off topic - but in my oppinion you should reconsider that.
If user keeps his taskbar hidden ussually he wants it to be hidden - and this user can find your application irritating if it would be restoring something that is soppoused to be hidden.
Just my point of view
Then detection will fail - BUT this class is able to detect that is run under XP and if so - it will return you a point of hide/unhide button. In my case balloon messages comming from this button were looking perfect (like your tray icon was trying to shout from a grave ;-D)