#include<afxwin.h>
#include<stdlib.h>
#include"resource.h"
//created by imper
class CMyDialog:public CDialog
{
private:
bool FLAG;
public:
CMyDialog::CMyDialog():CDialog(IDD_DIALOG1){
this->FLAG=false;
}
afx_msg void OnPaint();
afx_msg void ChangeFlag();
BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
};
class CMyApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};
BOOL CMyApp::InitInstance()
{
SetDialogBkColor(RGB(192,192,192),RGB(0,0,0));
CMyDialog dialog;
m_pMainWnd=& dialog;
dialog.DoModal();
return FALSE;
}
BEGIN_MESSAGE_MAP(CMyDialog,CDialog)
ON_WM_PAINT()
ON_COMMAND(IDC_BUT_CHNGFLG,ChangeFlag)
END_MESSAGE_MAP()
BOOL CMyDialog::OnInitDialog()
{InvalidateRect(NULL);
CDialog::OnInitDialog();
return TRUE;
}
void CMyDialog::ChangeFlag(){
this->FLAG=!this->FLAG;
this->InvalidateRect(NULL);
}
void CMyDialog::OnPaint(){
CPaintDC dc(this);
if(this->FLAG){
dc.TextOut(10,10,"йопта!");
}
}
CMyApp MyApp;
код жоскей - сам причиши, что нужно