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 989773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:50:44+00:00 2026-05-16T05:50:44+00:00

My application is a C# Windows Forms Application and .Net somehow makes the default

  • 0

My application is a C# Windows Forms Application and .Net somehow makes the default behavior of my main menu bar and tool strip buttons to be that you have to first click on my app’s window (anywhere), before it will let you click the menu or tool strip button. How can I change this?

Old apps like Notepad and WordPad don’t behave this way. But all the Microsoft Office apps do. But this is so annoying!

It gets worse because my app pops up secondary windows and each time I change windows, I have to first activate the blasted window before I can do anything. Ugh!

I am hoping there is some global way to change this behavior, so I don’t have to override lots of controls individually (I haven’t tried that). Does anybody know?

Note that controls on my app’s dialogs don’t exhibit this stupid behavior. Why are they different?

  • 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-16T05:50:44+00:00Added an answer on May 16, 2026 at 5:50 am

    Well, I ended up finding my own solution that it pretty simple. I derive my own ToolStrip class (and MenuStrip class) as follows:

    // This version of ToolStrip enables mouse click's even when the main form is NOT active.
    private class MyToolStrip : ToolStrip
    {
        const uint WM_LBUTTONDOWN = 0x201;
        const uint WM_LBUTTONUP   = 0x202;
    
        static private bool down = false;
    
        protected override void WndProc(ref Message m)
        {
            if (m.Msg==WM_LBUTTONUP && !down) {
                m.Msg=(int)WM_LBUTTONDOWN; base.WndProc(ref m);
                m.Msg=(int)WM_LBUTTONUP;
                }
    
            if (m.Msg==WM_LBUTTONDOWN) down=true;
            if (m.Msg==WM_LBUTTONUP)   down=false;
    
            base.WndProc(ref m);
        }
    }
    

    It appears that, just like the Mac OS X, Windows has made a GUI style decision that requires one to first activate a window BEFORE it will allow any controls to be selected. However, Windows only does this for specific controls, like ToolStrip and MenuStrip. When your window is NOT active, these controls are not sent the mouse DOWN event. I’m not sure how WinForms enforces this GUI guideline, but perhaps it uses a message filter using Application.AddMessageFilter().

    Regardless, the MenuStrip controls STILL get the mouse UP event. And that inspired my solution. I simply look for any mouse UP event that is missing it’s corresponding DOWN event. When I see this peculiar case, I generate my own mouse DOWN event, and for the ToolStrip controls, the world is all happy. 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is not pretty but it works: rm -R $(ls… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer Yes. Override the base1 and base2 methods in Derived to… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer No, you can't. Unfortunately, UIEvent doesn't expose any public way… May 16, 2026 at 12:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am writing a .Net COM DLL that runs inside a native Windows application.
I'm creating a simple Windows Forms application with NHibernate and I'm a bit confused
I have a Windows Forms application where I need to make all fonts of
I am writing a windows form application in .net using C#. I am running
I want to make a windows mobile 6 cellphone application. This application will talk
I have a simple winforms application in VB.NET 2008. I am using a form
I recently wrote a DLL in C# (.Net 2.0) which contains a class that
Environment: .net 3.5 WinForms application I am looking for some ideas how to stop
I'm having a few problems with an application that integrates sharepoint, SQL reporting services
We have a site hosted in IIS6 that we built using the .NET 1.1

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.