0

我按照本教程http://blogs.msdn.com/b/codefx/archive/2010/09/14/writing-windows-shell-extension-with-net-framework-4为 Windows Shell 扩展集成制作了一个 dll -c-vb-net-part-1.aspx [^]

现在,我在该 dll 中添加了一个 Windows 表单,我正在执行以下操作:

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

一切正常,只是表单图标未显示在任务栏中,我找不到运行表单的进程。

关于如何解决这个问题的任何提示?也许通过开始一个新流程然后显示表格?

谢谢

4

2 回答 2

0

尝试使用Form.Show Method (IWin32Window)方法,以便您可以指定所有者窗口。

有关如何从 hWnd 指定所有者窗口,请参阅http://ryanfarley.com/blog/archive/2004/03/23/465.aspx 。

还要确保窗体的 ShowInTaskBar 属性为 true。

于 2012-04-28T02:43:15.663 回答
0

解决这个问题的唯一方法是创建另一个进程。

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

干杯!

于 2012-05-01T07:37:50.853 回答