CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    30

    Loading Template Initial Values

    I'm trying to change the font of the main dialog window (at run time) using the code below (found in the forum).

    int CInitialDlg:oModal()
    {
    // TODO: Add your specialized code here and/or call the base class
    CDialogTemplate dlt;
    if (!dlt.Load(MAKEINTRESOURCE (CInitialDlg::IDD)))
    return -1;
    // set your own font, for example "Tahoma", 7 pts.
    dlt.SetFont("Tahoma", 7);
    // get pointer to the modified dialog template
    LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);
    // let MFC know that you are using your own template
    m_lpszTemplateName = NULL;
    InitModalIndirect(pdata);
    // display dialog box
    nResult = CDialog:oModal();
    // unlock memory object
    GlobalUnlock(dlt.m_hTemplate);
    return nResult;

    }

    It works fine but all the initial values of my combobox are lost. Is there anything to be done to load the values set on the VS Resource Editor instead of initialize them using ComboBox class members?

    Thanks to all in advance.

    Ricardo

  2. #2
    Join Date
    Jul 2002
    Posts
    30

    Unhappy

    The only solution I found was to delete the values added in the combobox edition and insert them at runtime (before dialog start)



    Ric

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured