Windows explorer in panel

Newander

New member
Joined
Oct 24, 2008
Messages
4
Programming Experience
Beginner
Hi guys,

I'm having a hard time getting this code to work, here's the code, I'm trying to open an instance of explorer.exe in a vb.net panel.

VB.NET:
Imports System.Runtime.InteropServices

Public Class Form1

    Private Const WM_SYSCOMMAND 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 lParam As Integer) As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim proc As Process
        proc = Process.Start("explorer.exe", "/n,::{645FF040-5081-101B-9F08-00AA002F954E}")
        proc.WaitForInputIdle()
        SetParent(proc.MainWindowHandle, Me.Panel1.Handle)
        SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
    End Sub

End Class


This is the error I'm getting.

Process has exited, so the requested information is not available.


Thanks for the help!

Newander
 
Back
Top