Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

correct simulate OnClick-Event on every Control in .NET Compact Framework

, 25 Aug 2010
Rate this:
Please Sign up or sign in to vote.
.NET Compact Framework
Your search ends here...
 
Here is the correct Source to simulate an OnClick-Event on every Control in .NET Compact Framework.
 

[DllImport("coredll")]
        private static extern void SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);
        const int WM_LBUTTONDOWN = 0x201;
        const int WM_LBUTTONUP = 0x202;
        public void PerformClick(System.Windows.Forms.Control control)
        {
            SendMessage(control.Handle, WM_LBUTTONDOWN, 0, 0);
            control.Update();
            System.Threading.Thread.Sleep(100);
            SendMessage(control.Handle, WM_LBUTTONUP, 0, 0);
        }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Taulie
Software Developer
Germany Germany
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140922.1 | Last Updated 25 Aug 2010
Article Copyright 2010 by Taulie
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid