TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dan
NA
23
8.5k
Press button from a handled process
Jun 27 2013 6:42 AM
I created a C# application. With this application I want to access a button from another application, which is not made by me. Its process name is uWebCam. This is how it looks:
http://img829.imageshack.us/img829/6606/djq.png
The button that I want to access is located at the bottom of the application, that in the red hexagonal form.
With Spy++ I took all its classes:
How can I find that button and handle it? I tried something like this, but no answer:
Process process = Process.GetProcessesByName("uWebCam")[0];
IntPtr ButtonHandle = FindWindowEx(process.MainWindowHandle, IntPtr.Zero, null, "button1");
SendMessage(ButtonHandle, BM_CLICK, IntPtr.Zero, IntPtr.Zero);
Here are the API functions:
public const int BM_CLICK = 0x00F5;
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
Reply
Answers (
9
)
Generating PDf from Multiple Excel sheet using VB.net
Exception type for non-integer