elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Ocultar Aplicación "firefox" VB
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ocultar Aplicación "firefox" VB  (Leído 2,334 veces)
daniel.r.23

Desconectado Desconectado

Mensajes: 58


Ver Perfil
Ocultar Aplicación "firefox" VB
« en: 22 Octubre 2014, 06:38 am »

Buenas tengo problemas para ocultar el navegador firefox, he estado buscando en la web y encontré este código:

Código:
<DllImport("user32.dll")> _
Private Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
End Function

Código:
Dim mywindow As Integer
Dim processRunning As Process() = Process.GetProcesses()
Dim Form As Object = New Object()
For Each pr As Process In processRunning
     If pr.ProcessName = "firefox" Then
          mywindow = pr.MainWindowHandle.ToInt32()
          ShowWindow(mywindow, 0)
     End If
Next

de momento no me esta funcionando!!! no hace nada!! y no entiendo porque!!
Si alguien se anima explicarme!! le agradezco!!

les comento que el navegador lo lanza una aplicación diseñada en RUBY, comento por las dudas!


En línea

Miseryk

Desconectado Desconectado

Mensajes: 225


SI.NU.SA U.GU.DE (2NE1 - D-Unit)


Ver Perfil
Re: Ocultar Aplicación "firefox" VB
« Respuesta #1 en: 22 Octubre 2014, 16:22 pm »

BOOL WINAPI ShowWindow(
  _In_  HWND hWnd,
  _In_  int nCmdShow
);

SW_HIDE
0
Hides the window and activates another window.
,

Seguramente no debés tener el hwnd correcto, tal vez es un child el que estás tomando, usá el WinHack para realmente verlo.


En línea

Can you see it?
The worst is over
The monsters in my head are scared of love
Fallen people listen up! It’s never too late to change our luck
So, don’t let them steal your light
Don’t let them break your stride
There is light on the other side
And you’ll see all the raindrops falling behind
Make it out tonight
it’s a revolution

CL!!!
daniel.r.23

Desconectado Desconectado

Mensajes: 58


Ver Perfil
Re: Ocultar Aplicación "firefox" VB
« Respuesta #2 en: 22 Octubre 2014, 16:42 pm »

Disculpa te animas a explicarme de nuevo, no te entendí nada!
En línea

Miseryk

Desconectado Desconectado

Mensajes: 225


SI.NU.SA U.GU.DE (2NE1 - D-Unit)


Ver Perfil
Re: Ocultar Aplicación "firefox" VB
« Respuesta #3 en: 22 Octubre 2014, 22:30 pm »

Disculpa te animas a explicarme de nuevo, no te entendí nada!

No confío en .NET, probá con FindWindow.

msdn.microsoft.com/en-us/library/windows/desktop/ms633499(v=vs.85).aspx
En línea

Can you see it?
The worst is over
The monsters in my head are scared of love
Fallen people listen up! It’s never too late to change our luck
So, don’t let them steal your light
Don’t let them break your stride
There is light on the other side
And you’ll see all the raindrops falling behind
Make it out tonight
it’s a revolution

CL!!!
daniel.r.23

Desconectado Desconectado

Mensajes: 58


Ver Perfil
Re: Ocultar Aplicación "firefox" VB
« Respuesta #4 en: 23 Octubre 2014, 15:13 pm »

Buenas dejo una posible solución a mi problema
Código:
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean
    End Function

    Private Sub HideToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles HideToolStripMenuItem.Click
        Const SW_HIDE As Integer = 0
        Dim p As Process() = Process.GetProcessesByName("firefox")
        If p.Length > 0 Then
            Dim hWnd As IntPtr = p(0).MainWindowHandle
            ShowWindow(hWnd, SW_HIDE)
        End If
    End Sub

Gracias a todos!!
En línea

daniel.r.23

Desconectado Desconectado

Mensajes: 58


Ver Perfil
Re: Ocultar Aplicación "firefox" VB
« Respuesta #5 en: 23 Octubre 2014, 16:55 pm »

Citar
Buenas dejo una posible solución a mi problema
Código:
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean
    End Function

    Private Sub HideToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles HideToolStripMenuItem.Click
        Const SW_HIDE As Integer = 0
        Dim p As Process() = Process.GetProcessesByName("firefox")
        If p.Length > 0 Then
            Dim hWnd As IntPtr = p(0).MainWindowHandle
            ShowWindow(hWnd, SW_HIDE)
        End If
    End Sub

Gracias a todos!!

Les comento por si saben cual es el problema, de que funciona si!! pero no a la primera ejemplo le doy click al notificon y click a hide, y no hace nada!!
pero cuando hago lo mismo por segunda ves ahi si lo oculta, idea de porque hace eso?
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines