0

I made a dll for Windows Shell Extension integration, following this tutorial http://blogs.msdn.com/b/codefx/archive/2010/09/14/writing-windows-shell-extension-with-net-framework-4-c-vb-net-part-1.aspx[^]

Now, I added a Windows form in that dll, I'm doing the following:

void OnVerbDisplayFileName(IntPtr hWnd)
{
    ShowSelectedFiles form = new ShowSelectedFiles();
    form.Show(selectedFiles);
}

Everything works fine, just the Forms icon is not shown in task bar and I can't find the process that runs my form.

Any tip on how to solve this problem? Maybe by starting a new process and then showing the form?

Thanks

MaiOM
  • 916
  • 2
  • 13
  • 28

2 Answers2

0

Try using the Form.Show Method (IWin32Window) method so that you can specify the owner window.

See http://ryanfarley.com/blog/archive/2004/03/23/465.aspx for how to specify the owner window from an hWnd.

Also make sure that the form's ShowInTaskBar property is true.

logicnp
  • 5,796
  • 1
  • 28
  • 32
0

The only way to solve this is to create another process.

    void OnVerbDisplayFileName(IntPtr hWnd)
    {
        string file = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
        string executableName = file.Substring(0, file.LastIndexOf("/"));
        executableName += "/MyApp.exe";

        Process gui = new Process();

        gui.StartInfo.FileName = executableName;
        gui.StartInfo.Arguments = selectedFiles.JoinFileNames(" ");

        gui.Start();
    }

Cheers!

MaiOM
  • 916
  • 2
  • 13
  • 28