GUI_SendKeyMsg() and WM_SendMessage() stop working

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • GUI_SendKeyMsg() and WM_SendMessage() stop working

    Dear all,


    is there a rationale behind the 'interruption of work' of GUI_SendKeyMsg and WM_SendMessage functions after a while?

    I use them in order to propagate events from the main function of my application, where I capture some key press events, to the STemWin graphical application, where I have several windows, each one implementing a specific function; in order to delete/hide or create/make visibile the window I need to see on the display I use the buttons available on the hardware. For some time everything look perfect, then suddendly both GUI_SendKeyMsg and WM_SendMessage stop sending the events.
    But the events are actually captured, I toggle a led when a key is pressed, so I am sure the two functions are called; but they do not forward the information.

    Any idea? Is there a way to check the events queue? Is there a way to check whether the function call worked or not? It does not seem to me there is a return value that can be checked, am I wrong?

    Thanks in advance,
    Ezio
  • Hello Adrian,

    I thought that because, after a while, none of the windows callback functions captured the WM_KEY events. As if the GUI_SendKeyMsg stopped sending the event.
    So I tried with WM_SendMessage but the output was the same.

    I added a couple of WM_SetFocus() instructions and now the situation looks ok: I thought that when a window is equipped with an input widget, such as a button, were automatically able to get the focus and hence capture the WM_KEY events but that behaviour apparently changed after a while and adding WM_SetFocus() makes the window always focussed.

    Best regards,
    Ezio