Setting SDI window position at runtime

Ok slight brain fart…

I need to position an SDI window at runtime (center horizontally and above the taskbar)

I use the GetPosition(myWindow, x, y, w ,h) but missing how to get the total width/height of the desktop and the height of the taskbar?

TIA

You can try using the GetSystemMetrics function for get the screen size

MODULE('Windows')
  GetSystemMetrics( LONG nIndex ), LONG, PASCAL, DLL(1)
END
SM_CXSCREEN         EQUATE(0)   ! Total screen width in pixels
SM_CYSCREEN         EQUATE(1)   ! Total screen height in pixels
SM_CXFULLSCREEN     EQUATE(16)  ! Width of maximized window client area (excludes taskbar)
SM_CYFULLSCREEN     EQUATE(17)  ! Height of maximized window client area (excludes taskbar)
ScreenWidth  LONG
ScreenHeight LONG

ScreenWidth  = GetSystemMetrics(SM_CXSCREEN)
ScreenHeight = GetSystemMetrics(SM_CYSCREEN)

Hope this helps
Tuz

2 Likes