How can i call WindowProc from my c# app?

Posted on 2006-04-12
Last Modified: 2012-08-13
How do i call the Win API WindowProc from my C# app?
Question by:salted
    LVL 96

    Accepted Solution

    What are you trying to do?

    Here is an example of overriding the default WndProc, and blocking a left click in the non-client area of a window:

        protected override void WndProc(ref System.Windows.Forms.Message m)
          const int WM_NCLBUTTONDBLCLK = 0xA3;
          if (m.Msg != WM_NCLBUTTONDBLCLK)
            base.WndProc(ref m);


    Author Comment

    Ah, no problem, I'm trying to send the message, not capture an incoming one. Sorry, got them the wrong way round :)

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now