Click here to Skip to main content
15,907,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to change the background color of a button? Pin
eli1502197928-Apr-07 23:56
eli1502197928-Apr-07 23:56 
QuestionRe: How to change the background color of a button? [modified] Pin
Doc Lobster29-Apr-07 0:20
Doc Lobster29-Apr-07 0:20 
AnswerRe: How to change the background color of a button? Pin
eli1502197929-Apr-07 1:08
eli1502197929-Apr-07 1:08 
AnswerRe: How to change the background color of a button? Pin
Joan M29-Apr-07 1:04
professionalJoan M29-Apr-07 1:04 
GeneralRe: How to change the background color of a button? Pin
eli1502197929-Apr-07 1:16
eli1502197929-Apr-07 1:16 
GeneralRe: How to change the background color of a button? Pin
Joan M29-Apr-07 1:24
professionalJoan M29-Apr-07 1:24 
AnswerRe: How to change the background color of a button? Pin
Michael Dunn29-Apr-07 21:00
sitebuilderMichael Dunn29-Apr-07 21:00 
QuestionHow to Understand the macro ON_ONCTROL_RANGE Pin
cnhnyu28-Apr-07 23:53
cnhnyu28-Apr-07 23:53 
I wrote a test mfc project based on dialog, just one main dialog, three check boxes on it.

in .h file I define a bool var.

BOOL m_fCheck[3];

and a function:
afx_msg void OnCheck();

in .cpp file :

(1) in constructor:
for ( int i = 0; i < 3; i++ )
m_fCheck[i] = FALSE;
(2) in DoDataExchange
void CTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
for ( int i=0; i<3; i++ )
DDX_Check(pDX, IDC_CHECK1 + i, m_fCheck[i]);
}
(3) On Message Map
ON_CONTROL_RANGE(BN_CLICKED, IDC_CHECK1, IDC_CHECK3, OnCheck)
(4) OnCheck() function
void CTestDlg::OnCheck()
{
}

???: When I run this test program in debug mode, I click any check box and has
no error. But when I run this program in release mode:
A fatal error occured:
First-chance exception in ChtVCData.exe: 0xC0000096: Privileged Instruction.


I do one test today.
I change macro
ON_CONTROL_RANGE(BN_CLICKED, IDC_CHECK1, IDC_CHECK3, OnCheck)
to :
ON_BN_CLICKED(IDC_CHECK1, OnCheck)
ON_BN_CLICKED(IDC_CHECK2, OnCheck)
ON_BN_CLICKED(IDC_CHECK3, OnCheck)

And then I run in debug an release mode, no error found again. Now I can asure that the problem is on the macro
ON_CONTROL_RANGE(BN_CLICKED, IDC_CHECK1, IDC_CHECK3, OnCheck)
it equals
the three macro
ON_BN_CLICKED(IDC_CHECK1, OnCheck)
ON_BN_CLICKED(IDC_CHECK2, OnCheck)
ON_BN_CLICKED(IDC_CHECK3, OnCheck)

YES OR NO ?





----------------------------------------
Don't let habit prevent you from trying something new.

AnswerRe: How to Understand the macro ON_ONCTROL_RANGE Pin
Michael Dunn29-Apr-07 21:03
sitebuilderMichael Dunn29-Apr-07 21:03 
GeneralRe: How to Understand the macro ON_ONCTROL_RANGE Pin
cnhnyu1-May-07 18:23
cnhnyu1-May-07 18:23 
QuestionA difficult decision, C programming Pin
C_Zealot28-Apr-07 22:58
C_Zealot28-Apr-07 22:58 
AnswerRe: A difficult decision, C programming Pin
Arun.Immanuel28-Apr-07 23:45
Arun.Immanuel28-Apr-07 23:45 
GeneralRe: A difficult decision, C programming Pin
C_Zealot28-Apr-07 23:52
C_Zealot28-Apr-07 23:52 
GeneralRe: A difficult decision, C programming Pin
Arun.Immanuel29-Apr-07 0:05
Arun.Immanuel29-Apr-07 0:05 
GeneralRe: A difficult decision, C programming Pin
C_Zealot29-Apr-07 0:08
C_Zealot29-Apr-07 0:08 
QuestionAbout Audio-network program Pin
kcynic28-Apr-07 22:35
kcynic28-Apr-07 22:35 
AnswerRe: About Audio-network program Pin
Mark Salsbery29-Apr-07 8:21
Mark Salsbery29-Apr-07 8:21 
GeneralRe: About Audio-network program Pin
kcynic29-Apr-07 16:37
kcynic29-Apr-07 16:37 
GeneralRe: About Audio-network program Pin
Mark Salsbery30-Apr-07 6:41
Mark Salsbery30-Apr-07 6:41 
QuestionCan i change the place of the drawing item in CListCtrl in run time ? Pin
Yanshof28-Apr-07 20:18
Yanshof28-Apr-07 20:18 
Question(WinAPI) RasDial & RasHangUp Pin
shareholder77128-Apr-07 20:02
shareholder77128-Apr-07 20:02 
AnswerRe: (WinAPI) RasDial & RasHangUp Pin
PJ Arends28-Apr-07 22:04
professionalPJ Arends28-Apr-07 22:04 
GeneralRe: (WinAPI) RasDial & RasHangUp Pin
shareholder7715-May-07 21:52
shareholder7715-May-07 21:52 
QuestionDetecting Microphone Input Pin
selmak28-Apr-07 17:07
selmak28-Apr-07 17:07 
AnswerRe: Detecting Microphone Input Pin
Mark Salsbery29-Apr-07 8:30
Mark Salsbery29-Apr-07 8: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.