两窗体执行一样的动作

解决方案 »

  1.   

    查一下进程间通信的东西,相信很容易解决
    GBY(google,baidu,yahoo)是你最好的老师~
      

  2.   

    findwidnow查找句柄
    [DllImport ( "user32.dll", EntryPoint = "FindWindow", SetLastError = true )]
    private static extern IntPtr FindWindow( string lpClassName, string lpWindowName );
    [DllImport ( "user32.dll", EntryPoint = "FindWindowEx", SetLastError = true )]
    private static extern IntPtr FindWindowEx( IntPtr hwndParent, uint hwndChildAfter, string lpszClass, string lpszWindow );
    [DllImport ( "user32.dll", EntryPoint = "SendMessage", SetLastError = true, CharSet = CharSet.Auto )]
    private static extern int SendMessage( IntPtr hwnd, uint wMsg, int wParam, int lParam );
    [DllImport ( "user32.dll", EntryPoint = "SetForegroundWindow", SetLastError = true )]
    private static extern void SetForegroundWindow( IntPtr hwnd )
    const uint BM_CLICK = 0xF5;  
      IntPtr hwndCalc = FindWindow ( null, "" );  
      if ( hwndCalc != IntPtr.Zero )
      {  }
      

  3.   

    用api 找窗体句柄 然后传参 告诉他要做什么。。