VC++ help please...

Discussion in 'SolidWorks' started by Sushil, Oct 3, 2003.

  1. Sushil

    Sushil Guest

    Hi ,

    This is what I have done. I was just trying a project, which involves
    creating a simple add-in using the SolidWorks Addin App Wizard.

    I have SolidWorks 2001 Plus and VC++ Version 6.0. I created a simple
    application using the default settings in the App Wizard. Then changed
    to configuration to Win32 MBCS Debug/Release and built the
    application. It worked fine.

    Then I created a new dialog resource. I created a new dialog class for
    the resource. Then wrote code for the DoModal method as mentioned in
    the tutorial. This is the code that I wrote:

    HINSTANCE hInst = AfxGetResourceHandle();
    if (m_lpszTemplateName != NULL)
    {
    TheApplication->SetResources();
    hInst = AfxFindResourceHandle(m_lpszTemplateName,RT_DIALOG);
    HRSRC hResource = ::FindResource(hInst,m_lpszTemplateName,RT_DIALOG);
    m_hDialogTemplate = LoadResource(hInst,hResource);
    TheApplication->ResetResources();
    }

    Then I added the necessary headerfiles in the relevant places.

    Added amapp.h,ExampleApp.h and resource.h to the Dialog.cpp header
    file.
    and added dialog.h file to mainapp.cpp file.

    I invoked the DialogBox from the MenuItemCB function. The code looks
    like this:

    void MenuItemCB(void)
    {
    CSettingsDlg dlg;
    dlg.DoModal();
    return;
    }

    Now, when I try to build the application, it build fine. I launch the
    dll inside SolidWorks, and when I open the dialog box by clicking on
    the menu button, it opens up, but hangs the SolidWorks Application and
    it eventually crashes saying that it encountered an unhandled error.

    Is there anything that I am missing over here??

    Please help me out.

    Thanks,
    Sushil.
     
    Sushil, Oct 3, 2003
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.