Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Modless dialog box puzzlement....

Posted on 2001-07-03
5
Medium Priority
?
691 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 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