0

I've a client application which having some tabs in the menu tab as followsenter image description here.I need to perform some action when the browse tab is selected. how can i get that event in my application. i want to write my own application to perform this action. I tried in this way

int chars = 256;
                StringBuilder buff = new StringBuilder(chars);
                // Obtain the handle of the active window.
                IntPtr handle = GetForegroundWindow();
                if (GetWindowText(handle, buff, chars) > 0)
                {
                   if (buff.ToString() == mainWindowName)
                    {
                        IntPtr WndToFind = FindWindowByCaption(IntPtr.zero, "Browse");
                        if(WndToFind != IntPtr.Zero)
                        {
                            MessageBox.Show("Inside Browse");
                        }     
                    }
                }

I want to dispaly some message when Browse tab is active. Please help me.

ChanduRaj
  • 161
  • 1
  • 16

1 Answers1

0

If you are using tabcontrol, below is the code to know which tabpage is selected by user.

 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {          
      if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])
      {
           ...add your code here
      }
  }
sowjanya attaluri
  • 903
  • 2
  • 9
  • 27