C
C#•9mo ago
incel detector

minimize animation when clicked from taskbar not working, but works when it minimizes from code

I have a borderless C# WPF window that supports aerosnap, aeroglass, and the native windows animations. I am not sure why the minimize animation does not work when it gets minimized from clicking the app icon from the taskbar. So initially, I thought maybe I should somehow intercept an event before the windows gets actually minimized, and then add the code this.WindowState = WindowState.Minimized. If not, maybe intercepting if the taskbar button ( window app icon ) was clicked, and also manually minimizing it through setting window states. If both aren't solutions, there should be some sort of "native check" to see if an application icon was clicked from the taskbar and maybe hook that function, IDK WHAT IM TALKING ABOUT 😦
public void SetAnimation(IntPtr handle)
{
SetWindowLong(handle, -16, (long)StyleFlag.acrylic);
SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, 0x0020 | 0x0002 | 0x0001); // SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE
ShowWindow(handle, 5);
}

public enum WindowStyles : uint
{
WS_OVERLAPPEDWINDOW = 0x00CF0000,
WS_POPUP = 0x80000000,
WS_THICKFRAME = 0x00040000,
WS_CAPTION = 0x00C00000,
WS_SYSMENU = 0x00080000,
WS_MINIMIZEBOX = 0x00020000,
WS_MAXIMIZEBOX = 0x00010000
}


public enum StyleFlag : uint
{

acrylic = WindowStyles.WS_POPUP | WindowStyles.WS_THICKFRAME | WindowStyles.WS_CAPTION | WindowStyles.WS_SYSMENU | WindowStyles.WS_MAXIMIZEBOX | WindowStyles.WS_MINIMIZEBOX,
}
public void SetAnimation(IntPtr handle)
{
SetWindowLong(handle, -16, (long)StyleFlag.acrylic);
SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, 0x0020 | 0x0002 | 0x0001); // SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE
ShowWindow(handle, 5);
}

public enum WindowStyles : uint
{
WS_OVERLAPPEDWINDOW = 0x00CF0000,
WS_POPUP = 0x80000000,
WS_THICKFRAME = 0x00040000,
WS_CAPTION = 0x00C00000,
WS_SYSMENU = 0x00080000,
WS_MINIMIZEBOX = 0x00020000,
WS_MAXIMIZEBOX = 0x00010000
}


public enum StyleFlag : uint
{

acrylic = WindowStyles.WS_POPUP | WindowStyles.WS_THICKFRAME | WindowStyles.WS_CAPTION | WindowStyles.WS_SYSMENU | WindowStyles.WS_MAXIMIZEBOX | WindowStyles.WS_MINIMIZEBOX,
}
3 Replies
Jimmacle
Jimmacle•9mo ago
i'm getting deja vu
incel detector
incel detector•9mo ago
just a stupid kid tryna make his window look fancy :Smadge:
leowest
leowest•9mo ago
thou that was what windowchrome was for
Want results from more Discord servers?
Add your server