Solved

Modless dialog box puzzlement....

Posted on 2001-07-03
5
684 Views
Last Modified: 2013-11-20
Have a DLL class dynamically linked to the MFC.
This class is nothing more than a processing class so has no window associated with it.
I would however like a dialog & progress bar to display visually what is going on as some of the data files that will be loaded are big and time consuming.
I tried to use a modeless dialog box but keep getting the error:

ERROR: Cannot find dialog template with IDD 0x2713.

I've double checked the directories and all files are there , included in the project and the dialog box is available for editing.

Here are some relevant code snippets?. Any suggestions as to where I could have screwed up???

Resource .h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by SimplyClass.rc
//
#define IDC_PROGBAR                     10000
#define IDD_PROGDLG                     10000
#define IDC_PROGRESS1                   10003
#define IDD_SHOWACTS                    10003

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        10004
#define _APS_NEXT_COMMAND_VALUE         32772
#define _APS_NEXT_CONTROL_VALUE         10004
#define _APS_NEXT_SYMED_VALUE           10000
#endif
#endif

Declaration:

class CModless : public CDialog
{
// Construction
public:
     CModless(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
     //{{AFX_DATA(CModless)
     enum { IDD = IDD_SHOWACTS };
          // NOTE: the ClassWizard will add data members here
     //}}AFX_DATA
}

Constructor:
CModless::CModless(CWnd* pParent /*=NULL*/)
     : CDialog(CModless::IDD, pParent)
{
     //{{AFX_DATA_INIT(CModless)
          // NOTE: the ClassWizard will add member initialization here
     //}}AFX_DATA_INIT
     if (Create (CModless::IDD,pParent) )
          ShowWindow(SW_SHOW);
}

Implementation:
CModless* WinShow = new CModless();

Thanks..

0
Comment
Question by:dooley090698
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:aphillips
ID: 6251435
In the DLL I think you need to use
AfxSetResourceHandle(AfxGetInstanceHandle());

You night also have to save the current resource handle using AfxGetResourceHandle() and restore it later.
0
 

Author Comment

by:dooley090698
ID: 6251479
Checked that out but...the resource is in the DLL project itself,and included in the project directories,
Should I move it??
I'm confused about the Cannot find dialog template message as the files are all there.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 100 total points
ID: 6251839
With respect to resources, the DLL is considered a part of the EXE, so the system will first look in the EXE unless you use...

  AfxSetResourceHandle(AfxGetInstanceHandle());

You also need to use...

   AFX_MANAGE_STATE(AfxGetStaticModuleState());

upon any entry into the DLL.  For instance if the EXE calls a DLL fn DoThatDllProcessing(), which, in turn creates the dialog box, then be sure that the first line in DoThatDllProcessing() is:

AFX_MANAGE_STATE(AfxGetStaticModuleState());

-- Dan
0
 

Expert Comment

by:lil_elvis2000
ID: 6254027
Since it appears that you did not make the DLL an extension DLL, the AFX_MANAGE_STATE(...) approach is the way to go.

Place this line as the first line in any function that access a resource. It will take care to reset the resource handle back when the function ends.
0
 
LVL 3

Expert Comment

by:romanm
ID: 6278183
Q: is the error a compilation, link or run-time error?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Complete beginner needs help making a cron job 9 134
Window placement 17 100
mapAB Challlenge 35 185
ERP and the other system process verification 5 25
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question