Page 1 of 1
Maximizar y minimizar
Posted: Tue Sep 09, 2008 8:19 pm
by jrendon
EspaƱol
Hola a todos, alguien sabe como hacer que desde minigui se pueda Maximizar o Minimizar cualqquier otra aplicaciĆ³n que se encuentra abierta
Saludos
English (Powered By Google)
Hello everyone, someone knows how to do that since minigui can maximize or minimize any application that is open
Greetings
Juan Rendon
Re: Maximizar y minimizar
Posted: Wed Sep 10, 2008 3:10 am
by Rathinagiri
Any application? Meaning, only MiniGUI applications or other applications also?
Re: Maximizar y minimizar
Posted: Wed Sep 10, 2008 8:57 am
by gfilatov
jrendon wrote:...
Hello everyone, someone knows how to do that since minigui can maximize or minimize any application that is open
Hello Juan Rendon,
Try the following samples for standard Calculator and Notepad applications:
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2002-2008 Roberto Lopez <harbourminigui@gmail.com>
* http://harbourminigui.googlepages.com/
*
* Copyright 2006-2008 Grigory Filatov <gfilatov@freemail.ru>
*/
#include "minigui.ch"
#define GW_HWNDFIRST 0
#define GW_HWNDLAST 1
#define GW_HWNDNEXT 2
#define GW_HWNDPREV 3
#define GW_OWNER 4
#define GW_CHILD 5
#define APP_TITLE 'Calculator'
FUNCTION Main()
DEFINE WINDOW Form_Main ;
AT 0,0 ;
WIDTH 400 HEIGHT 200 ;
TITLE "Minimize/Restore Calc Demo" ;
MAIN ;
ON INIT StartIt()
DEFINE BUTTON Button_1
ROW 10
COL 10
WIDTH 200
CAPTION 'Minimize/Restore Calc'
ACTION MinimizeIt()
DEFAULT .T.
END BUTTON
DEFINE BUTTON Button_2
ROW 40
COL 10
WIDTH 200
CAPTION 'Cancel'
ACTION ThisWindow.Release
END BUTTON
END WINDOW
CENTER WINDOW Form_Main
ACTIVATE WINDOW Form_Main
RETURN Nil
FUNCTION StartIt()
Local aTitles := GetTitles( GetFormHandle("Form_Main") )
Local n
n := aScan( aTitles, {|e| APP_TITLE $ e[1] } )
IF EMPTY( n )
_Execute ( 0, , "Calc", , , 5 )
ENDIF
RETURN Nil
FUNCTION MinimizeIt()
Local aTitles := GetTitles( GetFormHandle("Form_Main") )
Local hWnd
n := aScan( aTitles, {|e| APP_TITLE $ e[1] } )
IF n > 0
hWnd := aTitles[ n ][ 2 ]
IF IsIconic( hWnd )
Restore( hWnd )
ELSE
Minimize( hWnd )
ENDIF
ELSE
MsgStop( "Cannot find application window!", "Error" )
ENDIF
RETURN Nil
*--------------------------------------------------------*
Function GetTitles( hOwnWnd )
*--------------------------------------------------------*
Local aTasks := {}, cTitle := "", ;
hWnd := GetWindow( hOwnWnd, GW_HWNDFIRST ) // Get the first window
WHILE hWnd != 0 // Loop through all the windows
cTitle := GetWindowText( hWnd )
IF GetWindow( hWnd, GW_OWNER ) = 0 .AND.; // If it is an owner window
IsWindowVisible( hWnd ) .AND.; // If it is a visible window
hWnd != hOwnWnd .AND.; // If it is not this app
!EMPTY( cTitle ) .AND.; // If the window has a title
!( "DOS Session" $ cTitle ) .AND.; // If it is not DOS session
!( cTitle == "Program Manager" ) // If it is not the Program Manager
aAdd( aTasks, { cTitle, hWnd } )
ENDIF
hWnd := GetWindow( hWnd, GW_HWNDNEXT ) // Get the next window
ENDDO
Return ( aTasks )
#pragma BEGINDUMP
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC( ISICONIC )
{
hb_retl( IsIconic( ( HWND ) hb_parnl( 1 ) ) );
}
#pragma ENDDUMP
and
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2002-2008 Roberto Lopez <harbourminigui@gmail.com>
* http://harbourminigui.googlepages.com/
*
* Copyright 2006-2008 Grigory Filatov <gfilatov@freemail.ru>
*/
#include "minigui.ch"
#define GW_HWNDFIRST 0
#define GW_HWNDLAST 1
#define GW_HWNDNEXT 2
#define GW_HWNDPREV 3
#define GW_OWNER 4
#define GW_CHILD 5
#define APP_TITLE 'Notepad'
FUNCTION Main()
DEFINE WINDOW Form_Main ;
AT 0,0 ;
WIDTH 400 HEIGHT 200 ;
TITLE "Minimize/Maximize Notepad Demo" ;
MAIN ;
TOPMOST ;
ON INIT StartIt()
DEFINE BUTTON Button_1
ROW 10
COL 10
WIDTH 200
CAPTION 'Minimize/Maximize Notepad'
ACTION MinimizeIt()
DEFAULT .T.
END BUTTON
DEFINE BUTTON Button_2
ROW 40
COL 10
WIDTH 200
CAPTION 'Cancel'
ACTION ThisWindow.Release
END BUTTON
END WINDOW
CENTER WINDOW Form_Main
ACTIVATE WINDOW Form_Main
RETURN Nil
FUNCTION StartIt()
Local aTitles := GetTitles( GetFormHandle("Form_Main") )
Local n
n := aScan( aTitles, {|e| APP_TITLE $ e[1] } )
IF EMPTY( n )
_Execute ( 0, , "Notepad", , , 5 )
ENDIF
RETURN Nil
FUNCTION MinimizeIt()
Local aTitles := GetTitles( GetFormHandle("Form_Main") )
Local hWnd
n := aScan( aTitles, {|e| APP_TITLE $ e[1] } )
IF n > 0
hWnd := aTitles[ n ][ 2 ]
IF IsIconic( hWnd )
Maximize( hWnd )
ELSE
Minimize( hWnd )
ENDIF
ELSE
MsgStop( "Cannot find application window!", "Error" )
ENDIF
RETURN Nil
*--------------------------------------------------------*
Function GetTitles( hOwnWnd )
*--------------------------------------------------------*
Local aTasks := {}, cTitle := "", ;
hWnd := GetWindow( hOwnWnd, GW_HWNDFIRST ) // Get the first window
WHILE hWnd != 0 // Loop through all the windows
cTitle := GetWindowText( hWnd )
IF GetWindow( hWnd, GW_OWNER ) = 0 .AND.; // If it is an owner window
IsWindowVisible( hWnd ) .AND.; // If it is a visible window
hWnd != hOwnWnd .AND.; // If it is not this app
!EMPTY( cTitle ) .AND.; // If the window has a title
!( "DOS Session" $ cTitle ) .AND.; // If it is not DOS session
!( cTitle == "Program Manager" ) // If it is not the Program Manager
aAdd( aTasks, { cTitle, hWnd } )
ENDIF
hWnd := GetWindow( hWnd, GW_HWNDNEXT ) // Get the next window
ENDDO
Return ( aTasks )
#pragma BEGINDUMP
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC( ISICONIC )
{
hb_retl( IsIconic( ( HWND ) hb_parnl( 1 ) ) );
}
#pragma ENDDUMP