Visual Basic.NET - Mostrar cmd dentro de un Form

   
Vista:

Mostrar cmd dentro de un Form

Publicado por Tallara (1 intervención) el 10/07/2009 00:52:17
He estao mirando por ahi la forma de poder meter la consola de comando cmd dentro de un form, e encontrado algo pero sigue sin funcionarme, si alguien me puede ayudar a ponerla dentro seria de gran ayuda, os pongo todo el codigo como lo tengo yo puesto.
---------------------------------------------------------------------------------------------------------------------------------
Public Class MDIParent1

Private Sub FileMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileMenu.Click

Dim p As Process
Dim h As IntPtr
p = Process.Start("cmd.exe")
h = Win32API.SetParent(p.Handle, Me.TabPage1.Handle)
Win32API.ShowWindow(p.Handle, 1)

End Sub

Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Public Class Win32API
Declare Function ShowWindow Lib "user32" (ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Boolean
Declare Function SetParent Lib "user32" (ByVal hWndChild As System.IntPtr, ByVal hWndNewParent As System.IntPtr) As System.IntPtr
Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As System.IntPtr) As Integer

Public Shared Function ShowWindowAPI(ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Boolean
Return ShowWindow(hWnd, nCmdShow)
End Function

Public Shared Function SetParentAPI(ByVal hWndChild As System.IntPtr, ByVal hWndNewParent As System.IntPtr) As System.IntPtr
Return SetParent(hWndChild, hWndNewParent)
End Function
End Class
-------------------------------------------------------------------------------------------------------------------------------------

Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder