views:

221

answers:

2

Hi! I need to use Windows7.DesktopIntegration.WindowsFormsExtensions functions, such as WindowsFormsExtensions.SetTaskbarProgress, with some opened forms. These forms are not opened by my application.

How to get link to Form object of each window? Or maybe there is another way to use these taskbar functions?

A: 

Form objects only exists for those forms created by your own application.

Windows created by other applications only have handles, as far as you can tell.

It might be possible to construct Form objects around existing handles, but I'd say that this is probably not the best way to do it.

Why are you trying to control properties on other forms like that, what is it that you're trying to do?

Lasse V. Karlsen
hmmso how do I, for example, change an AppId of other applications?WindowsFormsExtensions.SetAppId wants a Form object as an argument
valya
With the managed extensions for Windows 7, you probably can't, but they're probably a managed layer on top of Win32/64 API functions, which can probably take just the handles.
Lasse V. Karlsen
+1  A: 

i've found a way:

        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)
            );
        }
valya