Dialogo o ventana siempre al frente!

Dialogo o ventana siempre al frente!

Postby alex_cyr » Wed Nov 26, 2008 12:34 am

que tal, despues de buscar en el mar de topics y no encontrar lo que ando buscando he decidido acudir una vez mas a los masters por su ayuda..

1. Como puedo hacer para que un dialogo o ventana este siempre al frente y no se pueda mover ni cambiar de tamaño.

2. ocultar y des-cocultar la barra de inicio de windows.


:D

gracias de antemano por su ayuda

slds.
alex.
alex_cyr
 
Posts: 77
Joined: Wed Jun 28, 2006 6:38 pm
Location: Chihuahua

Postby Daniel Garcia-Gil » Wed Nov 26, 2008 2:23 am

1. Como puedo hacer para que un dialogo o ventana este siempre al frente y no se pueda mover ni cambiar de tamaño.

Revisa el ejemplo TestTop.prg

de todas formas te dejo una explicacion de esta funcion que la puedes conseguir en los help de FWH

Changes the size, position, and Z order of a child, pop-up, or top-level window.
Syntax:
SetWindowPos( <hWnd>, <hWndInsertAfter>, <nRow>, <nCol>,

<nWidth>, <nHeight>, <nFlags> ) --> lSuccess

Parameters:
<hWnd> The handle of the window.
<hWndInsertAfter> Handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values:

HWND_BOTTOM Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP Places the window at the top of the Z order.
HWND_TOPMOST Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
<nRow> Specifies the new position of the left side of the window.
<nCol> Specifies the new position of the top of the window.
<nWidth> Specifies the new width of the window.
<nHeight> Specifies the new height of the window.
<nFlags> Specifies the window sizing and positioning flags. This parameter can be a combination of the following values:

SWP_ASYNCWINDOWPOS If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.
SWP_DEFERERASE Prevents generation of the WM_SYNCPAINT message.
SWP_DRAWFRAME Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW Hides the window.
SWP_NOACTIVATE Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE Retains the current position (ignores the X and Y parameters).
SWP_NOOWNERZORDER Does not change the owner window's position in the Z order.
SWP_NOREDRAW Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW Displays the window.

Returns:

<lSuccess> .t. if the function was successful, otherwise .f.

2. ocultar y des-cocultar la barra de inicio de windows.


ShowWindow (FindWindow ('Shell_TrayWnd', Nil) , 0 )
para volver a mostrar cambia el valor de 0 a 1
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Postby fespinoza » Wed Nov 26, 2008 3:17 am

Alex

Revisa este post del foro, creo que es lo que quieres, a mi me funciona muy bien:

http://forums.fivetechsoft.com/viewtopi ... est%E1tico

Saludos

Fernando Espinoza
User avatar
fespinoza
 
Posts: 188
Joined: Wed Feb 01, 2006 6:59 pm
Location: Ecuador

Re: Dialogo o ventana siempre al frente!

Postby karinha » Thu Mar 06, 2014 2:26 pm

Daniel,

En windows 7, el botón de inicio del Windows 7 no está invisibilizando. ¿Qué debo hacer?

ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_HIDE )

Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7261
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dialogo o ventana siempre al frente!

Postby karinha » Thu Mar 06, 2014 3:37 pm

No funciona mismo...

Code: Select all  Expand view

#include "FiveWin.ch"
#Include "Objects.Ch"

#Define SW_HIDE              0 // &H0
#Define SW_SHOWNA            8 // &H8
#Define SW_SHOW              5 // &H5
#Define SW_SHOWNORMAL        1

static oWnd

//----------------------------------------------------------------//

