Ralf,
A couple of programs which may help:
winapp
STDCALL GETSYSTEMMETRICS 'GetSystemMetrics' (VAL):INTEGER*4
integer*4 SM_CXSCREEN , SM_CYSCREEN, SM_XVIRTUALSCREEN, &
SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN, &
SM_CYVIRTUALSCREEN, SM_CMONITORS, SM_SAMEDISPLAYFORMAT
SM_CXSCREEN = 0
SM_CYSCREEN = 1
SM_XVIRTUALSCREEN = 76
SM_YVIRTUALSCREEN = 77
SM_CXVIRTUALSCREEN = 78
SM_CYVIRTUALSCREEN = 79
SM_CMONITORS = 80
SM_SAMEDISPLAYFORMAT = 81
Print*,'Number of monitors'
print *,GetSystemMetrics(SM_CMONITORS)
print *,'Same display format'
print *,GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
print *,'Coordinates of left and top of virtual screen'
print *,GetSystemMetrics(SM_XVIRTUALSCREEN)
print *,GetSystemMetrics(SM_YVIRTUALSCREEN)
print *,'Width and height of virtual screen'
print *,GetSystemMetrics(SM_CXVIRTUALSCREEN)
print *,GetSystemMetrics(SM_CYVIRTUALSCREEN)
print *,'Width and height of primary monitor'
print *,GetSystemMetrics(SM_CXSCREEN)
print *,GetSystemMetrics(SM_CYSCREEN)
end
For my computer with twin screens (Primary = 1920 x 1080 and secondary 1280 x 1024), this returns:
Number of monitors
2
Same display format
1
Coordinates of left and top of virtual screen
0
0
Width and height of virtual screen
3200
1080
Width and height of primary monitor
1920
1080
Second program places two windows, one on each screen and determines their size and position. Which matches the requested information. The second screen is derived from the above program.
winapp
include <windows.ins>
ix1 = 200
iy1 = 100
icontrol1 = 1
i=winio@('%ww%ca[Window1]%sz&',ix1,iy1)
i=winio@('%sp%hw%lw',0,0,ihandle1,icontrol1)
ix2 = 400
iy2 = 100
icontrol2 = 1
i=winio@('%ww%ca[Window2]%sz&',ix2,iy2)
i=winio@('%sp%hw%lw',1921,10,ihandle2,icontrol2)
call get_window_location@(ihandle1,iposx1,iposy1,iwidth1,iheight1)
call get_window_location@(ihandle2,iposx2,iposy2,iwidth2,iheight2)
print *,'Position and size of window 1'
print *,iposx1,iposy1,iwidth1,iheight1
print *,'Position and size of window 2'
print *,iposx2,iposy2,iwidth2,iheight2
end
Hope this helps. Note when get_window_location@ and move_window@ are used on individual controls, the positions are within the window, not screen position, but one refers to the top corner of the outer edge of the window and the other to the top corner of the available window space underneath any menu which may be used and some trickery is required to harmonise the two. See this post https://forums.silverfrost.com/Forum/Topic/2316&highlight=movewindow
See this link for the explanation of the GetSystemMetrics function
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385
Ian