Answer the question
In order to leave comments, you need to log in
Hide the graphical shell of the program?
Good afternoon,
The question arose, is it possible to start the process of the program without its graphical shell?
For example: run bittorent, the program works fully, distributes peers, that is, all functions, but without a graphical shell, only a process in the dispatcher.
I heard you can use .NET and class Process, but how exactly?
Answer the question
In order to leave comments, you need to log in
static int hWnd = 0;
private const int SW_HIDE = 0;
private const int SW_SHOW = 5;
[DllImport("User32")]
private static extern int ShowWindow(int hwnd, int nCmdShow);
static void Main()
{
Process proc = Process.Start("notepad");
Console.WriteLine("Press any key"); Console.ReadKey();
foreach (Process pr in Process.GetProcesses())
{
if (pr.ProcessName == "notepad")
{
hWnd = pr.MainWindowHandle.ToInt32();
ShowWindow(hWnd, SW_HIDE);
}
}
Console.WriteLine("Press any key"); Console.ReadKey();
if (hWnd != 0)
{
ShowWindow(hWnd, SW_SHOW);
hWnd = 0;
}
Console.WriteLine("Press any key"); Console.ReadKey();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question