모든 창에 투명도를 설정하려고합니다. 나는 다음과 같은 코드를 가지고있다.C#에서 해당 핸들로 창 투명도를 설정할 수 있습니까?
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);
public const int GWL_EXSTYLE = -20;
public const int WS_EX_LAYERED = 0x80000;
public const int LWA_ALPHA = 0x2;
public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
}
private void Form1_Load(object sender, EventArgs e)
{
Process[] processlist = Process.GetProcesses();
foreach (Process theprocess in processlist)
{
SetWindowLong(theprocess.Handle, GWL_EXSTYLE,
GetWindowLong(theprocess.Handle, GWL_EXSTYLE)^WS_EX_LAYERED);
SetLayeredWindowAttributes(theprocess.Handle, 0, 128, LWA_ALPHA);
}
}
}
코드를 실행해도 아무런 변화가 없습니다.
무엇이 잘못 되었나요 ??
정확히 내가 원했던 것이 !!! 감사 – Moon