dimanche 19 avril 2015

Hide Form From alt-tab without lose control box

I'm using Windows API To Hide 3rd Party Application form

from alt-tab using this piece of code :



[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr window, int index, int value);
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr window, int index);

int GWL_EXSTYLE = -20;
int WS_EX_TOOLWINDOW = 0x00000080;
int WS_EX_APPWINDOW;

private void Hide_AltTab(IntPtr x)
{
//Get Style before Hide
WS_EX_APPWINDOW = GetWindowLong(Handle, GWL_EXSTYLE);
//Hide
SetWindowLong(x, GWL_EXSTYLE, WS_EX_APPWINDOW);
}

private void Show_AltTab(IntPtr x)
{
//Restore Default Style
SetWindowLong(x, GWL_EXSTYLE, WS_EX_APPWINDOW);
}


this code work good To hide form from alt-tab

But My Problem is :

when i hide form from alt-tab the Control Box is disappeared


enter image description here


AFTER


enter image description here


So what is the value in WS_EX_TOOLWINDOW i have to use to hide form from alt-tab and keep the ControlBox?


Aucun commentaire:

Enregistrer un commentaire