Group dialog items to a single “Group” (Visual Studio)

前端 未结 1 849
醉话见心
醉话见心 2021-01-26 02:56

I want to create a dialog window for change settings of an application. Below is a screenshot of Adobe Reader. After using Spy++, I guess that:

On the right side, al

相关标签:
1条回答
  • 2021-01-26 03:43

    I would like to know how to assign a parent...

    SetParent Windows API. You supply HWND of your control and the handle of the supposed new parent.

    In resource script, the controls will be children of the dialog itself, but on runtime you are free to change this and group them into a hierarchy of your interest.

    You might also want to consider putting the supposed child groups into separate dialog template and have it as "composite control" - to be instantiated separately and be a child of a higher level dialog.

    UPD. Have a look at this simple project (C++/ATL): AtlChildDialog. In particular, at main dialog's WM_INITIDIALOG handler:

    ATLVERIFY(m_ChildDialog.Create(m_hWnd, (LPARAM) this));
    ATLVERIFY(m_ChildDialog.MoveWindow(50, 50, 200, 150));
    m_ChildDialog.m_EditWindow.SetWindowText(_T("Some Text"));
    m_ChildDialog.ShowWindow(SW_SHOWNORMAL);
    m_ChildDialog.SetFocus();
    

    IDD_MAIN

    IDD_CHILD

    All together on runtime:

    Run Time

    0 讨论(0)
提交回复
热议问题