外部程序中有选项卡,共有三个卡项A,B,C
现在显示的是A界面中的内容,如何通过程序使B为当前选定的选项?

解决方案 »

  1.   

    比如我现在运行了一个程序叫AA,自己写了个程序叫BB,现在想在BB中控制AA中的一个选项卡
      

  2.   

    而AA的选项卡中有三个卡项,分别叫A,B,C
    我现在想通过BB来控制AA中的选项卡(可能是一个控件?)中的三个卡项中切换。
      

  3.   

    C#.Net进程间通讯可以用IPCREMOTING或者使用通道
    你可以参考下面的文章
    http://www.cnblogs.com/davyjiang/articles/1382294.html
    http://www.diybl.com/course/4_webprogram/asp.net/netjs/2007113/82472.html
    http://hi.baidu.com/55csharp/blog/item/c34f3f653f958ff8f63654e2.html
      

  4.   

    我想让第三个选项卡变成当前选项卡,应该怎么做?
    ----------------------
    tabControl.SelectedIndex = 2;
      

  5.   

    或者直接设置Page,比如:
    t.SelectedTab=this.page3;
      

  6.   

    激动? BB?楼主,你在说什么?你激动了?BB在哪儿?
      

  7.   


    是外部程序想控制另外一个程序中的Tab控件
      

  8.   

    这样:
    用WINAPI,取得窗口句柄,发送按键消息(CTRL + TAB键)。
      

  9.   

    [DllImport("user32.dll", EntryPoint = "FindWindow")]
    private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
    [DllImport("user32.dll")]
    private static extern bool SetForegroundWindow(IntPtr hWnd);private void button1_Click(object sender, EventArgs e)
    {
        IntPtr hWnd = FindWindow(null, "系统属性");
        if (hWnd != IntPtr.Zero)  //
        {
            SetForegroundWindow(hWnd);
            SendKeys.Send("^{Tab}");
        }
    }测试用例:
    (1)开始菜单 --> 我的电脑 -->右键 --> 属性 --> 系统属性窗口(由7个TAB页面组成)
    (2)执行上面的C#代码,我的电脑属性,在“常规”、“计算机名”、“硬件”... ... 等之间切换。