Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i am trying to control an application from c# application . i used spy++ to navigate the button .but it doesnot work for all buttons. how to solve it?

What I have tried:

private void button12_Click(object sender, EventArgs e)
      {
          IntPtr maindHwnd = FindWindow(null, "Inspector");
          if (maindHwnd != IntPtr.Zero)
          {
              //IntPtr panel = FindWindowEx(maindHwnd, IntPtr.Zero, "TPanel", null);
              IntPtr childHwnd = FindWindowEx(maindHwnd, IntPtr.Zero, " TPanel", "Connect");
              if (childHwnd != IntPtr.Zero)
              {
                  SendMessage(childHwnd, BM_CLICK, IntPtr.Zero, IntPtr.Zero);     // Send a message from the button
              }
              else
              {
                  textBox3.BackColor = Color.Yellow;
                  textBox3.Text = "エラー";
              }
          }
          else
          {
              textBox3.BackColor = Color.Yellow;
              textBox3.Text = "エラーメッセージボックスありません";
          }
      }
Posted
Comments
Richard MacCutchan 2-Mar-22 4:57am    
"but it doesnot work for all buttons"
What does that mean?
n.deny 7-Mar-22 4:06am    
how to control such buttons from my application ?
Richard MacCutchan 7-Mar-22 4:22am    

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900