* Multiple Monitors support functions:
fwh\source\function\getsysin.prg
- FW_ActiveMonitors() --> nMonitors
Number of extended monitors currently active.
- FW_VirtualScreen() --> oRect
TRect object representing the area of virtual screen covered by all the
extended monitors. (Note: The object has datas nTop, nLeft, nBottom,
nRight, nWidth, nHeight)
The total width of the rectangle is the sum of horizontal resolutions of
all the monitors and height is the maximum of the vertical resolutions
of all the monitors.
Recommended reading for better understanding
https://docs.microsoft.com/en-us/window ... ual-screen
https://docs.microsoft.com/en-us/window ... y-monitors
- FW_GetMonitor(params) --> oMonitor (TMonitor object)
params:
FW_GetMonitor() --> oPrimaryMonitor
FW_GetMonitor( n ) --> nth Monitor object. Defaults to primary monitor
if there is only one active monitor.
FW_GetMonitor( oWnd/hWnd ) --> oMonitor containing max area of the window
FW_GetMonitor( nRow, nCol ) --> oMonitor containing the coordinates
- TMonitor class datas and methods
DATAS:
lPrimary // Is primary monitor
nTop, nLeft, nBottom, nRight, nWidth, nHeight
CenterPt --> { nRow, nCol }
METHODS:
Row( nMonitorRow ) --> nRow on Virtual Screen
Col( nMonitorCol ) --> nCol on Virtual Screen
Center( oWnd/hWnd ) --> Centers the window inside the monitor
Move( oWnd/hWnd ) --> Sets the window in the monitor with the same
relative coordinates
Example Usage:
ACTIVATE WINDOW oWnd ON INIT FW_GetMonitor( 2 ):Center( oWnd )
ACTIVATE WINDOW oWnd ON INIT FW_GetMonitor( 2 ):Move( oWnd )
If the program is run on a single monitor the display defaults to the
primary monitor
HB_FUNC( ENUMDISPLAYMONITORS )
{
PHB_ITEM pMonitorEnum = hb_itemArrayNew( 0 );
EnumDisplayMonitors( NULL, NULL, _MonitorEnumProc0, ( LPARAM ) pMonitorEnum );
hb_itemReturnRelease( pMonitorEnum );
}
BOOL CALLBACK _MonitorEnumProc0( HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData )
And how does it adapt this to xHarbour
#ifndef __XHARBOUR__
HB_FUNC( ENUMDISPLAYMONITORS )
BOOL CALLBACK _MonitorEnumProc0( HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData )
HB_FUNC( GETMONITORINFO )
#endif
#ifndef __XHARBOUR__
HB_EXPORT PHB_ITEM Rect2Hash( RECT * rc )
#endif
colItems := objWMIServices:ExecQuery("select * from Win32_DesktopMonitor",,48)
LOCAL aProp := {;
"Availability",;
"Bandwidth",;
"Caption",;
"ConfigManagerErrorCode",;
"ConfigManagerUserConfig",;
"CreationClassName",;
"Description",;
"DeviceID",;
"DisplayType",;
"ErrorCleared",;
"ErrorDescription",;
"InstallDate",;
"IsLocked",;
"LastErrorCode",;
"MonitorManufacturer",;
"MonitorType",;
"Name",;
"PixelsPerXLogicalInch",;
"PixelsPerYLogicalInch",;
"PNPDeviceID",;
"PowerManagementCapabilities",;
"PowerManagementSupported",;
"ScreenHeight",;
"ScreenWidth",;
"Status",;
"StatusInfo",;
"SystemCreationClassName",;
"SystemName" }
Natter wrote:If there are several monitors, is it possible to specify the starting monitor for the application ?
ACTIVATE WINDOW oWnd ON INIT FW_GetMonitor( 2 ):Center( oWnd )
Marc Venken wrote:I don't get it working.
I was trying to show a xbrowse on screen 1 and on screen 2 a dialog with some data from that browse, INCLUDING a picture (ximage) that is located in the browse as a file name (data files on drive)
moving in the browse changes the data in screen 2
Anyone has this running like this ?
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg
USE WWONDERS ALIAS WW VIA "DBFCDX"
DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL
@ 20,20 SAY WW->NAME SIZE 360,30 PIXEL OF oDlg CENTER
oDlg:bPainted := {|hDC| oDlg:DrawImage( WW->IMAGE, { 60,30,380,280 } ) }
ACTIVATE DIALOG oDlg NOMODAL ON INIT FW_GetMonitor( 2 ):Center( oDlg )
XBROWSER "WW" SETUP ( oBrw:bChange := { || oDlg:Refresh() } ) ;
VALID ( oDlg:End(), .t. )
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 41 guests