Click here to Skip to main content
15,921,179 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: URGEnt:How to open an application?? Pin
CodeBrain9-Apr-03 23:21
CodeBrain9-Apr-03 23:21 
GeneralCrash after reading a linked list CString Pin
Willem B9-Apr-03 22:47
Willem B9-Apr-03 22:47 
GeneralRe: Crash after reading a linked list CString Pin
Joaquín M López Muñoz9-Apr-03 23:09
Joaquín M López Muñoz9-Apr-03 23:09 
GeneralRe: Crash after reading a linked list CString Pin
G. Steudtel9-Apr-03 23:21
G. Steudtel9-Apr-03 23:21 
GeneralRe: Crash after reading a linked list CString Pin
Willem B10-Apr-03 22:35
Willem B10-Apr-03 22:35 
GeneralEmbed word document inside a form Pin
Kamesh9-Apr-03 22:30
Kamesh9-Apr-03 22:30 
GeneralRe: Embed word document inside a form Pin
vijayaramaraju10-Apr-03 0:52
vijayaramaraju10-Apr-03 0:52 
Generalmodeless dialogue prob Pin
andyg.1019-Apr-03 22:18
andyg.1019-Apr-03 22:18 
Hi hope someone can help me. I'm using modelesss dialogs in one of my applications but I'm having a bit of trouble. I can create the dialogue fine and also destroy it except I'm having trouble with how to set the check for the dialogue on the window.

At the moment I have a member pointer to the dialog when it is created, on destroying the dialogue in postncdestroy I set this pointer to null.e.g.
void CCommsDlg::PostNcDestroy()
{
// TODO: Add your specialized code here and/or call the base class
if(m_pParent)
{
delete this;
((CBuggycontrolappView*)m_pParent)->m_pDlgComms = NULL;
// ((CBuggycontrolappView*)m_pParent)->OnUpdateWindowCommunicationwindow();
}
CDialog::PostNcDestroy();
}
but I'm not sure how to unset the check on the menu. The call I tried above doesn't work because you need a pointer to a CmdUI object which I'm not sure how to get. The check/window goes on and off fine when I use the menu to start and stop the dialogue but when I use the Close or the exit button I get a page fault. the code for the window command is in the view class and is

void CBuggycontrolappView::OnWindowCommunicationwindow()
{
// TODO: Add your command handler code here
m_nCommsToggleState = m_nCommsToggleState == 0 ? 1 : 0;


if(!m_nCommsToggleState)
{

if(!m_pDlgComms) // check to see if the dialogue exists
{
m_pDlgComms = new CCommsDlg(this);
}
}//else
//{ dlg1->OnExitButton;}
else if(m_nCommsToggleState)
{
if(m_pDlgComms)
{
delete m_pDlgComms;
m_pDlgComms = NULL;
}
}
}

void CBuggycontrolappView::OnUpdateWindowCommunicationwindow(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
//enable the menu item
pCmdUI->Enable(TRUE);
//Set the current toggle state
pCmdUI->SetCheck(!m_nCommsToggleState);
}

How can I check / uncheck the menu when I press either my exit(cancel)button or the close cross?
Also if I delete the this pointer in postncdestroy do I need to include a handler for OnClose with the delete this; statement or not?

Thanks Andy
ps sorry if this is stupid I am quite new to mfc.
GeneralRe: modeless dialogue prob Pin
Hans Ruck9-Apr-03 23:16
Hans Ruck9-Apr-03 23:16 
GeneralCEdit update delay Pin
CodeBrain9-Apr-03 21:59
CodeBrain9-Apr-03 21:59 
GeneralRe: CEdit update delay Pin
G. Steudtel9-Apr-03 23:34
G. Steudtel9-Apr-03 23:34 
GeneralRe: CEdit update delay Pin
Debs10-Apr-03 0:33
Debs10-Apr-03 0:33 
GeneralMultiple line in MessageBox Pin
Cedric Moonen9-Apr-03 21:59
Cedric Moonen9-Apr-03 21:59 
GeneralRe: Multiple line in MessageBox Pin
Joaquín M López Muñoz9-Apr-03 23:12
Joaquín M López Muñoz9-Apr-03 23:12 
GeneralRe: Multiple line in MessageBox Pin
Zdeslav Vojkovic9-Apr-03 23:12
Zdeslav Vojkovic9-Apr-03 23:12 
GeneralRe: Multiple line in MessageBox Pin
jeremysay9-Apr-03 23:31
jeremysay9-Apr-03 23:31 
GeneralRe: Multiple line in MessageBox Pin
Cedric Moonen9-Apr-03 23:49
Cedric Moonen9-Apr-03 23:49 
GeneralRe: Multiple line in MessageBox Pin
Rage9-Apr-03 23:54
professionalRage9-Apr-03 23:54 
GeneralRe: Multiple line in MessageBox Pin
Cedric Moonen10-Apr-03 1:27
Cedric Moonen10-Apr-03 1:27 
GeneralProblem in adding text to a progress bar Pin
summo9-Apr-03 21:22
summo9-Apr-03 21:22 
GeneralRe: Problem in adding text to a progress bar Pin
Cedric Moonen9-Apr-03 21:48
Cedric Moonen9-Apr-03 21:48 
GeneralRe: Problem in adding text to a progress bar Pin
Anonymous9-Apr-03 21:59
Anonymous9-Apr-03 21:59 
GeneralRe: Problem in adding text to a progress bar Pin
Anonymous9-Apr-03 22:01
Anonymous9-Apr-03 22:01 
GeneralVC++.NET for Palm OS Pin
Anonymous9-Apr-03 20:47
Anonymous9-Apr-03 20:47 
GeneralNamed Pipe, and Security for CreateProcessAsUser Pin
Paul Farry9-Apr-03 20:46
professionalPaul Farry9-Apr-03 20:46 

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.