cannot get handle(dialog box also parent window) in child window,please help me

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

    • cannot get handle(dialog box also parent window) in child window,please help me

      Hello, I am from a Chinese electronics enthusiast.

      In the process of using emWin encountered a puzzle can not be solved, I hope to get guidance.

      【question】I created a new window (child window) when the button(which is the widget of the dialog box)pressed . now want to use the LISTVIEW widget(in the parent window) in the child window, and now I can't get the LISTVIEW widget Handle in the child window. How can I solve this? ?( ?( hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_LISTVIEW1); cannot function

      thank you very much!

      The post was edited 1 time, last by 34555162: 【problem have been solved】First get parent window(dialog box) handle hWinPicture = GUI_CreateDialogBox,second use the handle in the child window hItem = WM_GetDialogItem(hWinPicture, GUI_ID_LISTVIEW1); ().

    • Hi,

      I'm not sure if I get you right.

      You have a dialog with LISTVIEW and a BUTTON. When pressing the BUTTON you create another window ("A") which is the child of the dialog.

      After creating "A" you want to get the handle of the LISTVIEW from within the callback function of "A".

      To do that you have to get the handle of the parent of "A" by calling hParent = WM_GetParent(pMsg->hWin) in the callback function of "A".

      With the handle of the parent you can retreive the handle of the LISTVIEW with:
      hItem = WM_GetDialogItem(hParent, GUI_ID_LISTVIEW1);

      Regards,
      Sven
    • thank you very much!【problem have been solved】First get parent window(dialog box) handle hWinPicture = GUI_CreateDialogBox,second use the handle in the child window hItem = WM_GetDialogItem(hWinPicture, GUI_ID_LISTVIEW1);

      The rigorous style of Germans is worth learning by the world!