Click here to Skip to main content
Rate this: bad
good
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")
    Proc.WaitForInputIdle()
    SetParent(Proc.MainWindowHandle, Me.Panel1.Handle)
    SendMessage(Proc.MainWindowHandle, SWM_COMMAND, SC_MAXIMIZE, 0)
End Sub
Posted 22-Dec-11 3:11am
Edited 22-Dec-11 3:13am
v2
Rate this: bad
good
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: http://msdn.microsoft.com/en-us/library/system.windows.forms.commondialog.aspx[^].
 
—SA
  Permalink  
v2
Comments
Monjurul Habib at 23-Dec-11 15:36pm
   
nice answer, 5!
SAKryukov at 23-Dec-11 15:39pm
   
Thank you, Monjurul. --SA
Rate this: bad
good
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)
  Permalink  
Rate this: bad
good
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" );
  Permalink  
v2
Comments
contact97438 at 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 at 22-Dec-11 13:02pm
   
So what? Did you expect something else. Please see my answer. --SA

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 840
1 OriginalGriff 437
2 Abhinav S 303
3 thatraja 225
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,122
1 OriginalGriff 4,520
2 Peter Leow 3,744
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 22 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid