Click here to Skip to main content
15,895,799 members
Articles / Programming Languages / C++
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
30 May 2011CPOL 18.4K   1   1
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)


Written By
Founder SmartTick Software Inc.
Canada Canada
Jerry Jiang(BOLIANG JIANG)

A passionate software developer since 1992

Education:Master of Computer Science.

jerry@smarttick.com

Comments and Discussions

 
QuestionClick Pin
rhfritz119-Jun-14 5:39
rhfritz119-Jun-14 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.