CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Location
    Terrebonne, Quebec, Canada
    Posts
    67

    Question Accelerator causing conflict

    Hi,

    I have a WIN32 dialog based application with Accelerator for Menu & short cut key. My App have an amodal popup dialog with an Editbox control. When I do CTRL+C in the EditBox, the Accelerator trap the event and my main dialog receive the command

    I know that I can right-click in my Editbox to display the Cut&Paste menu but I absolutetly need that short-key work for EditBox.

    Any idea to solve the problem?

    Thanks,
    Michel.

  2. #2
    Join Date
    Apr 2004
    Posts
    76
    Hi Michel,

    PreTranslateMessage(...) may help. Here's a sample that hooks up F5 to a refresh function.

    Jeff

    Code:
    ////////////////////////////////////////////////////////
    //
    // Hook up F5 to Refresh
    //
    BOOL CDlg::PreTranslateMessage( MSG* pMsg ) {
    
        if( pMsg->message == WM_KEYDOWN ) {
    
            if( pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE ) {
    
                // Do something
    
                ////////////////////////////////////////////////////////
                //
                // Any Non-Zero will do
                //
                return TRUE;
            
            } else if( pMsg->wParam == VK_F5 ) {
        
                ////////////////////////////////////////////////////////
                //
                // Call our Refresh
                //
                RefreshListView();
    
                ////////////////////////////////////////////////////////
                //
                // Any Non-Zero will do
                //
                return TRUE;
            }
        }
    
        return CDialog::PreTranslateMessage(pMsg);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured