I’m trying to send a mouse left click to a sopcast mute button, in c#, but with no result.
Here is what I did:
const int BN_CLICKED = 245;
public static void mute_sopcast()
{
IntPtr hwnd = FindWindow("#32770", null);
IntPtr chwnd1 = FindWindowEx(hwnd, IntPtr.Zero, "AfxOleControl70su", null);
IntPtr chwnd2 = FindWindowEx(chwnd1, IntPtr.Zero, "#32770", null);
IntPtr chwnd3 = FindWindowEx(chwnd2, IntPtr.Zero, "Button", "Mute");
PostMessage(chwnd3, BN_CLICKED, 0, (int)IntPtr.Zero);
//The code bellow I made it to see if chwnd… is zero or not.
if (chwnd3 == new IntPtr(0))
{
MessageBox.Show("IntPtr(0)");
}
else if (chwnd3 == IntPtr.Zero)
{
MessageBox.Show("IntPtr.Zero");
}
else
{
MessageBox.Show("IntPtr.Zero not empty");
}
}
Winspector Spy gives me this:
000E036E: #32770
…
00070406: AfxOleControl70su
002C06A2: #32770
…
000F03A4: Button “Mute”
Can someone tell me where I’m wrong?
Thank you very much.
using System;