Click here to Skip to main content
13,086,019 members (82,187 online)
Rate this:
Please Sign up or sign in to vote.
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")
    SetParent(Proc.MainWindowHandle, Me.Panel1.Handle)
    SendMessage(Proc.MainWindowHandle, SWM_COMMAND, SC_MAXIMIZE, 0)
End Sub
Posted 22-Dec-11 3:11am
Updated 22-Dec-11 3:13am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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:[^].

Monjurul Habib 23-Dec-11 15:36pm
nice answer, 5!
SAKryukov 23-Dec-11 15:39pm
Thank you, Monjurul.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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" );
contact97438 22-Dec-11 9:50am
Yes, i know, but for Explorer.exe, it's an external windows, out of my main form1, where i've put a panel control.
SAKryukov 22-Dec-11 13:02pm
So what? Did you expect something else. Please see my answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 22 Dec 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100