我正在尝试将鼠标左键单击发送到 c# 中的 sopcast 静音按钮,但没有结果。这是我所做的:
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 给了我这个:
000E036E: #32770 … 00070406:AfxOleControl70su 002C06A2:#32770 … 000F03A4:“静音”按钮
有人能告诉我哪里错了吗?非常感谢你。