Click here to Skip to main content
15,881,248 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pretranslatemessageoverride Pin
prateekkathuria26-Aug-04 10:51
prateekkathuria26-Aug-04 10:51 
GeneralRe: pretranslatemessageoverride Pin
Bob Stanneveld26-Aug-04 11:51
Bob Stanneveld26-Aug-04 11:51 
GeneralRe: pretranslatemessageoverride Pin
prateekkathuria26-Aug-04 12:14
prateekkathuria26-Aug-04 12:14 
GeneralRe: pretranslatemessageoverride Pin
prateekkathuria26-Aug-04 11:04
prateekkathuria26-Aug-04 11:04 
GeneralRe: pretranslatemessageoverride Pin
Joaquín M López Muñoz26-Aug-04 10:39
Joaquín M López Muñoz26-Aug-04 10:39 
GeneralRe: pretranslatemessageoverride Pin
prateekkathuria26-Aug-04 10:46
prateekkathuria26-Aug-04 10:46 
GeneralRe: pretranslatemessageoverride Pin
Joaquín M López Muñoz26-Aug-04 10:52
Joaquín M López Muñoz26-Aug-04 10:52 
GeneralRe: pretranslatemessageoverride Pin
GKarRacer26-Aug-04 12:27
GKarRacer26-Aug-04 12:27 
Control notifications are handled via WM_COMMAND not WM_NOTIFY. If you wish to override the original message that caused the event like a keystroke, mouse move, etc, then you subclass the control and override the appropriate window message. If you want to override the notification (which sounds like what you want), then in the parent class (dialog) you have three options:

1. Handle the notification message. Add ON_BN_CLICKED function for example.

2. Override the OnCommand message.
Inside OnCommand you can do something like:
BOOL CYourDialog::OnCommand( WPARAM wParam, LPARAM lParam )
{
    if( LOWORD(wParam) == IDC_CTRL_ID  &&  HIWORD(wParam) == BN_CLICKED )
        // do something here
    return( CDialog::OnCommand(wParam, lParam) );
}


3. Override PreTranslateMessage and process there.
BOOL CYourDialog::PreTranslateMessage( MSG *pMsg )
{
    if( pMsg->message == WM_COMMAND )
    {
        if( LOWORD(pMsg->wParam) == IDC_CTRL_ID  &&  HIWORD(pMsg->wParam) == BN_CLICKED )
            // do something here
    }
    return( CDialog::PreTranslateMessage(pMsg) );
}


I'm not sure what you're trying to do, but usually it's better to your command processing using either method 1 or 2. Rarely do I have a need to override PreTranslateMessage.
GeneralRe: pretranslatemessageoverride Pin
prateekkathuria27-Aug-04 8:23
prateekkathuria27-Aug-04 8:23 
GeneralRe: pretranslatemessageoverride Pin
GKarRacer27-Aug-04 10:31
GKarRacer27-Aug-04 10:31 
GeneralRe: pretranslatemessageoverride Pin
prateekkathuria27-Aug-04 10:43
prateekkathuria27-Aug-04 10:43 
GeneralRe: pretranslatemessageoverride Pin
GKarRacer27-Aug-04 10:56
GKarRacer27-Aug-04 10:56 
GeneralCommand - line processing Pin
Andre Massada26-Aug-04 10:06
Andre Massada26-Aug-04 10:06 
GeneralRe: Command - line processing Pin
Bob Stanneveld26-Aug-04 10:13
Bob Stanneveld26-Aug-04 10:13 
GeneralRe: Command - line processing Pin
David Crow26-Aug-04 10:22
David Crow26-Aug-04 10:22 
GeneralRe: Command - line processing Pin
Andre Massada26-Aug-04 10:29
Andre Massada26-Aug-04 10:29 
GeneralRe: Command - line processing Pin
David Crow27-Aug-04 2:31
David Crow27-Aug-04 2:31 
GeneralDLL programming Pin
Madmaximus26-Aug-04 6:54
Madmaximus26-Aug-04 6:54 
QuestionDetecting memory leaks!? Pin
umarcool26-Aug-04 6:06
umarcool26-Aug-04 6:06 
AnswerRe: Detecting memory leaks!? Pin
jmkhael26-Aug-04 6:21
jmkhael26-Aug-04 6:21 
AnswerRe: Detecting memory leaks!? Pin
Rick York26-Aug-04 6:36
mveRick York26-Aug-04 6:36 
GeneralTime function Pin
Supaflyfrank26-Aug-04 5:53
Supaflyfrank26-Aug-04 5:53 
GeneralRe: Time function Pin
jmkhael26-Aug-04 6:18
jmkhael26-Aug-04 6:18 
GeneralRe: Time function Pin
David Crow26-Aug-04 8:52
David Crow26-Aug-04 8:52 
GeneralRe: Time function Pin
Bob Stanneveld26-Aug-04 10:24
Bob Stanneveld26-Aug-04 10:24 

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.