Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MCF Pin
Maximilien15-Feb-13 1:20
Maximilien15-Feb-13 1:20 
AnswerRe: MCF Pin
SajeeshCheviry15-Feb-13 5:56
SajeeshCheviry15-Feb-13 5:56 
QuestionHosting .net window in MFC dialog Pin
Yunaless14-Feb-13 4:06
Yunaless14-Feb-13 4:06 
QuestionCView::OnDraw - related question Pin
tagopi13-Feb-13 22:29
tagopi13-Feb-13 22:29 
AnswerRe: CView::OnDraw - related question Pin
Sivaraman Dhamodharan13-Feb-13 23:26
Sivaraman Dhamodharan13-Feb-13 23:26 
GeneralRe: CView::OnDraw - related question Pin
tagopi13-Feb-13 23:40
tagopi13-Feb-13 23:40 
SuggestionRe: CView::OnDraw - related question Pin
Richard MacCutchan13-Feb-13 23:51
mveRichard MacCutchan13-Feb-13 23:51 
GeneralRe: CView::OnDraw - related question Pin
tagopi14-Feb-13 0:14
tagopi14-Feb-13 0:14 
Thanks for you reply.

Actually, I created one MFC Application using the Template, and its SDI. So, it creates list of files, Doc, View, etc. For View, i select the base class as CView (in the wizard itself).

I removed the default created menu and included my menu list.

Now, i added a simple dialog, and for that, I created a class also derived from CDialog. Following are the .h and .cpp file contents

.h file
C++
class CSelectOptionsDlg : public CDialog
{
public:
	CSelectOptionsDlg(CWnd* pParent = NULL);
	virtual BOOL OnInitDialog();

public:
	enum {IDD = IDD_SELECTOPTIONSDLG};

public:
	void OnOkClicked();

	DECLARE_MESSAGE_MAP()  
};


.cpp
C++
CSelectOptionsDlg::CSelectOptionsDlg(CWnd* pParent)
	: CDialog(CSelectOptionsDlg::IDD, pParent)
{

}


BEGIN_MESSAGE_MAP(CSelectOptionsDlg, CDialog)

	ON_COMMAND(IDOK, OnOkClicked)

END_MESSAGE_MAP() 

void CSelectOptionsDlg::OnOkClicked() 
{
	AfxMessageBox("Ok clicked");

	EndDialog(1);	
}

BOOL CSelectOptionsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	return TRUE;
}


As I mentioned earlier, if i add this line in OnDraw, its drawing on the first time only,

C++
pDC->TextOut(20, 20, L"test sdi", 10);


Also, in MainFrm.cpp file,

C++
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	ON_WM_CREATE()
	ON_COMMAND(ID_START, OnStartPlan )  
	ON_COMMAND(ID_STOP, OnStopPlan ) 
	ON_COMMAND(ID_SELECTOPTIONS, OnSelectOption ) 
	ON_COMMAND(ID_EXIT, OnExit ) 
END_MESSAGE_MAP()



C++
void CMainFrame::OnSelectOption()
{
	CSelectOptionsDlg cSODlg;
	cSODlg.DoModal();	
}

doing like this.


OnDraw is not calling everytime. What I need is, whenever i click ok and close the dialog, OnDraw need to be called. How can i do that? Any help.

Thanks.
GeneralRe: CView::OnDraw - related question Pin
Richard MacCutchan14-Feb-13 0:41
mveRichard MacCutchan14-Feb-13 0:41 
GeneralRe: CView::OnDraw - related question Pin
tagopi14-Feb-13 1:33
tagopi14-Feb-13 1:33 
GeneralRe: CView::OnDraw - related question Pin
Richard MacCutchan14-Feb-13 1:41
mveRichard MacCutchan14-Feb-13 1:41 
AnswerRe: CView::OnDraw - related question Pin
chaau14-Feb-13 13:26
chaau14-Feb-13 13:26 
QuestionVisual Studio Display Thread question Pin
ForNow13-Feb-13 21:53
ForNow13-Feb-13 21:53 
AnswerRe: Visual Studio Display Thread question Pin
Richard MacCutchan13-Feb-13 22:26
mveRichard MacCutchan13-Feb-13 22:26 
GeneralRe: Visual Studio Display Thread question Pin
ForNow14-Feb-13 3:15
ForNow14-Feb-13 3:15 
AnswerRe: Visual Studio Display Thread question Pin
Albert Holguin14-Feb-13 4:07
professionalAlbert Holguin14-Feb-13 4:07 
AnswerRe: Visual Studio Display Thread question Pin
David Crow14-Feb-13 5:23
David Crow14-Feb-13 5:23 
GeneralRe: Visual Studio Display Thread question Pin
ForNow14-Feb-13 7:08
ForNow14-Feb-13 7:08 
Question................ Pin
Member 981141113-Feb-13 19:21
Member 981141113-Feb-13 19:21 
AnswerRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan13-Feb-13 22:25
mveRichard MacCutchan13-Feb-13 22:25 
AnswerMessage Closed Pin
14-Feb-13 0:34
Member 981141114-Feb-13 0:34 
GeneralRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan14-Feb-13 0:47
mveRichard MacCutchan14-Feb-13 0:47 
GeneralMessage Closed Pin
14-Feb-13 18:33
Member 981141114-Feb-13 18:33 
GeneralRe: upload data using xmlhttp( need an urgent help) Pin
Richard MacCutchan14-Feb-13 22:52
mveRichard MacCutchan14-Feb-13 22:52 
GeneralMessage Closed Pin
15-Feb-13 18:30
Member 981141115-Feb-13 18:30 

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.