/// <summary>
 /// Sets the progress state of the specified window's
 /// taskbar button.
 /// </summary>
 /// <param name="hwnd">The window handle.</param>
 /// <param name="state">The progress state.</param>
 public static void SetProgressState(IntPtr hwnd, Interop.ThumbnailProgressState state)
 {
     if (Windows7OrGreater)
     {
         TaskbarList.SetProgressState(hwnd, state);
     }
 }
        private void SetStateInTB()
        {
            if (MainWindowHandle == IntPtr.Zero)
            {
                return;
            }

            Interop.ThumbnailProgressState thmState = Interop.ThumbnailProgressState.Normal;

            if (!_showInTaskbar)
            {
                thmState = Interop.ThumbnailProgressState.NoProgress;
            }
            else if (Style == ProgressBarStyle.Marquee)
            {
                thmState = Interop.ThumbnailProgressState.Indeterminate;
            }
            else if (m_State == ProgressBarState.Error)
            {
                thmState = Interop.ThumbnailProgressState.Error;
            }
            else if (m_State == ProgressBarState.Pause)
            {
                thmState = Interop.ThumbnailProgressState.Paused;
            }

            Windows7Taskbar.SetProgressState(MainWindowHandle, thmState);
        }