65.9K
CodeProject is changing. Read more.
Home

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

starIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

1.00/5 (1 vote)

May 30, 2011

CPOL
viewsIcon

18671

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++
System::IntPtr hButtonWnd = this->OkButton->Handle;
HWND hwnd = (HWND)hButtonWnd.ToPointer();
::PostMessage (hwnd, BM_CLICK, 0, 0);