I have a timer that updates the UI so I only want it it to be running when the window is visible. I have set up my OnShowWindow function to set and kill the timer as appropriate. The strange thing is, OnShowWindow is only being called when I start and close the application; not when I minimize, maximise, cover or uncover the window.

Any ideas why this could be?

Code:
afx_msg void CMainWin::OnShowWindow( BOOL bShow, UINT nStatus )
{
	if(bShow)//Window has been made visible
	{
		MessageBox("Show");		
		int timerConf = SetTimer(IDT_TIMER_MAIN, 250, 0);
		if(timerConf ==0)
		{
			MessageBox("Timer did not start");
		}
		
	}
	else
	{
		MessageBox("Hide");		
		KillTimer(IDT_TIMER_MAIN);
		
	}
}