Skip to content

Instantly share code, notes, and snippets.

@puppis42
Created May 26, 2023 17:42
Show Gist options
  • Save puppis42/8e6c0c022f5b38d3e26e95c00291c151 to your computer and use it in GitHub Desktop.
Save puppis42/8e6c0c022f5b38d3e26e95c00291c151 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Hide
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent,
IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
private void button1_Click(object sender, EventArgs e)
{
IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
ShowWindow(hWnd, 0);
}
private void button2_Click(object sender, EventArgs e)
{
IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
ShowWindow(hWnd, 5);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment