GetScreenWidth and Height Thru Win32Api
Posted: Thu Jun 27, 2013 1:34 pm
Enjoy :)
[code]
Declare SystemScreen as "GetSystemMetrics" of "user32"
? ? nIndex As Long
? ? result As Long
end declare
object myform as form
? ? BorderIcons=BiSystemmenu
? ? width=200
? ? height=150
? ? caption="Screen Resolution"
Object lbl as Label
? ?caption="X:"
? ? left=15
? ? top=12
end object
Object lbl1 as Label
? ? caption="Y:"
? ? left=15
? ? top=52
end object
Object txt1 as edit
? ? left=30
? ? top=50
end object
Object txt2 as edit
? ? left=30
? ? top=10
end object
Object btn as Button
? ? width=100
? ? caption="Get Resolution"
? ? top=80
? ? left=35
? ? onclick=GetScreenHeight
end object
end object
Const SM_CXSCREEN = 0 `X Size of screen
Const SM_CYSCREEN = 1 `Y Size of Screen
dim xscreen as integer
dim yscreen as integer
myform.showmodal
sub GetScreenWidth()
SystemScreen.nIndex=SM_CXSCREEN
SystemScreen.execute
xscreen=SystemScreen.result
txt2.text= str$(xscreen)
GetScreenHeight()
end sub
sub GetScreenHeight()
SystemScreen.nIndex=sm_cyscreen
SystemScreen.execute
yscreen=SystemScreen.result
txt1.text=str$(yscreen)
end sub
[/code]
[code]
Declare SystemScreen as "GetSystemMetrics" of "user32"
? ? nIndex As Long
? ? result As Long
end declare
object myform as form
? ? BorderIcons=BiSystemmenu
? ? width=200
? ? height=150
? ? caption="Screen Resolution"
Object lbl as Label
? ?caption="X:"
? ? left=15
? ? top=12
end object
Object lbl1 as Label
? ? caption="Y:"
? ? left=15
? ? top=52
end object
Object txt1 as edit
? ? left=30
? ? top=50
end object
Object txt2 as edit
? ? left=30
? ? top=10
end object
Object btn as Button
? ? width=100
? ? caption="Get Resolution"
? ? top=80
? ? left=35
? ? onclick=GetScreenHeight
end object
end object
Const SM_CXSCREEN = 0 `X Size of screen
Const SM_CYSCREEN = 1 `Y Size of Screen
dim xscreen as integer
dim yscreen as integer
myform.showmodal
sub GetScreenWidth()
SystemScreen.nIndex=SM_CXSCREEN
SystemScreen.execute
xscreen=SystemScreen.result
txt2.text= str$(xscreen)
GetScreenHeight()
end sub
sub GetScreenHeight()
SystemScreen.nIndex=sm_cyscreen
SystemScreen.execute
yscreen=SystemScreen.result
txt1.text=str$(yscreen)
end sub
[/code]