Get screen size

This script gives the size of the screen.

You can find the corresponding script file under Script_Examples, sub-directory of scripts.

 

'We use API function GetSystemMetrics(index) to get the size of the screen.

 

Function Get_Screen_SizeH()

local ret

ret=external("User32.dll","GetSystemMetrics",0)

if ret > 0 then

'msgbox(ret)

else

msgbox("unable to call Window API",16,"Runtime Error")

stop

endif

Get_Screen_SizeH=ret

endfunction

'--------------------------------------

Function Get_Screen_SizeV()

local ret

ret=external("User32.dll","GetSystemMetrics",1)

if ret > 0 then

'msgbox(ret)

else

msgbox("unable to call Window API",16,"Runtime Error")

stop

endif

Get_Screen_SizeV=ret

endfunction

'--------------------------------------

 

V_size=Get_Screen_SizeV()

H_size=Get_Screen_SizeH()

 

msgbox("Screen size : \n\Width : "+str$(H_size)+"\n\Height : "+str$(V_size),64, "Screen parameters")