Hide Form From alt-tab without lose control box

0

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 and store Current Style before Hide
     WS_EX_APPWINDOW = GetWindowLong(Handle, GWL_EXSTYLE);
     //Hide
     SetWindowLong(x, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
}

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?

c#
windows
forms
winapi
asked on Stack Overflow Apr 19, 2015 by asem mokllati • edited Apr 19, 2015 by asem mokllati

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0