就是想做一个程序,当他二重启动的时候,将之前已经启动的窗体最前端显示,像OE一样的。
如何判断二重启动已经知道,就是想请教一下把一启动窗口最前端显示的处理,谢谢

解决方案 »

  1.   

    LZ可以通过Process类来判断程序是否已经运行,查查MSDN
      

  2.   

    我现在用
    SetWindowPos(ParenthWnd, -1, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, 64); 
    可以将那个窗体设到最前端显示,但是怎么取消始终在最前端的状态呢
      

  3.   

    引用  using System.Runtime.InteropServices;[DllImport("user32.dll",   EntryPoint="BringWindowToTop")]   
    public   static   extern   bool   BringWindowToTop   (   
    IntPtr   hwnd   
    );   private void button1_Click(object sender, System.EventArgs e)
    {
    if(this.WindowState   ==   FormWindowState.Minimized)   
    this.WindowState   =   FormWindowState.Normal;   
    this.Activate();   
    BringWindowToTop(this.Handle);   
    }
      

  4.   

    SetWindowPos(Wnd, -1, 0, 0, 0, 0, 0x40 | 0x1 | 0x2); 
    SetWindowPos(Wnd, -2, 0, 0, 0, 0, 0x40 | 0x1 | 0x2); 用这两句倒是可以实现,可是要是之前那个窗体被最小化,怎么才能让它
    显示出来呢?
      

  5.   

    BringWindowToTop 好像没什么反映。还有就是怎么知道另外进程的窗体是不是最小化呢,还有就是怎么能让它显示出来呢?