XLL+ Class Library (6.3)

Calling MFC methods

MFC dialog

The demo application MfcTutorial contains an example of an MFC dialog, CLanguageDialog. The example code below shows how to call this dialog when the add-in is opened.

CopyC++
BOOL CMfcTutorialApp::OnXllOpenEx()
{
    // Create an instance of CExcelWnd
    CExcelWnd wndParent;

    // Create a dialog whose parent is Excel's application window
    CLanguageDialog lang(&wndParent);

    // Show the dialog and fail if the user cancels 
    if (lang.DoModal() != IDOK)
        return FALSE;

    // Read the user's input from the dialog
    m_nLanguage = lang.m_nLanguage;
    return TRUE;
}

Next: Using .NET and the Common Language Runtime >>