NTK and The NTK Project
are properties of Jn Dechereux
Home | Documentation | FAQ.

Vanilla 1.1.8 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorPoke45
    • CommentTimeJan 9th 2022
     
    please redirect me if this is the wrong place to place such information

    the (very helpful) NTKCORE documentation states that NTK_GETWINDOWRECT returns "an array of 4 items {nTop, nLeft, nWidth, nHeight} receiving the screen coordinates of the upper-left and lower-right corners of the window"

    my testing suggests this is incorrect: it returns an array of 4 items representing the X/Y screen coordinates of the top left and bottom right corners of the window {nLeft, nTop, nRight, nBottom}
    •  
      CommentAuthorTeam NTK
    • CommentTime6 days ago
     
    Hello,
    You're correct. This is the right place, and yes NTK_GetWindowRect() returns a 4 item's array: {nLeft, nTop, nRight, nBottom}. See down below the actualized version of NTK_GetWindowRect() documentation.

    Also, latest NTKCORE_PART2.PDF manual is available for download from both links:
    https://www.ntkproject.com/documentation.php
    https://www.ntkproject.com/ntkwip/

    Thx for pointing this out.
    Your NTK Team.
    •  
      CommentAuthorTeam NTK
    • CommentTime6 days ago edited
     
    /////////////////////////////////////////////////////////////////////////////////////
    0.16.29 NTK_GetWindowRect()
    Retrieves the integral dimensions of the bounding rectangle of the specified window.

    Syntax
    NTK_GetWindowRect( <hWnd> ) -> aRect

    Arguments
    <hWnd> Handle to the window to get dimensions.

    Return Values
    If this function succeeds, it returns an array of 4 items {nLeft, nTop, nRight, nBottom} receiving the
    screen coordinates of the upper-left and lower-right corners of the window.

    Description
    This function is used to get dimensions of the bounding rectangle of the specified window. Theses
    dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.

    Remarks
    In Windows Vista and later, the returned aRect[] now includes the area occupied by the drop shadow.
    N.B. Calling NTK_GetWindowRect() will have different behavior depending on whether the window
    has ever been shown or not. If the window has not been shown before, NTK_GetWindowRect() will
    not include the area of the drop shadow.

    Example
    . . .
    
    STATIC FUNCTION DoEventHandler(hWnd,nMsg,nwParam,nlParam)
    Local nW, nH, aWndSize, aMinMaxInfo
    Local nMinWndWidth  := 320 // min. w. boundary
    Local nMinWndHeight := 200 // min. h. boundary
    
    DO CASE
    
       CASE nMsg == WM_GETMINMAXINFO
            // get the window dimensions in screen coordinates
            aWndSize := NTK_GetWindowRect( hWnd )
    
            // determine the window's actual width and height
            nW := aWndSize[RECT_Right] - aWndSize[RECT_Left]
            nH := aWndSize[RECT_Bottom] - aWndSize[RECT_Top]
    
            // ----------------------------------------------------------------------------
            // prevent user from resizing the window outside the minimum boundaries
            // ----------------------------------------------------------------------------
            IF nW <= nMinWndWidth .OR.  nH <= nMinWndHeight
               // Convert the MINMAXINFO structure into an xhb array
               aMinMaxInfo := NTK_MinMaxInfo2A( nlParam )
    
               If nW <= nMinWndWidth
                  // specify the new minimum width
                  aMinMaxInfo[ MINMAXINFO_ptMinTrackSizeX ] := nMinWndWidth
               EndIf
    
               If nH <= nMinWndHeight
                  // specify the new minimum height
                  aMinMaxInfo[ MINMAXINFO_ptMinTrackSizeY ] := nMinWndHeight
               EndIf
    
               // return the MINMAXINFO structure back to MS-Windows
               NTK_SetMinMaxInfo( nlParam, aMinMaxInfo )
            ENDIF
            // ----------------------------------------------------------------------------
            RETURN( 0 )
    ENDCASE
    
    RETURN NTK_DefWindowProc(hWnd,nMsg,nwParam,nlParam)
    
    
    . . .
    

    See Also
    NTK_GetClientRect(), NTK_ScreenToClient()
    /////////////////////////////////////////////////////////////////////////////////////