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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:34:04+00:00 2026-05-15T01:34:04+00:00

I need to disable the Mouse Clicks, Mouse movement for a specific windows for

  • 0

I need to disable the Mouse Clicks, Mouse movement for a specific windows for a Kiosk application. Is it Feasible in C# ?

I have removed the menu bar and title bar of a specific window, will that be a starting point to achieve the above requirement ? How can i achieve this requirement.

The code for removing the menu bar and title bar using window handle :

 #region Constants
    //Finds a window by class name
    [DllImport("USER32.DLL")]
    public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

    //Sets a window to be a child window of another window
    [DllImport("USER32.DLL")]
    public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

    //Sets window attributes
    [DllImport("USER32.DLL")]
    public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

    //Gets window attributes
    [DllImport("USER32.DLL")]
    public static extern int GetWindowLong(IntPtr hWnd, int nIndex);

    [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
    static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);

    [DllImport("user32.dll")]
    static extern IntPtr GetMenu(IntPtr hWnd);

    [DllImport("user32.dll")]
    static extern int GetMenuItemCount(IntPtr hMenu);

    [DllImport("user32.dll")]
    static extern bool DrawMenuBar(IntPtr hWnd);

    [DllImport("user32.dll")]
    static extern bool RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags);

    //assorted constants needed
    public static uint MF_BYPOSITION = 0x400;
    public static uint MF_REMOVE = 0x1000;
    public static int GWL_STYLE = -16;
    public static int WS_CHILD = 0x40000000; //child window
    public static int WS_BORDER = 0x00800000; //window with border
    public static int WS_DLGFRAME = 0x00400000; //window with double border but no title
    public static int WS_CAPTION = WS_BORDER | WS_DLGFRAME; //window with a title bar 
    public static int WS_SYSMENU = 0x00080000; //window menu  
    #endregion

    public static void WindowsReStyle()
    { 
        Process[] Procs = Process.GetProcesses();
        foreach (Process proc in Procs)
        {
            if (proc.ProcessName.StartsWith("notepad"))
            {
                IntPtr pFoundWindow = proc.MainWindowHandle;
                int style = GetWindowLong(pFoundWindow, GWL_STYLE);

                //get menu
                IntPtr HMENU = GetMenu(proc.MainWindowHandle);
                //get item count
                int count = GetMenuItemCount(HMENU);
                //loop & remove
                for (int i = 0; i < count; i++)
                    RemoveMenu(HMENU, 0, (MF_BYPOSITION | MF_REMOVE));

                //force a redraw
                DrawMenuBar(proc.MainWindowHandle);
                SetWindowLong(pFoundWindow, GWL_STYLE, (style & ~WS_SYSMENU)); 
                SetWindowLong(pFoundWindow, GWL_STYLE, (style & ~WS_CAPTION)); 
            } 
        }
    }
  • 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-15T01:34:04+00:00Added an answer on May 15, 2026 at 1:34 am

    It sounds like you are looking for EnableWindow. The description is:

    Enables or disables mouse and keyboard
    input to the specified window or
    control. When input is disabled, the
    window does not receive input such as
    mouse clicks and key presses. When
    input is enabled, the window receives
    all input.

    So you would add

    [DllImport("user32.dll")]
    static extern bool EnableWindow(IntPtr hWnd, bool enable);
    

    and

    EnableWindow(pFoundWindow, false); 
    

    This is equivalent to setting the Enabled property on a Windows Forms Form/Control.

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

Sidebar

Related Questions

I need to disable the Mouse Clicks, Mouse movement and Keyboard Inputs for a
I have done a global mouse event in my windows application. When i click
I need to disable specific keys (Ctrl and Backspace) in Internet Explorer 6. Is
I need to disable PUT, DELETE & TRACE HTTP requests on my Application Server,
I need to enable/disable completely network interfaces from a script in Windows XP. I'm
I am writing a game in Java, and need to have mouse interaction. I
I want to disable mouse right click on an HTML page. I have a
How do I disable the support for JavaScript keypress events in iframes? I need
I have a Menu where each MenuItem in the hierarchy has its Command property
I have this html code <div> <p>MY Text <a href=url>Text</a> </p> </div> I need

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.