[C#] Non visualizzare un form nella task list (Alt+tab)
Luca Longo | 5 settembre 2008Girovagando sul web ho trovato una piccola soluzione al mio problema (non tanto piccola dal momento in cui funziona
)
Avevo la necessitàdi nascondere un form alla classica tasklist che appare cliccando la combinazione Alt+tab… ed ecco il risultato:
private const int GWL_EXSTYLE = (-20);
private const int WS_EX_TOOLWINDOW = 0x80;
private const int WS_EX_APPWINDOW = 0x40000;
[DllImport("user32", CharSet=CharSet.Auto)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32", CharSet=CharSet.Auto)]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private void frmDaNascondere_Load(object sender, EventArgs e)
{
SetWindowLong(this.Handle, GWL_EXSTYLE, (GetWindowLong(this.Handle, GWL_EXSTYLE) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);
}
Hai trovato interessante questo articolo?