function Main()

   local oBar

   //para volver a mostrar cambia el valor de 0 a 1
   ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 0 ) // Taskbar
   ShowWindow( FindWindow( "Button", "Start" ), 0 )   // Vista round button
   // EN C:\FWH1306\SAMPLES\GETTIME.PRG

   DEFINE WINDOW oWnd TITLE "Boton Iniciar de Win 7"

   DEFINE BUTTONBAR oBar _3D OF oWnd

   DEFINE BUTTON OF oBar ACTION WIN_INVISIBLE()

   SET MESSAGE OF oWnd TO "Boton Iniciar de Win 7" NOINSET CLOCK DATE KEYBOARD

   ACTIVATE WINDOW oWnd

            /*;
            ON INIT( HIDETASKBAR() )  // DESHABILITA No funciona.
            // By Manuel Mercado.
            */


   ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 1 )
   ShowWindow( FindWindow( "Button", "Start" ), 1 )

//   SHOWTASKBAR()  // HABILITA

return nil

FUNCTION WIN_INVISIBLE()

   ? [boton del windows 7 invisible?]

   ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 0 ) // Taskbar
   ShowWindow( FindWindow( "Button", "Start" ), 0 )   // Vista round button

   //para volver a mostrar cambia el valor de 0 a 1

RETURN NIL


// Tambien no funciona

/*
SHOWTASKBAR()  // habilita
HIDETASKBAR()  // desabilita
TIRA_X()       // DESABILITA O X da janela
PISCA_EXE()    // VAI PISCAR O SEU EXE NA BARRA
*/


#pragma BEGINDUMP

#include "windows.h"
#include "shlobj.h"
#include "hbapi.h"
#include "math.h"
#include "hbvm.h"
#include "hbstack.h"
#include "hbapiitm.h"
#include "hbapigt.h"

HB_FUNC ( SHOWTASKBAR ) //Habilita o botao INICIAR
{
HWND hWnd = FindWindow("Shell_TrayWnd", "");

ShowWindow( hWnd, 1 );
}

HB_FUNC ( HIDETASKBAR ) //Desabilita o botao Iniciar
{
HWND hWnd = FindWindow("Shell_TrayWnd", "");

ShowWindow( hWnd, 0 );
}

HB_FUNC ( PISCA_EXE ) // VAI PISCAR O SEU EXE NA BARRA
{
HWND Handle = GetForegroundWindow();

FlashWindow(Handle,TRUE); // VAI PISCAR O SEU EXE NA BARRA

Sleep(300); // TEMPO DE ESPERA
}

HB_FUNC ( TIRA_X ) // DESABILITA O X da janela

{
HMENU MenuH = GetSystemMenu(GetForegroundWindow(),FALSE);

EnableMenuItem(MenuH,SC_CLOSE,MF_GRAYED);
}

HB_FUNC ( VOLTA_X ) // HABILITA O X da janela

{
HMENU MenuH = GetSystemMenu(GetForegroundWindow(),TRUE);

EnableMenuItem(MenuH,SC_CLOSE,MF_GRAYED);
}

#pragma ENDDUMP
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7261
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dialogo o ventana siempre al frente!

Postby karinha » Thu Mar 06, 2014 3:51 pm

// \samples\TASKBAR.PRG no funciona

Code: Select all  Expand view

#Include "FiveWin.ch"


STATIC odlg
//-------------------------------------------------------------//

FUNCTION Main()

   // local oDlg

   DEFINE DIALOG oDlg FROM 6, 6 TO 20, 60 TITLE "Hide and Show Taskbar"

   @ 2, 2 BUTTON "&Hide" OF oDlg ;
      ACTION task_bar_on(.f.)

   @ 4, 2 BUTTON "&Show" OF oDlg ;
     ACTION task_bar_on(.t.)

   ACTIVATE DIALOG oDlg ;
      VALID MsgYesNo( "Want to end ?" )

return(NIL)



function task_bar_on(ison)

    local hwnd


    hwnd= FindWndByClass("Shell_TrayWnd", "")
   
    If ison
        ShowWindow(hwnd,5)
    Else
        ShowWindow(hwnd,0)
    End If

return(NIL)



DLL32 Function ShowWindow(hwnd as LONG, nCmdShow as LONG) AS LONG ;
PASCAL FROM "ShowWindow" Lib "user32.dll"
   
