小弟我初学。不知道问的对不对!请知道的大侠顺便说说是哪个命名空间提供的。谢谢!

解决方案 »

  1.   

    [DllImport("User32.dll")] private static extern bool
    SetForegroundWindow(IntPtr hWnd);
      

  2.   

    http://www.pinvoke.net/default.aspx/user32/SetForegroundWindow.htmlhttp://www.pinvoke.net/default.aspx/user32/AllowSetForegroundWindow.htmlhttp://www.pinvoke.net/default.aspx/user32/LockSetForegroundWindow.html
      

  3.   

    to serversql(啊初) 
    小弟我是新手,这个代码该怎么用呢?
      

  4.   

    to misvcom(零下一度) 
    大哥给的代码看不太懂呢,小弟菜的很。小弟我的目的就是把一个IE窗口(我通过Windows Title来找指定的IE的窗体)作为当前窗体。怎么办?
      

  5.   

    [DllImport("User32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd);.........IntPtr hWnd = 找到IE的窗口句柄;
    SetForegroundWindow(hWnd);
      

  6.   

    to wxdl1981(沉默之狼) 大哥的代码应该放在哪里呢?小弟初学。不好意思哦!
      

  7.   

    放在窗体类里面. 比方说Main函数的上面(不是Main函数里面)
    [DllImport("User32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd);
    放在在窗体的事件处理函数里面,比如button1的Click事件中
    IntPtr hWnd = 找到IE的窗口句柄;
    SetForegroundWindow(hWnd);