[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
/*
Hide = 0,
ShowNormal = 1,
ShowMinimized = 2,
ShowMaximized = 3,
Maximize = 3,
ShowNormalNoActivate = 4,
Show = 5,
Minimize = 6,
ShowMinNoActivate = 7,
ShowNoActivate = 8,
Restore = 9,
ShowDefault = 10,
ForceMinimized = 11*/
then:
private void HideServices()
{
Process[ procs = Process.GetProcessesByName("cmd");
foreach (Process p in procs)
{
IntPtr pFoundWindow = p.MainWindowHandle;
ShowWindow(pFoundWindow, 0);
}
}
In this code what i did was hide all the services of the CommandLine... all the cmd processes will be hidden..