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);
VulpesPosted Jun 27, 2013, 3:44 PM
Trying to do it via the Win32 API would not be easy given the variables involved.
DanPosted Jun 27, 2013, 3:33 PM
VulpesPosted Jun 27, 2013, 3:11 PM
A couple of other thoughts:
1. Does that particular button have the focus by default, or can you TAB to it and then click it by pressing the ENTER key?
2. Are there any command line options which would allow you to launch the application and perform the function of that button automatically?
DanPosted Jun 27, 2013, 2:41 PM
EDIT: They really suck! They have shortcuts for all buttons and windows, and they doesn't have shortcuts for that 3 buttons ( drawn forms ) which are the most important :\
VulpesPosted Jun 27, 2013, 1:39 PM
Perhaps that's not altogether surprising, given its unusual appearance.
If that's the case, the application must detect when the form is clicked and, if the mouse is over the button drawing at the time, take the appropriate action.
Trying to click it remotely is not therefore going to be easy.
Do you know whether there's a keyboard shortcut which can be used to click the button instead of using the mouse? If there is, then you could try forcing input focus onto the app with the SetForegroundWindow function and then use SendKeys.Send to send it the appropriate keystrokes.
DanPosted Jun 27, 2013, 12:58 PM
VulpesPosted Jun 27, 2013, 12:52 PM
DanPosted Jun 27, 2013, 12:49 PM
http://img443.imageshack.us/img443/9817/ljw.png
( where I put the red arrow, that's where I put the binocular icon )
VulpesPosted Jun 27, 2013, 8:47 AM
The Find Window dialog should then open up.
Now, drag the Find Window tool from the dialog, place it over the button you're interested in and press OK on the dialog.
The Window Properties window should then show up and under the Class tab you will find the class name for the button to be used in the FindWindowEx function.
Notice also that the button's parent may not necessarily be the main window itself but some other window - you can check this from the Windows tab.
You may therefore need to call FindWindowEx more than once to get the handle for the parent window before you can get the handle for the button itself.