Click here to Skip to main content
12,758,605 members (31,483 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 29 May 2011

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

, 30 May 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
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++:
System::IntPtr hButtonWnd = this->OkButton->Handle;
HWND hwnd = (HWND)hButtonWnd.ToPointer();
::PostMessage (hwnd, BM_CLICK, 0, 0);


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


About the Author

Jerry Jiang
Founder SmartTick Software Inc.
Canada Canada

A passionate software developer since 1992

Education:Master of Computer Science.

You may also be interested in...


Comments and Discussions

QuestionClick Pin
rhfritz119-Jun-14 6:39
memberrhfritz119-Jun-14 6: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170217.1 | Last Updated 30 May 2011
Article Copyright 2011 by Jerry Jiang
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid