Monitores Multiples

Monitores Multiples

Postby Bayron » Fri Feb 26, 2010 4:40 pm

Hola Foro,
Existe alguna manera de detectar cuantos monitores tiene instalados un ordenador, y si lo mostrado en esos monitores es lo mismo o se esta usando como Extension del Desktop???
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Monitores Multiples

Postby Bayron » Fri Feb 26, 2010 7:17 pm

Hola Foro,
Necesitaba detectar si el ordenador tenia instalados monitores multiples solo para calcular el tamano del desktop, para asignar el tamano de mi ventana principal.

Code: Select all  Expand view

   DEFINE WINDOW oVent FROM 0, 0 TO (WndHeight( GetDesktopWindow()) - 30),;
                 (WndWidth( (GetDesktopWindow()) ) - 120)

 


Este codigo colocaba el tamano de la Ventana extendido en mis dos monitores.

El problema se resuelve al colocar la clausula

PIXEL
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Monitores Multiples

Postby Bayron » Fri Feb 26, 2010 7:52 pm

Amigos,

Cuando muevo la ventana principal de la aplicacion a otro monitor que no sea el principal, cuando defino un dialogo,

DEFINE DIALOG oDlg OF oWnd

Este aparece sobre la ventana principal, pero en cualquier lado de la ventana.

Cuando le incluyo la opcion CENTERED, el dialogo se centra en el monitor principal y no sobre la Ventana Principal...



Alguien sabe como hacer para que centre sobre la Ventana Principal?????
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Monitores Multiples

Postby Daniel Garcia-Gil » Fri Feb 26, 2010 8:36 pm

Bayron...
Bayron wrote:Cuando le incluyo la opcion CENTERED, el dialogo se centra en el monitor principal y no sobre la Ventana Principal...
Alguien sabe como hacer para que centre sobre la Ventana Principal?????


puedes usar el metodo CENTER que recibe como parametro un control que puedes usar como referencia para centrar un dialogo, window, etc. con respecto al mismo

Code: Select all  Expand view
ACTIVATE DIALOG oDlg ON INIT( ::Center( oWndMain ) )
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Monitores Multiples

Postby Bayron » Fri Feb 26, 2010 9:56 pm

Daniel,

Gracias Daniel, funciona Perfecto...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Monitores Multiples

Postby Daniel Garcia-Gil » Fri Feb 26, 2010 9:59 pm

Bayron...

Bayron wrote:Cuando muevo la ventana principal de la aplicacion a otro monitor que no sea el principal, cuando defino un dialogo,


te dejo un ejemplo probado en win7 (no se como el resultado en otras versiones)
oprime doble click en el simbolo {...} cuando abras el xbrowse

Code: Select all  Expand view

#include "fivewin.ch"

#define SM_CMONITORS            80
#define SM_XVIRTUALSCREEN       76
#define SM_YVIRTUALSCREEN       77
#define SM_CXVIRTUALSCREEN      78
#define SM_CYVIRTUALSCREEN      79

function main
   local oWnd
   local oBar
   local aRect
   
   define window oWnd title "Test multi monitor"
   
   define buttonbar oBar of oWnd size 80, 30
   
   define button prompt "Count" of oBar ;
          action MsgInfo( "Total Visibles Monitors:" + Str( CountMonitors() ) )
         
   define button prompt "Get Coors" of oBar;
          action XBrowse( GetAllMonitorRect() )
   
   define button prompt "Virtual Screen" of oBar;
          action XBrowse( { GetSysMetrics( SM_YVIRTUALSCREEN  ),;
                            GetSysMetrics( SM_YVIRTUALSCREEN  ),;
                            GetSysMetrics( SM_CYVIRTUALSCREEN ),;
                            GetSysMetrics( SM_CXVIRTUALSCREEN ) } )
   
   define button prompt "Move Next" of oBar;
          action ( aRect := GetMonitorRect( 2 ), oWnd:Move( aRect[ 1 ], aRect[ 2 ] ) )
   
   define button prompt "Move Prev" of oBar;
          action ( aRect := GetMonitorRect( 1 ), oWnd:Move( aRect[ 1 ], aRect[ 2 ] ) )

   define button prompt "All Window" of oBar;
          action (oWnd:Move( GetSysMetrics( SM_YVIRTUALSCREEN  ),;
                             GetSysMetrics( SM_YVIRTUALSCREEN  ),;
                             GetSysMetrics( SM_CXVIRTUALSCREEN ),;
                             GetSysMetrics( SM_CYVIRTUALSCREEN ), .T. ) )


   
   activate window oWnd
   
return nil

function  CountMonitors()
return GetSysMetrics( SM_CMONITORS )

function GetAllMonitorRect()

   local nTotalMon
   local n
   local aRect
   local aMonitors := {}

   if ( nTotalMon := CountMonitors() ) > 1
      aRect = GetWndRect( GetDesktopWindow() )
      AAdd( aMonitors, { 1, aRect } )
      for n = 2 to nTotalMon
         aRect = GetRectNextMonitor( aRect )
         AAdd( aMonitors, { n, aRect } )
      next
   endif
       
return aMonitors
   
   
function GetMonitorRect( nMon )

   local nTotalMon
   local n
   local aRect
   local aMonitors := {}

   aRect = GetWndRect( GetDesktopWindow() )
   if ( nTotalMon := CountMonitors() ) >= nMon
      for n = 2 to nMon
         aRect = GetRectNextMonitor( aRect )
      next
   endif
       
return aRect
   



#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>


HB_FUNC( GETRECTNEXTMONITOR )
{
   
    POINT pt;
    HMONITOR hMon;
    MONITORINFO pmi;
   
    pmi.cbSize  = sizeof( MONITORINFO );
   
    pt.x = hb_parvnl( 1, 4 ) + 1;
    pt.y = hb_parvnl( 1, 1 );
   
    hMon = MonitorFromPoint( pt, MONITOR_DEFAULTTONULL );
   
    if( hMon != NULL )
    {
    if( GetMonitorInfo( hMon, &pmi ) )
    {
        hb_reta( 4 );
        hb_storvni( pmi.rcMonitor.top, -1, 1 );
        hb_storvni( pmi.rcMonitor.left, -1, 2 );
        hb_storvni( pmi.rcMonitor.bottom, -1, 3 );
        hb_storvni( pmi.rcMonitor.right, -1, 4 );
    }
  }else
     hb_retni( 0 );
   
}
   

#pragma ENDDUMP

 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Monitores Multiples

Postby Bayron » Sat Feb 27, 2010 1:41 am

Daniel,

Mil gracias, el programa compilo y funciono muy bien, pero me aparecieron estos errores:

Image

Seran funciones solo de harbour??? o me falta incluir alguna libreria

Yo utilizo xHarbour....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Monitores Multiples

Postby Daniel Garcia-Gil » Sat Feb 27, 2010 1:57 am

Hola Bayron

incluye esto despues de #include <hbapi.h>

Code: Select all  Expand view
#ifdef __XHARBOUR__
long hb_parvnl( int iParam, int iIndex );
void hb_storvni( int iValue, int iParam, int iIndex );
#endif
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Monitores Multiples

Postby Bayron » Sat Feb 27, 2010 2:46 am

Daniel,

Gracias, era justo eso.....

Todo trabaja muy bien.
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Monitores Multiples

Postby anserkk » Sat Feb 27, 2010 4:09 am

Dear Mr.Daniel,

This is for you information.

First of all let me thank you for providing a very useful sample which help us in a dual or multi monitor environment. In the sample provided by you, when I click on the buttons "Get Coors" & "Virtual Screen", it opens an xBrowse. If I try to drag the Horizontal scroll bar towards the right hand side, then the xbrowse generates the following error. Is this a xBrowse bug ?. I am using FWH 10.2

    Application
    ===========
    Path and name: D:\FwhExtra\FWH Samples\MultiMonitor\MultiMon.exe (32 bits)
    Size: 1,772,032 bytes
    Time from start: 0 hours 0 mins 38 secs
    Error occurred at: 02/27/10, 09:31:53
    Error description: Error BASE/1132 Bound error: array access
    Args:
    [ 1] = A { ... }
    [ 2] = N 0

    Stack Calls
    ===========
    Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE(476)
    Called from: => TXBROWSE:COLATPOS(0)
    Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE(478)
    Called from: => TXBROWSE:SELECTEDCOL(0)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT(1192)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY(1174)
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1439)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10470)
    Called from: .\source\classes\WINDOW.PRG => _FWH(3378)
    Called from: => DIALOGBOXINDIRECT(0)
    Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
    Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG(345)
    Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS(27)
    Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE(476)
    Called from: => TXBROWSE:COLATPOS(0)
    Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE(478)
    Called from: => TXBROWSE:SELECTEDCOL(0)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT(1192)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY(1174)
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1439)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10470)
    Called from: .\source\classes\WINDOW.PRG => _FWH(3378)
    Called from: => DIALOGBOXINDIRECT(0)
    Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
    Called from: .\source\function\XBROWSER.PRG => XBROWSE(136)
    Called from: MultiMon.prg => (b)MAIN(28)
    Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(463)
    Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(658)
    Called from: => TWINDOW:HANDLEEVENT(0)
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1464)
    Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(1415)
    Called from: .\source\classes\WINDOW.PRG => _FWH(3378)
    Called from: => WINRUN(0)
    Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(971)
    Called from: MultiMon.prg => MAIN(44)

Regards
Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Monitores Multiples

Postby Daniel Garcia-Gil » Sat Feb 27, 2010 5:50 am

Hello anserk

thank for feed back

we will check this error very soon
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 7 guests