我有WPF應用程序。 在Windows7上測試我的應用並意識到打開幫助不起作用。NET WPF Process.Start()不適用於Vista和Windows 7
基本上打開CHM幫助文件我稱之爲:
Process.Start("help.chm");
並沒有任何反應。我也嘗試過我的應用程序在Vista SP1,相同的結果。 我是兩個操作系統的管理員
我已經使用了這個問題,但還沒有找到解決方案。
有沒有辦法解決這個問題?
您是否遇到過這種類型的不兼容問題。
謝謝!
我有WPF應用程序。 在Windows7上測試我的應用並意識到打開幫助不起作用。NET WPF Process.Start()不適用於Vista和Windows 7
基本上打開CHM幫助文件我稱之爲:
Process.Start("help.chm");
並沒有任何反應。我也嘗試過我的應用程序在Vista SP1,相同的結果。 我是兩個操作系統的管理員
我已經使用了這個問題,但還沒有找到解決方案。
有沒有辦法解決這個問題?
您是否遇到過這種類型的不兼容問題。
謝謝!
你有沒有嘗試過ShellExecute?
using System.Runtime.InteropServices;
[DllImport(「shell32.dll」,CharSet = CharSet.Auto)] static extern bool 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)
這SO thread應該幫助你。另外,這裏是關於UAC的pretty detailed article以及如何提升。
難道只是.chm文件?如果是這樣,它可能不會打開,因爲默認情況下,不受信任的位置中的chm文件被阻止。參見:KB902225。從this article看來,你可能能夠以編程方式解除它們,即使它只是首先啓動Sysinternals streams.exe(如文章中所引用的那樣)。
直接調用ShellExecute和使用UseShellExecute = true調用ProcessStart(ProcessStartInfo)有什麼區別? – Nir 2009-05-14 11:24:14