2009-09-22 86 views
1

我需要使用Windows7.DesktopIntegration.WindowsFormsExtensions函數,例如WindowsFormsExtensions.SetTaskbarProgress,以及一些打開的窗體。這些表格不是由我的應用程序打開的。獲取所有打開的表單,c#?

如何獲取每個窗口的窗體對象的鏈接?或者也許有另一種方式來使用這些任務欄功能?

回答

1

我已經找到一種方法:

 WindowsFormsExtensions.SetAppId(this, "totalcmd"); 
     Process[] processes = Process.GetProcessesByName("TOTALCMD"); 
     foreach (Process p in processes) 
     { 
      IntPtr pFoundWindow = p.MainWindowHandle; 
      //MessageBox.Show(p.ProcessName); 

      Windows7.DesktopIntegration.Windows7Taskbar.SetWindowAppId(pFoundWindow, "totalcmd"); 
      MessageBox.Show(
       Windows7.DesktopIntegration.Windows7Taskbar.GetWindowAppId(pFoundWindow) 
      ); 
     } 
0

表單對象僅適用於由您自己的應用程序創建的表單。

由其他應用程序創建的窗口只有句柄,據您所知。

可能有可能構建表單對象圍繞現有的把手,但我想說,這可能不是做的最好的方式。

你爲什麼要試圖控制其他形式的屬性,這是什麼,你想要做什麼?

+0

嗯 讓我怎麼,例如,改變的其他應用程序一個AppID? WindowsFormsExtensions.SetAppId需要一個Form對象作爲參數 – 2009-09-22 18:20:32

+0

對於Windows 7的託管擴展,您可能不能,但它們可能是Win32/64 API函數之上的託管層,它可能只需要把手。 – 2009-09-22 18:36:38

相關問題