Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C++

How to simulate mouse click event in .NET using C++

1.00/5 (1 vote)
30 May 2011CPOL 18.6K  
Code to simulate a mouse click event in C++

Here is a small code snippet that shows how to simulate a mouse click event, in C++:

C++
C++
System::IntPtr hButtonWnd = this->OkButton->Handle;
HWND hwnd = (HWND)hButtonWnd.ToPointer();
::PostMessage (hwnd, BM_CLICK, 0, 0);

License

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