Bài viết
Kho tài liệu và bài viết được chia sẻ, đánh giá bởi cộng đồng
Ẩn ứng dụng C# khỏi Task Manager
Nội dung bài viết
Winform
Form1.cs:
Console (Ẩn ra khỏi Processes trong Task Manager)
Nội dung bài viết
Nội dung bài viết
Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.ShowInTaskbar = false;
}
protected override CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle |= 0x80; // Turn on WS_EX_TOOLWINDOW
return cp;
}
}
}
}
12345678910111213141516171819202122232425262728293031
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Hidden
{
internal class Program
{
[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
const int SW_HIDE = 0;
static void Main(string[] args)
{
Console.Write("Margaret Wang");
var handle = GetConsoleWindow();
// Hide
ShowWindow(handle, SW_HIDE);
Console.ReadKey();
}
}
}
1234567891011121314151617181920212223242526272829
Nội dung bài viết
Để sử dụng tính năng này, Bạn cần đăng nhập bằng tài khoản Howkteam.
Đăng nhập
Để xem được nội dung và giúp Kteam duy trì hoạt động.
Bạn vui lòng tắt Adblock trên website howkteam.vn nhé!