Ver la Versión Completa : Boton Windows xp
Hola Amigos:
Como puedo realizar una funcion similar al boton "ir al escritorio" que viene con Windows xp y generalmente se encuentra en la barra de tareas de windows.
Gracias.
Neftali [Germán.Estévez]
28-10-2004, 17:45:58
Personalmente no lo he probado y no me gusta mucho cómo está hecho, pero mientras no tengas nada mejor puedes probar éste código:
procedure MinimizeAll;
Begin
{ <Window key> + 'M' minimizes all windows, <Win><Shift>+'M'
restores them }
keybd_event( VK_LWIN, MapvirtualKey( VK_LWIN, 0), 0, 0 );
keybd_event( Ord('M'), MapvirtualKey( Ord('M'), 0), 0, 0 );
keybd_event( Ord('M'), MapvirtualKey( Ord('M'), 0), KEYEVENTF_KEYUP, 0 );
keybd_event( VK_LWIN, MapvirtualKey( VK_LWIN, 0), KEYEVENTF_KEYUP, 0 );
end;
Neftali [Germán.Estévez]
28-10-2004, 17:57:06
Éste sí me gusta más...
(1) Coloca en tu form un botón
(2) Añade la unit ComObj al uses
(3) Añade las dos definiciones siguientes al private.
procedure Minimize;
procedure Restore;
(4) La implementación de los dos procedimientos es la siguiente:
procedure TForm1.Minimize;
var
Shell : OleVariant;
begin
Shell := CreateOleObject('Shell.Application') ;
Shell.MinimizeAll;
Shell := VarNull;
end;
procedure TForm1.Restore;
var
Shell : OleVariant;
begin
Shell := CreateOleObject('Shell.Application') ;
Shell.UndoMinimizeAll;
Shell := VarNull;
// Delay for 100ms to allow all other windows to restore then
// set this one to foreground.
Sleep(100);
SetForegroundWIndow(Self.Handle);
end; {Restore}
(5) Y por último en el evento del botón coloca lo siguiente:
procedure TForm1.Button1Click(Sender: TObject);
begin
case Button1.Tag of
0:
begin
Minimize;
Button1.Tag := 1;
end;
1:
begin
Restore;
Button1.Tag := 0;
end;
end;
end;
roman
28-10-2004, 18:01:30
{ <Window key> + 'M' minimizes all windows, <Win><Shift>+'M'
restores them }
¡Ah! ¿Se refieren a ese botón? Quizá les sirva esto (http://www.clubdelphi.com/foros/showthread.php?t=5375).
// Saludos
Muchas gracias, ahora mismo hago la prueba
vBulletin v3.6.8, Derechos ©2000-2024, Jelsoft Enterprises Ltd.