WM_GetInsideRect results when WM_CF_HASTRANS is used

  • I use emWin 5.40 (STemWin provided by ST)

    I tried this in the simulator:

    the result is:
    [Blocked Image: https://s18.postimg.org/tb7t46r1l/hastrans_behaviour.png]

    and inside the dubugger rectangles are:
    [Blocked Image: https://s18.postimg.org/qtw1wzcax/debugger_rect.png]

    Why, when I set the WM_CF_HASTRANS flag, does the window I created seem to have the wrong size?

    best regards
    Max

  • Hi,

    With the transparency flag set a window gets draw as part of the window behind. In this case it gets drawn as part of the WM_HBKWIN. This means that when inside the callback function (Callback2) the WM_HBKWIN is selected. The function WM_GetInsideRect() does not perform any checks regarding the selected window and if a window is transparent or not. So, this function simply returns the rectangle of the currently selected window (WM_HBKWIN).

    You can do the following, either use WM_GetInsideRectEx() with the handle of the window to be drawn (pMsg->hWin) or use WM_GetClientRect(). The second function checks if there is a transparent window. If there is one it gets selected.

    Regards
    Sven

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!