CSS
Im trying to make a show/hide window but no way to make work a show window when i hide it. I already read in many forums but no way to do it work, sone one can help???Code
Code
private const int SW_HIDE = 0;Code
private const int SW_SHOW = 5;Code
[DllImport("User32")]C#
private static extern int ShowWindow(int hwnd, int nCmdShow);Code
//WORKINGCode
private void button1_Click(object sender, EventArgs e)Code
{Code
int hWnd;Code
Process[] processRunning = Process.GetProcesses();Code
foreach (Process pr in processRunning)Code
{Code
if (pr.ProcessName == "notepad")Code
{Code
hWnd = pr.MainWindowHandle.ToInt32();Code
ShowWindow(hWnd, SW_HIDE);Code
}Code
}Code
}Code
//NOT WORKINGCode
private void button2_Click(object sender, EventArgs e)Code
{Code
int hWnd;Code
Process[] processRunning = Process.GetProcesses();Code
foreach (Process pr in processRunning)Code
{Code
if (pr.ProcessName == "notepad")Code
{Code
hWnd = pr.MainWindowHandle.ToInt32();Code
ShowWindow(hWnd, SW_SHOW);Code
}Code
}Code
}
Nishant MittalRank #692 · 3.5K reputationPosted Dec 6, 2015, 7:47 PM EST