Dispose the handle on exit of application using c#
<p>I am using the below code to block the taskbar which is working perfectly.
But since my application is running in background, the only way to exit the application
is by killing the .exe from task manager. So while exiting like this, the blocked task bar remains at the same state. But actually it shud resume the taskbar on exiting the application.</p>

<p>The reason i am doing this is, it is a kiosk application.</p>

<p>what is the way to overcome this.</p>

<pre><code>public class Taskbar
{
    [DllImport("user32.dll")]
    public static extern int FindWindow(string className, string windowText);
    [DllImport("user32.dll")]
    public static extern int ShowWindow(int hwnd, int command);

    public const int SW_HIDE = 0;
    public const int SW_SHOW = 1;

    public int _taskbarHandle;
    protected static int Handle
    {
        get
        {
            return FindWindow("Shell_TrayWnd", "");
        }
    }

    public Taskbar()
    {
        _taskbarHandle = FindWindow("Shell_TrayWnd", "");
    }

    public static void Show()
    {
        ShowWindow(Handle, SW_SHOW);
    }

    public static void Hide()
    {
        ShowWindow(Handle, SW_HIDE);
    }
}
</code></pre>
