Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Tim, here are some <code>P/Invoke</code> calls I found helpful to show &amp; hide the <code>HHTaskBar</code> and the <code>MS_SIPBUTTON</code>:</p> <pre><code>[DllImport("coredll.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags); [DllImport("coredll.dll", EntryPoint = "FindWindowW", SetLastError = true)] public static extern IntPtr FindWindowCE(string lpClassName, string lpWindowName); public enum WindowPosition { SWP_HIDEWINDOW = 0x0080, SWP_SHOWWINDOW = 0x0040 } </code></pre> <p>Here is the wrapper I wrote for it:</p> <pre><code>static IntPtr _taskBar; static IntPtr _sipButton; static void ShowWindowsMenu(bool enable) { try { if (enable) { if (_taskBar != IntPtr.Zero) { SetWindowPos(_taskBar, IntPtr.Zero, 0, 0, 240, 26, (int)WindowPosition.SWP_SHOWWINDOW); // display the start bar } } else { _taskBar = FindWindowCE("HHTaskBar", null); // Find the handle to the Start Bar if (_taskBar != IntPtr.Zero) { // If the handle is found then hide the start bar SetWindowPos(_taskBar, IntPtr.Zero, 0, 0, 0, 0, (int)WindowPosition.SWP_HIDEWINDOW); // Hide the start bar } } } catch (Exception err) { // log my Error (enable ? "Show Start" : "Hide Start", err); } try { if (enable) { if (_sipButton != IntPtr.Zero) { // If the handle is found then hide the start bar SetWindowPos(_sipButton, IntPtr.Zero, 0, 0, 240, 26, (int)WindowPosition.SWP_SHOWWINDOW); // display the start bar } } else { _sipButton = FindWindowCE("MS_SIPBUTTON", "MS_SIPBUTTON"); if (_sipButton != IntPtr.Zero) { // If the handle is found then hide the start bar SetWindowPos(_sipButton, IntPtr.Zero, 0, 0, 0, 0, (int)WindowPosition.SWP_HIDEWINDOW); // Hide the start bar } } } catch (Exception err) { // log my Error Wrapper(enable ? "Show SIP" : "Hide SIP", err); } } </code></pre> <p>And finally, here is how I use it:</p> <pre><code>/// &lt;summary&gt; /// The main entry point for the application. /// &lt;/summary&gt; [MTAThread] static void Main() { ShowWindowsMenu(false); try { Application.Run(new Form()); } catch (Exception err) { // Log my error } finally { ShowWindowsMenu(true); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload