我有WPF应用程序。
在Windows7上测试我的应用程序后,意识到打开帮助不起作用。

基本上打开chm帮助文件,我称之为:

Process.Start("help.chm");


没有任何反应。我也在Vista SP1上尝试过我的应用程序,结果相同。
我是两个OS的管理员

我已经用谷歌搜索了这个问题,但是还没有找到解决方案。

有办法解决这个问题吗?

您是否经历过此类不兼容问题。

谢谢!

最佳答案

您是否尝试过ShellExecute?

使用System.Runtime.InteropServices;

[DllImport(“ shell32.dll”,CharSet = CharSet.Auto)]
        静态外部布尔ShellExecuteEx(ref SHELLEXECUTEINFO lpExecInfo);

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct SHELLEXECUTEINFO
{
    public int cbSize;
    public uint fMask;
    public IntPtr hwnd;
    [MarshalAs(UnmanagedType.LPTStr)]
    public string lpVerb;
    [MarshalAs(UnmanagedType.LPTStr)]
    public string lpFile;
    [MarshalAs(UnmanagedType.LPTStr)]
    public string lpParameters;
    [MarshalAs(UnmanagedType.LPTStr)]
    public string lpDirectory;
    public int nShow;
    public IntPtr hInstApp;
    public IntPtr lpIDList;
    [MarshalAs(UnmanagedType.LPTStr)]
    public string lpClass;
    public IntPtr hkeyClass;
    public uint dwHotKey;
    public IntPtr hIcon;
    public IntPtr hProcess;
}


您可以尝试使用以下步骤开始流程:

        SHELLEXECUTEINFO info = new SHELLEXECUTEINFO();
        info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info);
        info.lpVerb = "open";
        info.lpFile = "help.chm";
        info.nShow = 5;
        info.fMask = 12;

        ShellExecuteEx(ref info);


http://www.pinvoke.net/default.aspx/shell32.ShellExecuteEx

09-19 04:49