Click here to Skip to main content
16,005,149 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do I make wrapper funtion such as "sprintf" without using "va_arg"? Pin
David Crow3-Dec-03 3:39
David Crow3-Dec-03 3:39 
AnswerRe: How do I make wrapper funtion such as "sprintf" without using "va_arg"? Pin
Tim Smith3-Dec-03 4:24
Tim Smith3-Dec-03 4:24 
GeneralGetUserName() fails in ATL COM object Pin
bryces2-Dec-03 19:47
bryces2-Dec-03 19:47 
GeneralRe: GetUserName() fails in ATL COM object Pin
Michael P Butler2-Dec-03 20:20
Michael P Butler2-Dec-03 20:20 
GeneralRe: GetUserName() fails in ATL COM object Pin
bryces2-Dec-03 21:09
bryces2-Dec-03 21:09 
GeneralRe: GetUserName() fails in ATL COM object Pin
BaldwinMartin2-Dec-03 23:21
BaldwinMartin2-Dec-03 23:21 
Generalgripper in top left corner of resiable combo box Pin
Suneet Chandok2-Dec-03 19:08
Suneet Chandok2-Dec-03 19:08 
GeneralDisplay a MessageBox in CDialog::OnActivate() Pin
Chris Ormerod2-Dec-03 18:16
Chris Ormerod2-Dec-03 18:16 
First of all I am new to C++ and in particular MFC, but I am making some minor changes to a project that I downloaded from here and the final change I need to make is to ask the user a question right after the dialog has loaded. In Visual FoxPro I would put this in the Activate of the Dialog, but in MFC this causes a multitude of issues such as:

1. The dialog doesn't actually display, so there is just a MessageBox in the middle of the screen. - The dialog displays after I click OK on the message which is understandable.
2. The Activate runs many times while the dialog is loading which causes any code I put in there to run many times (I put a flag in there to make it run only once.)

My OnActivate is shown bellow:

<br />
afx_msg void CdotNetInstallerDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimised)<br />
{<br />
	CDialog::OnActivate(nState, pWndOther, bMinimised);<br />
<br />
	// Chris Ormerod 3/Dec/2003<br />
	if (m_bRunFromReboot)<br />
	{<br />
                // Make sure it doesn't run again.<br />
		m_bRunFromReboot = false;<br />
		if (MessageBox("Continue with installation?", "Requirements Checker", MB_YESNO | MB_ICONQUESTION) == IDYES)<br />
			ResumeInstall();<br />
	}<br />
	return;<br />
}<br />


Can somebody please tell me where I should put this code? I have figured that putting it in OnActivate is probably wrong.

Thanks,

Chris Ormerod
GeneralRe: Display a MessageBox in CDialog::OnActivate() Pin
Chris Ormerod2-Dec-03 18:22
Chris Ormerod2-Dec-03 18:22 
GeneralQuestion regarding inheritance Pin
lsanil2-Dec-03 17:24
lsanil2-Dec-03 17:24 
GeneralRe: Question regarding inheritance Pin
Christian Graus2-Dec-03 17:29
protectorChristian Graus2-Dec-03 17:29 
GeneralRe: Question regarding inheritance Pin
lsanil2-Dec-03 18:57
lsanil2-Dec-03 18:57 
GeneralRe: Question regarding inheritance Pin
lsanil2-Dec-03 19:05
lsanil2-Dec-03 19:05 
QuestionCFormView: adding a CHeaderCtrl? Pin
ckorda2-Dec-03 16:48
ckorda2-Dec-03 16:48 
AnswerRe: CFormView: adding a CHeaderCtrl? Pin
Monty22-Dec-03 19:09
Monty22-Dec-03 19:09 
GeneralRe: CFormView: adding a CHeaderCtrl? Pin
ckorda4-Dec-03 11:43
ckorda4-Dec-03 11:43 
GeneralRe: CFormView: adding a CHeaderCtrl? Pin
Monty25-Dec-03 20:28
Monty25-Dec-03 20:28 
GeneralArrows keys Pin
Gagnon Claude2-Dec-03 16:00
Gagnon Claude2-Dec-03 16:00 
GeneralRe: Arrows keys Pin
Antti Keskinen3-Dec-03 3:07
Antti Keskinen3-Dec-03 3:07 
Generalabout record voice Pin
yingkou2-Dec-03 15:39
yingkou2-Dec-03 15:39 
GeneralRe: about record voice Pin
Peter Molnar3-Dec-03 14:45
Peter Molnar3-Dec-03 14:45 
Generalproject problem Pin
coda_x2-Dec-03 15:13
coda_x2-Dec-03 15:13 
GeneralRe: project problem Pin
Terry O'Nolley2-Dec-03 15:39
Terry O'Nolley2-Dec-03 15:39 
GeneralRe: project problem Pin
coda_x2-Dec-03 16:46
coda_x2-Dec-03 16:46 
Generalextracting clip from an avi or any other file Pin
hina_askh2-Dec-03 14:55
hina_askh2-Dec-03 14:55 

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.