WPF 中把资源管理器嵌入到窗体

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

以上代码可以把画图文本之类的放入窗体中,但是无法把资源管理器放进去

已解决

【相关推荐】



  • 帮你找了个相似的问题, 你可以看下: https://ask.csdn.net/questions/7571114
  • 这篇博客你也可以参考下:WPF程序启动后资源管理器应用程序无法显示
  • 您还可以看一下 赵庆明老师的WPF贪吃蛇游戏开发详解课程中的 课程介绍及工具准备【免费观看】小节, 巩固相关知识点
  • 除此之外, 这篇博客: WPF应用开机自启动编程实现中的 1.判断注册表键值对是否存在 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
            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;
                }
            }
    

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^