DLL32 Function FindWndByClass(wndClass AS LPSTR,WndName as LPSTR) AS LONG ;
PASCAL FROM "FindWindowA" LIB "user32.dll"
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7261
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dialogo o ventana siempre al frente!

Postby karinha » Thu Mar 06, 2014 8:25 pm

Porfa, como hago esto en FWH?

For Windows 7 you want to use something like this:

hStart = ::FindWindowEx(GetDesktopWindow(), NULL, "Button", NULL)

Although I think it would be better search for it by name to be sure that you get the right button.

hStart = ::FindWindowEx(GetDesktopWindow(), NULL, "Button", "Start")

Gracias,

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7261
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dialogo o ventana siempre al frente!

Postby antolin » Fri Mar 07, 2014 10:24 am

Recientementehe colocado un dialogo siempre ONTOP con:
Code: Select all  Expand view

SetWindowPos( oWin:hWnd, -1, 0, 0, 0, 0, 3 )
Peaaaaaso de foro...
antolin
 
Posts: 492
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: Dialogo o ventana siempre al frente!

Postby karinha » Mon Jul 28, 2014 2:25 pm

¿Dónde está el defecto en esta versión?

Code: Select all  Expand view

#include "FiveWin.ch"
#include "dll.ch"
 
#Define SW_HIDE       0 // &H0
#Define SW_SHOWNA     8 // &H8
#Define SW_SHOW       5 // &H5
#Define SW_SHOWNORMAL 1
 
static oWnd
 
//----------------------------------------------------------------------------//
function Main()
 
   DEFINE WINDOW oWnd TITLE "Boton Iniciar de Win 7"
          DEFINE BUTTONBAR oBar _3D OF oWnd
          DEFINE BUTTON OF oBar ACTION TaskBarInvisivel()
          DEFINE BUTTON OF oBar ACTION TaskBarVisivel()
          DEFINE BUTTON OF oBar ACTION StartButtonInvisivel()
          DEFINE BUTTON OF oBar ACTION StartButtonVisivel()
          SET MESSAGE OF oWnd TO "Boton Iniciar de Win 7" NOINSET CLOCK DATE KEYBOARD
   ACTIVATE WINDOW oWnd //;
      //ON INIT( HIDETASKBAR() )
 
return nil
 
//----------------------------------------------------------------------------//
FUNCTION TaskBarInvisivel()
   ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 0 ) // Taskbar
   //ShowWindow( FindWindow( "Button", "Start" ), 0 ) // Vista round button
   RETURN NIL
 
//----------------------------------------------------------------------------//
FUNCTION TaskBarVisivel()
   ShowWindow( FindWindow( "Shell_TrayWnd", "" ), 1 ) // Taskbar
   //ShowWindow( FindWindow( "Button", "Start" ), 1 ) // Vista round button
   RETURN NIL
 
//----------------------------------------------------------------------------//
FUNCTION StartButtonInvisivel()
   ShowWindow( FindWindowEx( FindWindow( "Shell_TrayWnd", "" ), 0, "Button", nil ), 0 ) // Taskbar
   ShowWindow( FindWindowEx( FindWindow( "Button", "Start" ), 0, "Button", nil ), 0 ) // Vista round button
   RETURN NIL
 
//----------------------------------------------------------------------------//
FUNCTION StartButtonVisivel()
   ShowWindow( FindWindowEx( FindWindow( "Shell_TrayWnd", "" ), 0, "Button", nil ), 1 ) // Taskbar
   ShowWindow( FindWindowEx( FindWindow( "Button", "Start" ), 0, "Button", nil ), 1 ) // Vista round button
   RETURN NIL
 
DLL32 FUNCTION FindWindowEx( hWndParent AS LONG, hWndChildAfter AS LONG, lpszClass AS STRING, lpszWindow AS STRING ) AS LONG PASCAL FROM "FindWindowExA" LIB "user32"
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7261
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 11 guests