Click here to Skip to main content
15,897,151 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Relocatable DLLs Pin
Optimus Chaos19-Dec-05 22:21
Optimus Chaos19-Dec-05 22:21 
AnswerRe: Relocatable DLLs Pin
Optimus Chaos19-Dec-05 22:22
Optimus Chaos19-Dec-05 22:22 
Questionhow to use "FindResource" Pin
kotiramkoteswararao19-Dec-05 19:08
kotiramkoteswararao19-Dec-05 19:08 
AnswerRe: how to use "FindResource" Pin
kotiramkoteswararao19-Dec-05 20:04
kotiramkoteswararao19-Dec-05 20:04 
GeneralRe: how to use "FindResource" Pin
Optimus Chaos19-Dec-05 20:26
Optimus Chaos19-Dec-05 20:26 
AnswerRe: how to use "FindResource" Pin
ThatsAlok20-Dec-05 18:12
ThatsAlok20-Dec-05 18:12 
Questionmodeless dialog with modal dialog problem Pin
followait19-Dec-05 18:00
followait19-Dec-05 18:00 
AnswerRe: modeless dialog with modal dialog problem Pin
Farhat Aisha20-Dec-05 4:36
Farhat Aisha20-Dec-05 4:36 
How can you close your application when a modal dialog is open? Or is your application crashing when you close it when the modeless dialog stay open?

To use modeless dialog in application make a modeless dialog pointer as a member of your mainframe class. Here is the sample code for using modeless dialog box

class CModeless: public CDialog
{
// Construction
UINT m_nID;
CWnd* m_pParent;

public:
CModeless(CWnd* pParent = NULL): CDialog(CModeless::IDD, pParent)//standard constructor
{
m_nID=CModeless::IDD;
m_pParent=pParent;
}
BOOL Create()
{
return CDialog::Create(m_nID,m_pParent);
}
// Dialog Data
//{{AFX_DATA(COptionDllDlg)
enum { IDD = IDD_DIALOG_MODELESS };
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COptionDllDlg)
protected:
virtual void PostNcDestroy();
//}}AFX_VIRTUAL

// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(COptionDllDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
afx_msg void OnDestroy();
afx_msg void OnClose();

};



void CModeless::OnDestroy()
{
((CMainFrame *) AfxGetMainWnd())->ModelessDlgDone();
CDialog::OnDestroy();
}
void CModeless::OnClose()
{
((CMainFrame *) AfxGetMainWnd())->ModelessDlgDone();
CDialog::OnClose();
}
void CModeless::PostNcDestroy()
{
delete this;
((CMainFrame *) AfxGetMainWnd())->ModelessDlgDone();
// CDialog::PostNcDestroy();
}


And In mainframe class add the following members

CModeless *m_pModelessDlg;
CModeless *ShowModelessDlg();
void ModelessDlgDone();


initialize m_pModelessDlg to NULL in the constructor

CMainFrame::CMainFrame():m_pModelessDlg(NULL)
{
...
}


CModeless *CMainFrame::ShowModelessDlg()
{
if (m_pScaleDlg==NULL)
{
m_pModelessDlg=new CModeless(this);
m_pModelessDlg->Create();
m_pModelessDlg->ShowWindow(SW_SHOW);
}
else
{
m_pModelessDlg->ShowWindow(SW_SHOW);
}
return m_pModelessDlg;

}
void CMainFrame::ModelessDlgDone()
{
m_pModelessDlg=NULL;
EnableWindow();
}

CMainFrame::~CMainFrame()
{
if (m_pModelessDlg)
{
m_pModelessDlg->DestroyWindow();
m_pModelessDlg=NULL;
}
}
QuestionCOnnecting UPS with PCS using Windows Management Ins Pin
abhiramsss19-Dec-05 17:58
abhiramsss19-Dec-05 17:58 
AnswerRe: COnnecting UPS with PCS using Windows Management Ins Pin
vikas amin19-Dec-05 20:04
vikas amin19-Dec-05 20:04 
QuestionHow to control word before print? Pin
sharkmouse19-Dec-05 17:48
sharkmouse19-Dec-05 17:48 
QuestionHow to change the button style of Console Application Pin
IsaacLitingjun19-Dec-05 16:44
IsaacLitingjun19-Dec-05 16:44 
Questionblock popups Pin
neliocc19-Dec-05 16:42
neliocc19-Dec-05 16:42 
AnswerRe: block popups Pin
Owner drawn19-Dec-05 18:15
Owner drawn19-Dec-05 18:15 
QuestionQuestion about using MATLAB COM builder & VC++ Pin
QuangDien19-Dec-05 16:07
QuangDien19-Dec-05 16:07 
Questionglobal anonymous unions Pin
zildjohn0119-Dec-05 10:44
zildjohn0119-Dec-05 10:44 
AnswerRe: global anonymous unions Pin
vikas amin19-Dec-05 18:53
vikas amin19-Dec-05 18:53 
AnswerRe: global anonymous unions Pin
vikas amin19-Dec-05 20:03
vikas amin19-Dec-05 20:03 
NewsRe: global anonymous unions Pin
zildjohn0120-Dec-05 9:04
zildjohn0120-Dec-05 9:04 
AnswerRe: global anonymous unions [edited] Pin
toxcct19-Dec-05 21:38
toxcct19-Dec-05 21:38 
GeneralRe: global anonymous unions Pin
vikas amin19-Dec-05 22:01
vikas amin19-Dec-05 22:01 
GeneralRe: global anonymous unions Pin
Eytukan19-Dec-05 22:16
Eytukan19-Dec-05 22:16 
GeneralRe: global anonymous unions Pin
toxcct19-Dec-05 22:17
toxcct19-Dec-05 22:17 
GeneralOT Pin
Eytukan19-Dec-05 22:25
Eytukan19-Dec-05 22:25 
GeneralRe: OT Pin
toxcct19-Dec-05 22:41
toxcct19-Dec-05 22:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.