Use Set.pkg //typedef struct tagPOINT { // LONG x; // LONG y; //} POINT, *PPOINT; // //typedef Struct _RECT { // LONG left; // LONG top; // LONG right; // LONG bottom; //} RECT, *PRECT; // //typedef Struct tagMONITORINFO { // DWORD cbSize; // RECT rcMonitor; // RECT rcWork; // DWord dwFlags; //} MONITORINFO, *LPMONITORINFO; Struct tRECT Integer Left Integer Top Integer Right Integer Bottom End_Struct Struct tMONITORINFO DWord cbSize tRECT rcMonitor tRECT rcWork DWord dwFlags End_Struct //HMONITOR MonitorFromWindow( // HWND hwnd, // handle to a window // DWord dwFlags // determine return value //); //BOOL GetMonitorInfo( // HMONITOR hMonitor, // handle to display monitor // LPMONITORINFO lpmi // display monitor information //); #IF (!@>=150) #ELSE External_Function MonitorFromWindow "MonitorFromWindow" user32.dll Handle hWnd DWord dwFlags Returns Handle External_Function GetMonitorInfo "GetMonitorInfoA" user32.dll Handle hMonitor Pointer lpmi Returns Boolean External_Function MonitorFromPoint "MonitorFromPoint" user32.dll Integer x Integer y DWord dwFlags Returns Handle #ENDIF //#define MONITOR_DEFAULTTONULL 0x00000000 //#define MONITOR_DEFAULTTOPRIMARY 0x00000001 //#define MONITOR_DEFAULTTONEAREST 0x00000002 Define MONITOR_DEFAULTONNULL For 0 Define MONITOR_DEFAULTONPRIMARY For 1 Define MONITOR_DEFAULTONNEAREST For 2 // a set that contains a list of monitor handles Object oMonitorHandles is a Set End_Object // "brute force" monitor enumeration: // we can't do a callback function so the Windows API is out // this Procedure will determine what monitors (if any) are // immediately adjacent to the primary monitor and store the // monitor handles in a set for use later Procedure EnumerateMonitors tMONITORINFO tPrimary Handle hMonitor Boolean bRetVal Move (MonitorFromPoint(0,0,MONITOR_DEFAULTONPRIMARY)) To hMonitor Set Value Of oMonitorHandles Item 0 To hMonitor Move (SizeofType(tMONITORINFO)) To tPrimary.cbSize Move (GetMonitorInfo(hMonitor, AddressOf(tPrimary))) To bRetVal // Move (MonitorFromPoint(-1,0,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(-1,-1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(0,-1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(tPrimary.rcMonitor.Right+1,-1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(tPrimary.rcMonitor.Right+1,0,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(tPrimary.rcMonitor.Right+1,tPrimary.rcMonitor.Bottom+1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(tPrimary.rcMonitor.Right,tPrimary.rcMonitor.Bottom+1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(0,tPrimary.rcMonitor.Bottom+1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor // Move (MonitorFromPoint(-1,tPrimary.rcMonitor.Bottom+1,MONITOR_DEFAULTONNULL)) To hMonitor If (hMonitor<>0) ; Send add_element Of oMonitorHandles hMonitor End_Procedure Send EnumerateMonitors Procedure DisplayMonitorInfo Handle hWnd tMONITORINFO tMonInfo Boolean bRetVal Integer i iCnt iRetVal Handle hMonitor Get item_count Of oMonitorHandles To iCnt If (iCnt=0) ; Send EnumerateMonitors // Get item_count Of oMonitorHandles To iCnt For i From 0 To (iCnt-1) Get Value Of oMonitorHandles Item i To hMonitor Move (SizeofType(tMONITORINFO)) To tMonInfo.cbSize Move (GetMonitorInfo(hMonitor, AddressOf(tMonInfo))) To bRetVal If (bRetVal=0) ; Get ShowLastError To iRetVal Showln "Monitor #" i Showln "Top Left: " tMonInfo.rcMonitor.Left ',' tMonInfo.rcMonitor.Top Showln "Bottom Right: " tMonInfo.rcMonitor.Right ',' tMonInfo.rcMonitor.Bottom Showln "Resolution: " (tMonInfo.rcMonitor.Right-tMonInfo.rcMonitor.Left) 'x' (tMonInfo.rcMonitor.Bottom-tMonInfo.rcMonitor.Top) Showln Loop End_Procedure Function MonitorInfo Handle hWnd Returns tMONITORINFO tMONITORINFO tMonInfo Boolean bRetVal Integer iRetVal Handle hMonitor Move (SizeofType(tMONITORINFO)) To tMonInfo.cbSize Move (MonitorFromWindow(hWnd,MONITOR_DEFAULTONPRIMARY)) To hMonitor Move (GetMonitorInfo(hMonitor, AddressOf(tMonInfo))) To bRetVal If (bRetVal=0) ; Get ShowLastError To iRetVal Function_Return tMonInfo End_Function