Página 1 de 2

[DLL] WindowButtons 1.0.0.0

Publicado: 12 Abr 2013 16:12
por Ceone
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

Publicado: 12 Abr 2013 16:20
por bariza-dz
thanks

Publicado: 12 Abr 2013 17:39
por spliners
Muy bueno me ayudo demasiado muchas gracias

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 13 Abr 2013 13:09
por Haitham.2012
thanks

Publicado: 13 Abr 2013 14:02
por abood1987
Excellent
Gracias

Publicado: 13 Abr 2013 14:04
por sattel
De maravilla...Mil gracias Ceone

Publicado: 30 Ago 2013 21:51
por chakal03
Gracias

Publicado: 26 Nov 2013 07:10
por milano88
thanks

Publicado: 03 Abr 2014 18:12
por tam
thanks

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 16 Nov 2014 03:42
por frozenburn
thanks

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 05 Dic 2014 06:18
por Nightmaster
muy buena

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 11 Nov 2015 01:49
por hddutilite
manda pra mim

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 13 Nov 2015 12:20
por PersianEngineer.Com
nice .

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 03 Feb 2016 18:13
por Kindly
Muy bueno :)

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 04 Feb 2016 22:20
por mecivic
Thank you

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 05 Abr 2016 20:02
por hdd.utilities
graças

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 07 May 2016 01:52
por Pepo.JB
graciass

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 16 Ago 2016 11:25
por zidangol
:friends: :friends:

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 18 Oct 2016 22:46
por world502
Gracias

Re: [DLL] WindowButtons 1.0.0.0

Publicado: 09 Nov 2016 00:01
por usamakey
tnks m8