Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:54:38+00:00 2026-05-26T22:54:38+00:00

I have a CDialog that is calling DoModal(), the dialog is opened, everything else

  • 0

I have a CDialog that is calling DoModal(), the dialog is opened, everything else is disabled, but for some reason I have only the keyboard capture and not the mouse.

The mouse capture is still on the last item it was on.

If I call setfocus before the DoModal, it doesn’t work, but if I do setCapture before the DoModal it works.

Can anyone explain it to me?

What is the problem? I want to understand why I need to call to setCapture or releaseCapture before the DoModal (btw- releaseCapture works as well…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:54:39+00:00Added an answer on May 26, 2026 at 10:54 pm

    There is no such thing as ‘keyboard capture’. There is just keyboard focus.

    A window that has the keyboard focus is the one that receives the keyboard related messages.
    Mouse messages are normally sent to the window just beneath the mouse cursor, without regard to the focus. That is unless the mouse is “captured”, in this case mouse messages are sent to the windows that has captured the mouse, no matter where the mouse cursor is.

    That said, do you really need to capture the mouse? Actually that is rarely necessary. And it should be done only as a consequence to a user action, never on your own.

    PS. Due to security concerns, in Windows there are actually two different kinds of mouse captures:

    • Local captures: mouse messages are sent to the capturing window, only if the mouse is over a window that belongs to the same application.
    • Global capture: mouse messages are sent to the capturing window, no matter where the mouse cursor is.

    The SetCapture function creates a global capture only if it is called while processing a WM_?BUTTON_DOWN message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a popup dialog( CDialog ) that handles WM_CTLCOLOR message to color itself.
I have a modal dialog that I would like to implement a right mouse
I have an MFC application that creates a CDialog. I'd like this CDialog to
I have a CStdDlg thats inherits from a CDialog class. In the CStdDlg dialog,
Have some dates in my local Oracle 11g database that are in this format:
I am using VS c++ 6.0. I have read that 6.0 has some problems
I'm using a CMFCLinkCtrl in my custom dialog that inherits from CDialog. The CMFCLinkCtrl
Im trying to get a CDialog that has no border or frame to show
I have a html-page loaded in a CDialog in an MFC application, using the
i have made a file open dialog, it contains an edit control whose variable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.