WPF 中把资源管理器嵌入到窗体
var exeName = "C:\\WINDOWS\\system32\\mspaint";
//使用Process运行程序
Process p = new Process();
p.StartInfo.FileName = "explorer";
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.Start();
System.Threading.Thread.Sleep(200);
IntPtr appWin = p.MainWindowHandle;
IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(fh)).Handle;
ShowWindow(p.MainWindowHandle, 0);
SetParent(appWin, hwnd);
MoveWindow(appWin, 0, 0, 500, 400, true);
ShowWindow(p.MainWindowHandle, 3);
以上代码可以把画图文本之类的放入窗体中,但是无法把资源管理器放进去
已解决
【相关推荐】
private bool IsExistKey(string keyName)
{
try
{
bool _exist = false;
RegistryKey local = Registry.LocalMachine;
RegistryKey runs = local.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
if (runs == null)
{
RegistryKey key2 = local.CreateSubKey("SOFTWARE");
RegistryKey key3 = key2.CreateSubKey("Microsoft");
RegistryKey key4 = key3.CreateSubKey("Windows");
RegistryKey key5 = key4.CreateSubKey("CurrentVersion");
RegistryKey key6 = key5.CreateSubKey("Run");
runs = key6;
}
string[] runsName = runs.GetValueNames();
foreach (string strName in runsName)
{
if (strName.ToUpper() == keyName.ToUpper())
{
_exist = true;
return _exist;
}
}
return _exist;
}
catch
{
return false;
}
}