EDN Admin
Well-known member
in this topic: " http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/79f4b3c0-8aae-4322-b53a-79bae3a8095a How to display Explorer.exe in a Form? " kaymaf answer me with this code:
*The following code allows me to display the folders that opens in form, but how can I get the path / name of the windows that my form display ?
<pre class="prettyprint lang-vb" style=" Imports System.Runtime.InteropServices
API
Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
ENUM
Public Enum ShowWindowCommands
SW_HIDE = 0
SW_SHOWNORMAL = 1
SW_NORMAL = 1
SW_SHOWMINIMIZED = 2
SW_SHOWMAXIMIZED = 3
SW_MAXIMIZE = 3
SW_SHOWNOACTIVATE = 4
SW_SHOW = 5
SW_MINIMIZE = 6
SW_SHOWMINNOACTIVE = 7
SW_SHOWNA = 8
SW_RESTORE = 9
SW_SHOWDEFAULT = 10
SW_FORCEMINIMIZE = 11
SW_MAX = 11
End Enum
Sub HostExplorerOnForm()
Dim ExplorerHandle As IntPtr = FindWindow("CabinetWClass", Nothing)
If Not ExplorerHandle.Equals(IntPtr.Zero) Then
SetParent(ExplorerHandle, Me.Panel1.Handle)
ShowWindow(ExplorerHandle, ShowWindowCommands.SW_NORMAL)
End If
End Sub[/code]
<br/>
<br/>
<br/>
<br/>
<br/>
View the full article
*The following code allows me to display the folders that opens in form, but how can I get the path / name of the windows that my form display ?
<pre class="prettyprint lang-vb" style=" Imports System.Runtime.InteropServices
API
Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
ENUM
Public Enum ShowWindowCommands
SW_HIDE = 0
SW_SHOWNORMAL = 1
SW_NORMAL = 1
SW_SHOWMINIMIZED = 2
SW_SHOWMAXIMIZED = 3
SW_MAXIMIZE = 3
SW_SHOWNOACTIVATE = 4
SW_SHOW = 5
SW_MINIMIZE = 6
SW_SHOWMINNOACTIVE = 7
SW_SHOWNA = 8
SW_RESTORE = 9
SW_SHOWDEFAULT = 10
SW_FORCEMINIMIZE = 11
SW_MAX = 11
End Enum
Sub HostExplorerOnForm()
Dim ExplorerHandle As IntPtr = FindWindow("CabinetWClass", Nothing)
If Not ExplorerHandle.Equals(IntPtr.Zero) Then
SetParent(ExplorerHandle, Me.Panel1.Handle)
ShowWindow(ExplorerHandle, ShowWindowCommands.SW_NORMAL)
End If
End Sub[/code]
<br/>
<br/>
<br/>
<br/>
<br/>
View the full article