Fenster Anfang/Größe



  • Hi, wie kann ich die Größe eines Fensters bekommen?
    Und die Position, aber der das Fenster anfängt?



  • Mit GetWindowRect...



  • BORLAND-Hilfe schrieb:

    The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.

    fwSide = wParam; // edge of window to be moved
    lprc = (LPRECT) lParam; // screen coordinates of drag rectangle

    Parameters

    fwSide

    Value of wParam. Indicates which edge of the window is being moved. This parameter can be a combination of the following values:

    Value Meaning
    WMSZ_BOTTOM Bottom edge
    WMSZ_BOTTOMLEFT Bottom-left corner
    WMSZ_BOTTOMRIGHT Bottom-right corner
    WMSZ_LEFT Left edge
    WMSZ_RIGHT Right edge
    WMSZ_TOP Top edge
    WMSZ_TOPLEFT Top-left corner
    WMSZ_TOPRIGHT Top-right corner

    oder

    The WM_SIZE message is sent to a window after its size has changed.

    WM_SIZE
    fwSizeType = wParam; // resizing flag
    nWidth = LOWORD(lParam); // width of client area
    nHeight = HIWORD(lParam); // height of client area

    Parameters

    fwSizeType

    Value of wParam. Specifies the type of resizing requested. This parameter can be one of the following values:

    Value Meaning
    SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized.
    SIZE_MAXIMIZED Window has been maximized.
    SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size.
    SIZE_MINIMIZED Window has been minimized.
    SIZE_RESTORED Window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies.

    oder

    The WM_MOVE message is sent after a window has been moved.

    WM_MOVE
    xPos = (int) LOWORD(lParam); // horizontal position
    yPos = (int) HIWORD(lParam); // vertical position

    Parameters

    xPos

    Value of the low-order word of lParam. Specifies the x-coordinate of the upper-left corner of the client area of the window.

    yPos

    Value of the high-order word of lParam. Specifies the y-coordinate of the upper-left corner of the client area of the window.

    Return Values

    If an application processes this message, it should return zero.

    Remarks

    The xPos and yPos parameters are given in screen coordinates for overlapped and pop-up windows and in parent-client coordinates for child windows.
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_SIZE und WM_MOVE werde auch immer automatisch am Anfang gesendet, wenn das Fenster erstmalig erstellt wird.



  • Also GetWindowRect bzw. GetClientRect ist da eigentlich für vorgesehen. Wenn Du resizen willst, musst Du, wie Elektronix geschrieben hat, einen WM_SIZE-Handler schreiben.


Anmelden zum Antworten