Click here to Skip to main content
15,917,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Scrolling edit control to bottom? Pin
Gary R. Wheeler1-Apr-03 14:30
Gary R. Wheeler1-Apr-03 14:30 
GeneralRe: Scrolling edit control to bottom? Pin
IGx891-Apr-03 14:40
IGx891-Apr-03 14:40 
QuestionPurify or BoundsChecker? Pin
Jon Sagara1-Apr-03 13:45
Jon Sagara1-Apr-03 13:45 
AnswerRe: Purify or BoundsChecker? Pin
dahicke1-Apr-03 13:55
dahicke1-Apr-03 13:55 
AnswerRe: Purify or BoundsChecker? Pin
Taka Muraoka1-Apr-03 13:58
Taka Muraoka1-Apr-03 13:58 
AnswerRe: Purify or BoundsChecker? Pin
Mustafa Demirhan1-Apr-03 21:20
Mustafa Demirhan1-Apr-03 21:20 
GeneralBN_CLICKED Pin
lucy1-Apr-03 11:52
lucy1-Apr-03 11:52 
GeneralRe: BN_CLICKED Pin
Gary R. Wheeler1-Apr-03 14:02
Gary R. Wheeler1-Apr-03 14:02 
You need an entry in the message map for CMyDlg that 'connects' your button to the handler.
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
	//{{AFX_MSG_MAP(CMyDlg)
	ON_BN_CLICKED(IDC_Control_ID, OnMyBtn)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
IDC_Control_ID is the resource ID for the button that you assigned when you created it.

To get a feel for this, use the wizard to create a simple dialog application. In the resource editor, drop a button on the dialog. In VC6, right-click on the button you just added and select Events. In VS.NET, right-click and select Add Event Handler. This lets you add code to the dialog class to handle events from the button. Take a look at the code generated by the wizard. It adds code in the following places:
  • A declaration is added to MyDlg.h for the button handler. This will be a line of the form afx_msg void OnMyButton();
  • An entry is added to the message map like the example above.
  • A definition of the handler is added to MyDlg.cpp, similar to the following:
void MyDlg::OnMyButton()
{
    // handle the button
}



Software Zen: delete this;
GeneralRe: BN_CLICKED Pin
lucy2-Apr-03 5:22
lucy2-Apr-03 5:22 
GeneralMDI maximized & restored Pin
Brian Shifrin1-Apr-03 11:50
Brian Shifrin1-Apr-03 11:50 
GeneralPointer access Pin
Gabor Kalman1-Apr-03 11:13
Gabor Kalman1-Apr-03 11:13 
GeneralRe: Pointer access Pin
Dave Bryant1-Apr-03 11:29
Dave Bryant1-Apr-03 11:29 
GeneralSize of dialog in resource Pin
JGranborg1-Apr-03 10:56
JGranborg1-Apr-03 10:56 
GeneralRe: Size of dialog in resource Pin
Gary R. Wheeler1-Apr-03 14:08
Gary R. Wheeler1-Apr-03 14:08 
GeneralDynamic Arrays and Array sizes Pin
einst9921-Apr-03 10:41
einst9921-Apr-03 10:41 
GeneralRe: Dynamic Arrays and Array sizes Pin
Chris Losinger1-Apr-03 10:49
professionalChris Losinger1-Apr-03 10:49 
GeneralRe: Dynamic Arrays and Array sizes Pin
einst9921-Apr-03 11:33
einst9921-Apr-03 11:33 
GeneralRe: Dynamic Arrays and Array sizes Pin
Nick Parker1-Apr-03 11:56
protectorNick Parker1-Apr-03 11:56 
GeneralRe: Dynamic Arrays and Array sizes Pin
einst9921-Apr-03 14:12
einst9921-Apr-03 14:12 
GeneralRe: Dynamic Arrays and Array sizes Pin
Nick Parker1-Apr-03 14:55
protectorNick Parker1-Apr-03 14:55 
GeneralRe: Dynamic Arrays and Array sizes Pin
Dave Bryant1-Apr-03 10:49
Dave Bryant1-Apr-03 10:49 
GeneralRe: Dynamic Arrays and Array sizes Pin
John R. Shaw2-Apr-03 11:10
John R. Shaw2-Apr-03 11:10 
Questioncannot run on windows95?? Pin
lucy1-Apr-03 9:40
lucy1-Apr-03 9:40 
AnswerRe: cannot run on windows95?? Pin
Chris Losinger1-Apr-03 9:42
professionalChris Losinger1-Apr-03 9:42 
GeneralRe: cannot run on windows95?? Pin
lucy1-Apr-03 9:43
lucy1-Apr-03 9:43 

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.