[DLL] WindowButtons 1.0.0.0

Plugins y todo lo relacionado para Autoplay Media Studio.
ImagenImagen

Buenas amigos de AMSSpecialist a petición de un usuario he creado esta DLL usando user32.dll con la cual podréis mostrar o ocultar los botones de las ventanas, Botones: Minimizar, Maximizar, Cerrar. Espero que os guste la idea y os funcione correctamente!!

Funciones:
  • HideMinimize - Retorno Number "devuelve un numero que informa de si se a realizado con éxito la operación, 1: Si se realizo con éxito, 0: Si ocurrió algún fallo o el botón que deseas ocultar o mostrar ya esta oculto o mostrado."
  • HideMaximize - Retorno Number "devuelve un numero que informa de si se a realizado con éxito la operación, 1: Si se realizo con éxito, 0: Si ocurrió algún fallo o el botón que deseas ocultar o mostrar ya esta oculto o mostrado."
  • HideClose - Retorno Number "devuelve un numero que informa de si se a realizado con éxito la operación, 1: Si se realizo con éxito, 0: Si ocurrió algún fallo o el botón que deseas ocultar o mostrar ya esta oculto o mostrado.(En el retorno de esta función ocurre un error que aun no he podido reparar así que si notáis que el retorno no funciona del todo bien es mía la culpa jajajaja...)"
  • ShowMinimize - Retorno Number "devuelve un numero que informa de si se a realizado con éxito la operación, 1: Si se realizo con éxito, 0: Si ocurrió algún fallo o el botón que deseas ocultar o mostrar ya esta oculto o mostrado."
  • ShowMaximize - Retorno Number "devuelve un numero que informa de si se a realizado con éxito la operación, 1: Si se realizo con éxito, 0: Si ocurrió algún fallo o el botón que deseas ocultar o mostrar ya esta oculto o mostrado."
  • ShowClose - Retorno Number "devuelve un numero que informa de si se a realizado con éxito la operación, 1: Si se realizo con éxito, 0: Si ocurrió algún fallo o el botón que deseas ocultar o mostrar ya esta oculto o mostrado.(En el retorno de esta función ocurre un error que aun no he podido reparar así que si notáis que el retorno no funciona del todo bien es mía la culpa jajajaja...)"

Código 1.0.0.0:
UnmanagedExports.cs:
using System;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;

namespace WindowButtons
{
internal static class WindowButtonsClass
{

#region USER32.DLL & OTHER FUNCTIONS

[DllImport("user32.dll")]
public static extern int GetSystemMenu(IntPtr hWnd, bool bRevert);

[DllImport("user32.dll")]
public static extern bool DeleteMenu(int hMenu, int uPosition, int uFlags);

[DllImport("user32.dll")]
internal extern static int SetWindowLong(IntPtr hwnd, int index, int value);

[DllImport("user32.dll")]
internal extern static int GetWindowLong(IntPtr hwnd, int index);

public static int HideResultBoolToNum(bool val)
{
int resval;
if (val == true)
{
resval = 1;
}
else
{
resval = 0;
}
return resval;
}

public static int ShowResultBoolToNum(bool val)
{
int resval;
if (val == false)
{
resval = 1;
}
else
{
resval = 0;
}
return resval;
}

public static int HideResultVal(int val)
{
int valRes;
if (val == 349110272)
{
valRes = 1;
}
else
{
valRes = 0;
}
return valRes;
}

public static int ShowResultVal(int val)
{
int valRes;
if (val == 349044736 || val == 348979200)
{
valRes = 1;
}
else
{
valRes = 0;
}
return valRes;
}

#endregion USER32.DLL & OTHER FUNCTIONS

[DllExport("ShowMinimize", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int ShowMinimize(IntPtr Handle)
{
long value = GetWindowLong(Handle, -16);
int rest = SetWindowLong(Handle, -16, (int)(value | 0x00020000L));
return ShowResultVal(rest);
}

[DllExport("ShowMaximize", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int ShowMaximize(IntPtr Handle)
{
long value = GetWindowLong(Handle, -16);
int rest = SetWindowLong(Handle, -16, (int)(value | 0x00010000L));
return ShowResultVal(rest);
}

[DllExport("ShowClose", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int ShowClose(IntPtr Handle)
{
int s_SystemMenuHandle = GetSystemMenu(Handle, true);
bool BooleanRes = DeleteMenu(s_SystemMenuHandle, 6, 1024);
return ShowResultBoolToNum(BooleanRes);
}

[DllExport("HideMinimize", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int HideMinimize(IntPtr Handle)
{
long value = GetWindowLong(Handle, -16);
int rest = SetWindowLong(Handle, -16, (int)(value & ~0x00020000L));
return HideResultVal(rest);
}

[DllExport("HideMaximize", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int HideMaximize(IntPtr Handle)
{
long value = GetWindowLong(Handle, -16);
int rest = SetWindowLong(Handle, -16, (int)(value & ~0x00010000L));
return HideResultVal(rest);
}

[DllExport("HideClose", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int HideClose(IntPtr Handle)
{
int s_SystemMenuHandle = GetSystemMenu(Handle, false);
bool BooleanRes = DeleteMenu(s_SystemMenuHandle, 6, 1024);
return HideResultBoolToNum(BooleanRes);
}
}
}


Descarga:
HIDE: ON
Hidebb Message Hidden Description

thanks

Muy bueno me ayudo demasiado muchas gracias
thanks

Excellent
Gracias

De maravilla...Mil gracias Ceone

Gracias

thanks

thanks
thanks
muy buena
manda pra mim
nice .
Muy bueno :)
Thank you
graças
graciass
:friends: :friends:
Gracias
tnks m8