VB.NET中的Explorer.exe [英] Explorer.exe in VB.NET

查看:193
本文介绍了VB.NET中的Explorer.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我想在控制面板上打开explorer.exe.
我已经成功完成了许多其他程序,例如记事本,calc.exe等,但是当我尝试使用资源管理器时,会出现一个外部Windows资源管理器.

这是我的代码,请提供一些帮助:

Hi Folks,

I want to open explorer.exe on my control panel.
I''ve succeeded for many other programs, like notepad, calc.exe, ... but when i try with explorer, an external windows explorer appears.

Here''s my code, some help please :

Imports System.Runtime.InteropServices

Private Const SWM_COMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal Iparam As Integer) As Integer

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Dim Proc = Process.Start("explorer")
    Proc.WaitForInputIdle()
    SetParent(Proc.MainWindowHandle, Me.Panel1.Handle)
    SendMessage(Proc.MainWindowHandle, SWM_COMMAND, SC_MAXIMIZE, 0)
End Sub

推荐答案

这是预期的行为.

请理解,资源管理器"是一个单独的过程,并且这些过程是完全隔离的.即使您设法将其窗口插入窗体中(原则上是可能的,但应一定要避免),但是您仍然无法在功能上进行集成.

如果要浏览表单中的文件系统,请创建这样的浏览器,这将需要一些艰苦的工作,但从概念上讲并不是很困难.或使用此处显示的对话框类之一: http://msdn.microsoft. com/en-us/library/system.windows.forms.commondialog.aspx [
This is expected behavior.

Please understand that "Explorer" is a separate process, and the processes are well isolated. Even if you manage to stick its window into your form (this is possible in principle, but should be avoided by all means), you won''t be able to integrate it functionally anyway.

If you want to browse file system in your form, create such a browser, which will takes some hard work, but not conceptually very difficult. Or use one of the dialog classes shown here: http://msdn.microsoft.com/en-us/library/system.windows.forms.commondialog.aspx[^].

—SA


下面的示例首先生成一个Internet Explorer实例,并在浏览器中显示收藏夹"文件夹的内容.然后,它将启动Internet Explorer的其他一些实例,并显示一些特定的页面或站点.最后,它会启动Internet Explorer,并在导航到特定站点时最小化窗口.

尝试以下链接:
Process.Start方法(字符串)
The following example first spawns an instance of Internet Explorer and displays the contents of the Favorites folder in the browser. It then starts some other instances of Internet Explorer and displays some specific pages or sites. Finally it starts Internet Explorer with the window being minimized while navigating to a specific site.

Try the following link:
Process.Start Method (String)


您可以尝试

//打开控制面板
Process.Start("control.exe");

//打开我的电脑
Process.Start("explorer.exe");

//它是打开的Internet Explorer
Process.Start("iexplore.exe");
you can try it

//it''s open Control Panel
Process.Start ( "control.exe" );

//it''s open my computer
Process.Start ( "explorer.exe" );

//it''s open Internet Explorer
Process.Start ( "iexplore.exe" );


这篇关于VB.NET中的Explorer.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