Date: 02-16-2022
Return to Index
created by gbSnippets
'PowerBASIC provides the DeskTop functions to make it easy to get screen
'information.
'PowerBASIC DeskTop
'Full Screen - DDT
Desktop Get Size TO Width&, Height&
'Full Screen - API
hWnd = GetDesktopWindow
GetWindowRect hWnd, pRECT
'Client Area of Screen
Desktop Get Client TO Width&, Height&
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Include "Win32API.inc"
Global hDlg As DWord
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"DDT", 50,10,100,20
Control Add Button, hDlg, 200,"API", 50,40,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
Dim w As Long, h As Long
Desktop Get Size To w,h
MsgBox "Full Screen Size: " + Str$(w) + ":" + Str$(h)
Desktop Get Client To w,h
MsgBox "Client Size (above task bar): " + Str$(w) + ":" + Str$(h)
End If
If CB.Msg = %WM_Command AND CB.Ctl = 200 AND CB.Ctlmsg = %BN_Clicked Then
Local pRECT As RECT, hWnd As DWord
hWnd = GetDesktopWindow
GetWindowRect hWnd, pRECT 'outside dimensions
MsgBox "Full Screen Size: " + Str$(pRECT.nright) + ":" + Str$(pRECT.nbottom)
SystemParametersInfo %SPI_GETWORKAREA, ByVal 0, ByVal VarPTR(pRECT), ByVal 0
MsgBox "Full Client Size: " + Str$(pRECT.nright) + ":" + Str$(pRECT.nbottom)
End If
End Function
'gbs_00168
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm