Autor Tema: Ocultar el proceso de mi aplicacion  (Leído 2159 veces)

0 Usuarios y 1 Visitante están viendo este tema.

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Ocultar el proceso de mi aplicacion
« en: Marzo 05, 2013, 05:06:06 pm »
Tengo este codigo pero al ejecutar me tira un error

Código: (VB) [Seleccionar]
Imports System.Runtime.InteropServices
Imports System.Diagnostics

Public Class Form1

    Private Const SW_HIDE As Integer = 0
    Private Const SW_RESTORE As Integer = 9
    Private hWnd As Integer
    Private p As Process() = Process.GetProcessesByName("explorer.exe")
    Declare Function ShowWindow Lib "User32" (ByVal hwnd As Integer, ByVal ByValnCmdShow As Integer) As Integer

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        hWnd = CType(p(0).MainWindowHandle, Integer)
        ShowWindow(hWnd, SW_HIDE)

    End Sub

End Class

El error que me tira después de ejecutar.

Consulte el final de este mensaje para obtener más detalles sobre cómo invocar a la depuración
Just-In-Time (JIT) en lugar de a este cuadro de diálogo.

************** Texto de la excepción **************
System.IndexOutOfRangeException: Índice fuera de los límites de la matriz.
   en Launcher.Form1.Button2_Click(Object sender, EventArgs e) en G:\00_PROGRAMACION_NET_2010\Launcher\Launcher\Launcher\Form1.vb:línea 34
   en System.Windows.Forms.Control.OnClick(EventArgs e)
   en System.Windows.Forms.Button.OnClick(EventArgs e)
   en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   en System.Windows.Forms.Control.WndProc(Message& m)
   en System.Windows.Forms.ButtonBase.WndProc(Message& m)
   en System.Windows.Forms.Button.WndProc(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Ensamblados cargados **************
mscorlib
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.296 (RTMGDR.030319-2900)
    Código base: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Launcher
    Versión del ensamblado: 1.0.0.0
    Versión Win32: 1.0.0.0
    Código base: file:///G:/00_PROGRAMACION_NET_2010/Launcher/Launcher/Launcher/bin/Debug/Launcher.exe
----------------------------------------
Microsoft.VisualBasic
    Versión del ensamblado: 10.0.0.0
    Versión Win32: 10.0.30319.1 built by: RTMRel
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1001 built by: RTMGDR
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.233 built by: RTMGDR
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1002 built by: RTMGDR
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1001 built by: RTMGDR
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1 (RTMRel.030319-0100)
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.233 built by: RTMGDR
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1 (RTMRel.030319-0100)
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
mscorlib.resources
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1 (RTMRel.030319-0100)
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_es_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
System.Windows.Forms.resources
    Versión del ensamblado: 4.0.0.0
    Versión Win32: 4.0.30319.1 built by: RTMRel
    Código base: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_es_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** Depuración JIT **************
Para habilitar la depuración Just In Time (JIT), el archivo de configuración de esta
aplicación o equipo (machine.config) debe tener el
valor jitDebugging establecido en la sección system.windows.forms.
La aplicación también se debe compilar con la depuración
habilitada

Por ejemplo:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

Cuando esté habilitada la depuración JIT, cualquier excepción no controlada
se enviará al depurador JIT registrado en el equipo
en lugar de controlarlo mediante el cuadro de diálogo.


CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo