• Welcome to PlanetSquires Forums.
 

AfxGetWindowSize

Started by Paul Squires, January 02, 2019, 12:47:48 PM

Previous topic - Next topic

Paul Squires

Hi Jose,

While working on some resize code, I noticed that there is not a AfxGetWindowSize function. There are separate functions for AfxGetWindowWidth and AfxGetWindowHeight and also a AfxSetWindowSize. It would be convenient to have a AfxSetWindowSize and including such a function would also help parallel the AfxGetWindowLocation and AfxSetWindowLocation functionality.

I know that you can easily code such a function but for convenience I have it below based other code from your library.


' ========================================================================================
' Gets the width and height of the window, in pixels.
' ========================================================================================
PRIVATE SUB AfxGetWindowSize (BYVAL hwnd AS HWND, BYREF nWidth AS LONG, BYREF nHeight AS LONG)
   DIM rc AS RECT
   ' // Get the dimensions of the window
   GetWindowRect(hwnd, @rc)
   ' // Return the width and height values
   nWidth = rc.Right - rc.Left
   nHeight = rc.Bottom - rc.Top
END SUB
' ========================================================================================

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca