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

  • Home
  • SEARCH
  • 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 4034002
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:55:03+00:00 2026-05-20T11:55:03+00:00

In my C++ MFC application I have an ActiveX control on a form. At

  • 0

In my C++ MFC application I have an ActiveX control on a form. At some point I create and show a new dialog. I don’t want the user to be able to click the ActiveX control while this second dialog is up so I tried creating it as a child dialog. However the ActiveX control always appears above the child dialog in Z order. I have tried sending message on the create to change the Z order but nothing worked.

I’ve tried using Windows Hooks to intercept the mouse click using the following code:

GetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)CDWFDLG::ClickProc, GetModuleHandle(NULL), 0)

 LRESULT CALLBACK CDWFDLG::ClickProc(int ncode, WPARAM wparam, LPARAM lparam)
{

if(wparam == WM_LBUTTONDOWN)
{
    Beep(110, 30);
    return TRUE;
}
return CallNextHookEx(0, ncode, wparam, lparam);
}

This blocks all left mouse clicks which is what I want. However it does this on everything, not just on my application. I’ve tried setting the thread Id using

GetCurrentThreadId()

and

GetWindowThreadProcessId(this->m_hWnd, &threadId )

However neither of these worked. What should I use to just get the hook to run on my application? Once this is working I was planning on using the coordinates of the click to check whether is was on the new dialog and handle it from there.

Thanks

  • 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-20T11:55:04+00:00Added an answer on May 20, 2026 at 11:55 am

    Although I couldn’t fix the problem using Window Hooks, I think I’ve fixed it using the dialog properties. I’ve set the parent dialog’s Control Parent to True and left everything else in the child dialog’s properties to default (Control is false and and Style is Popup etc).

    Now when I call the dialog through DoModal() it has focus and doesn’t allow clicks on the ActiveX control.

    Thanks

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

Sidebar

Related Questions

I have an MFC application, which i don't want to be closed during the
I have a multithreading MFC application. But I don't want to have hacky code
I have an MFC application that uses an ancient (circa 1999) third-party ActiveX control.
I'm coding an MFC application in which i have a dialog box with multiple
I have a MFC dialog based application in which I use ::system() function to
I have an application (written in C++ with MFC, but I don't think that
I have created an activex control using mfc and added the control to a
I have an MFC dialog application that I am using as the front end
I have a MFC application that I want to distribute via USB flash drives.
I have a dialog based MFC application through which I have to call a

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.